1. Computing & Technology

Discuss in my forum

Calculating the Hypotenuse in PHP

By , About.com Guide

See More About:

1 of 3

What is the Hypotenuse?
Right Triangle

Right Triangle

The hypotenuse is the longest side of a right triangle. A right triangle is a triangle with one of the angles being a right angle (90 degrees.) The hypotenuse is the side that is directly opposite of this 90 degree angle. In the diagram above, the hypotenuse is c, the red line.

According to the pythagorean theorem: a2+b2=c2. So let's plug in some values for a, b and c.

If a is 3 and b is 4 then a2 is 9 and b2 is 16. 9+16 = 25, so c2 =25. To to find c, we take the square root of 25, which is 5. So we conclude that c=5.

  1. About.com
  2. Computing & Technology
  3. PHP / MySQL
  4. PHP Functions
  5. Find the Hypotenuse with PHP - PHP Hypotenuse - Hypotenuse of a Right Triangle

©2012 About.com. All rights reserved.

A part of The New York Times Company.