Calculates the hypotenuse of a right triangle with the Pythagorean theorem √(a² + b²).
In a right triangle, the side opposite the right angle is the hypotenuse, and it is always the longest of the three. Given the two legs that form the right angle, the Pythagorean theorem produces it.
The theorem itself states ; taking the square root of both sides gives the formula above.
With the defaults, and :
The hypotenuse is 5. The triple 3, 4, 5 is the best known set of whole numbers that fits a right triangle exactly.
The Pythagorean theorem holds for right triangles only, and and are the two legs, never the hypotenuse. If you know the hypotenuse and one leg and want the other leg, subtract instead: . Note also that is not ; in the example , while the true hypotenuse is 5. The hypotenuse is always longer than either leg on its own, and always shorter than the two legs added together.