1. Home
  2. Computing & Technology
  3. PHP / MySQL

Calculating the Hypotenuse in PHP

By Angela Bradley, About.com

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.

Explore PHP / MySQL
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

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

©2009 About.com, a part of The New York Times Company.

All rights reserved.