Pythagorean theorem calculator
Enter two sides of a right triangle, get the third with the steps.
What is the Pythagorean theorem?
In a right triangle, a² + b² = c², where c is the hypotenuse — the side opposite the right angle. With legs of 3 and 4: 9 + 16 = 25, so c = √25 = 5.
How do I find a missing leg?
Subtract instead of add: a = √(c² − b²). With a hypotenuse of 13 and a leg of 5: √(169 − 25) = √144 = 12. The hypotenuse must be the longest side.
How do builders use the 3-4-5 rule?
To square a corner: measure 3 ft along one side and 4 ft along the other; if the diagonal between the marks is exactly 5 ft, the corner is 90°. For larger layouts use 6-8-10 or 9-12-15.
What are Pythagorean triples?
Whole numbers that fit a² + b² = c² exactly: 3-4-5, 5-12-13, 8-15-17 and 7-24-25, plus any multiple of them, like 6-8-10.
Does it work for any triangle?
Only for right triangles. For other triangles use the law of cosines, c² = a² + b² − 2ab·cos C — the triangle calculator does that.
How do I generate Pythagorean triples?
Pick whole numbers m > n and compute m² − n², 2mn and m² + n². With m = 5 and n = 2 that gives 21, 20 and 29, and indeed 21² + 20² = 841 = 29².
Can the theorem be used backward to test for a right angle?
Yes. If the squares of two sides add up exactly to the square of the third, the triangle has a right angle opposite the longest side. This is the basis of the 3-4-5 check used to square a foundation or a deck frame.
What the formula says
In a right triangle with legs a and b and hypotenuse c, the square built on the hypotenuse has the same area as the two squares on the legs together: a² + b² = c². The hypotenuse is always the longest side, so c is larger than either leg. To find c, add the squares and take the square root; to find a leg, subtract the square of the known leg from c² and take the square root. All three sides must be in the same unit, and the answer comes out in that unit.
Worked examples
A room 12 ft by 16 ft has a diagonal of √(144 + 256) = √400 = 20 ft. A 20 ft ladder leaning on a wall with its foot 5 ft from the wall reaches √(400 − 25) = √375 = 19.36 ft up the wall. A screen 48 inches wide and 27 inches tall has a diagonal of √(2,304 + 729) = 55.07 inches. Notice that the last one is a 16 : 9 screen of 55 inches, because the screen size quoted is the diagonal.
Common mistakes
Forgetting the final square root is the most frequent slip: 3² + 4² = 25 is c², not c. Adding when you should subtract is the second; when the hypotenuse is given, the missing leg comes from a difference, and the calculator will reject a leg longer than the hypotenuse. A third is applying the theorem to a triangle that is not a right triangle, where it gives the wrong side; use the law of cosines there. Finally, do not mix units, such as feet for one leg and inches for the other.
Sources: OpenStax Prealgebra 2e (the Pythagorean theorem, in the geometry chapter) and OpenStax Algebra and Trigonometry; the triple-generating formula is Euclid’s. Related: right triangle calculator, triangle calculator, distance formula calculator and ladder calculator.