This Pythagorean theorem calculator finds any missing side of a right triangle. Choose whether you need the hypotenuse or one of the legs, enter the two sides you know, and you get the third side along with both acute angles, the area, the perimeter and the full working.
The Pythagorean theorem
In a right triangle, the square of the hypotenuse (the side opposite the 90° angle) equals the sum of the squares of the other two sides, called the legs:
a² + b² = c² hypotenuse c = √(a² + b²) leg a a = √(c² − b²) leg b b = √(c² − a²)
The hypotenuse is always the longest side. If you are solving for a leg and the hypotenuse you entered is not longer than the other leg, no right triangle exists, and the calculator will tell you so.
How to use the calculator
- Pick what to solve for in the Solve for menu.
- Fill in the two known sides. The field you are solving for is ignored, so you can leave any value in it.
- Use any length unit (inches, feet, meters); the answer comes out in the same unit. Area is in that unit squared.
Angle α sits opposite leg a and angle β opposite leg b; together they always add up to 90°.
Worked examples
- Legs 3 and 4: c = √(9 + 16) = √25 = 5. Angles 36.8699° and 53.1301°, area 6, perimeter 12.
- Legs 5 and 12: c = √(25 + 144) = √169 = 13. Area 30, perimeter 30.
- Leg 8, hypotenuse 17: a = √(289 − 64) = √225 = 15.
- Leg 7, hypotenuse 25: b = √(625 − 49) = √576 = 24; the angle opposite b is 73.7398°.
- Legs 1 and 1: c = √2 = 1.414214. This is the diagonal of a unit square, and both angles are 45°.
Common Pythagorean triples
A Pythagorean triple is a set of three whole numbers that satisfy a² + b² = c². Multiplying a triple by any whole number gives another one, so 3-4-5 also produces 6-8-10, 9-12-15 and 30-40-50.
| Leg a | Leg b | Hypotenuse c | Check |
|---|---|---|---|
| 3 | 4 | 5 | 9 + 16 = 25 |
| 5 | 12 | 13 | 25 + 144 = 169 |
| 8 | 15 | 17 | 64 + 225 = 289 |
| 7 | 24 | 25 | 49 + 576 = 625 |
| 20 | 21 | 29 | 400 + 441 = 841 |
| 9 | 40 | 41 | 81 + 1,600 = 1,681 |
| 12 | 35 | 37 | 144 + 1,225 = 1,369 |
Real-world uses
- Squaring a corner (the 3-4-5 rule): builders mark 3 ft along one wall and 4 ft along the other. If the diagonal between the marks is exactly 5 ft, the corner is a true 90°. For bigger layouts use 6-8-10 or 9-12-15.
- Ladder placement: a 12 ft ladder with its base 3 ft from the wall reaches √(144 − 9) = 11.62 ft up the wall. Safety guidance from OSHA uses a 4:1 ratio: 1 ft out for every 4 ft of height.
- Screen sizes: TVs are sold by the diagonal. A 16:9 screen that is 48 in wide and 27 in tall has a diagonal of √(2,304 + 729) = 55.07 in, sold as a 55-inch TV.
- Roof framing and ramps: rafter length is the hypotenuse of the rise and run. See the rafter length calculator and roof pitch calculator.
- Straight-line distance: walking 9 blocks east and 12 blocks north puts you √(81 + 144) = 15 blocks from where you started.
The distance formula is the same idea
The distance between two points on a graph, (x₁, y₁) and (x₂, y₂), is the hypotenuse of a right triangle whose legs are the horizontal and vertical gaps:
d = √((x₂ − x₁)² + (y₂ − y₁)²)
From (1, 2) to (7, 10) the legs are 6 and 8, so the distance is √(36 + 64) = 10. In three dimensions add a third squared term: the space diagonal of a 2 × 3 × 6 box is √(4 + 9 + 36) = 7.
Common mistakes
- Adding when you should subtract. To find a leg, subtract: a² = c² − b². Adding gives a number longer than the hypotenuse.
- Using it on a non-right triangle. The theorem only holds with a 90° angle. For other triangles use the law of cosines, or the triangle calculator if you know all three sides.
- Taking the square root too early. √(a² + b²) is not a + b. For legs 3 and 4 the hypotenuse is 5, not 7.
Related calculators
- Triangle Calculator
- Square Root Calculator
- Area Calculator
- Rise Over Run Slope Calculator
- Rafter Length Calculator
- Stair Calculator
Frequently Asked Questions
What is the Pythagorean theorem?
In any right triangle, a² + b² = c², where a and b are the legs and c is the hypotenuse opposite the right angle.
How do I find the hypotenuse?
Square both legs, add them and take the square root: c = √(a² + b²). With legs 6 and 8, c = √100 = 10.
How do I find a missing leg?
Subtract the square of the known leg from the square of the hypotenuse and take the square root: a = √(c² − b²). With c = 13 and b = 12, a = √25 = 5.
Does the Pythagorean theorem work for all triangles?
No, only for right triangles. For other triangles the law of cosines, c² = a² + b² − 2ab·cos C, generalizes it.
Can the sides be decimals?
Yes. The theorem works with any positive lengths, and most real measurements give irrational results such as √2 ≈ 1.414214.