Pythagorean Theorem & Right Triangle Calculator
Type any two sides and get the third with c² = a² + b², as an exact square root and a decimal, with every step and a drawing to scale. Advanced adds angles, area, perimeter, height, box diagonals and the builder’s 3-4-5 check.
Fill in any two boxes and leave the rest empty. The right angle is C; the hypotenuse c is the long side opposite it.
The longest straight line inside a box or room, corner to opposite corner: d = √(l² + w² + h²).
Mark a distance along each side from the corner, then measure straight between the two marks. A 3-4-5 (or 6-8-10) gap means a perfect 90°.
Whole numbers that fit a² + b² = c². Type a number to find every triple that contains it, or list them all up to a size.
You can type fractions, roots and units: 1 1/2, 2.5, √2, 2√3, 30 cm or 5' 6".
How your right triangle is worked out
Square the two legs, add them, and take the square root: c² = a² + b².
- 1
Square the legs
a² = 16b² = 36
- 2
Add them
16 + 36c² = 52
- 3
Square root
c = √52= 2√13c ≈ 7.2111
- 4
The angles
A = tan⁻¹(a ÷ b)A = 33.69°B = 56.31°
Read more: the formula, a worked example, triples, the 3-4-5 check and more
A right triangle has one 90° corner, called C here. The two sides that meet there are the legs, a and b. The side opposite the right angle is the hypotenuse, c, and it is always the longest. Pythagoras’ theorem links the three: the square on the hypotenuse has the same area as the squares on the two legs added together. Any two values fix a right triangle, as long as one of them is a length.
The formula
Hypotenuse: c = √(a² + b²)
Missing leg: a = √(c² − b²), b = √(c² − a²)
Angles (SOH CAH TOA): sin A = a ÷ c, cos A = b ÷ c, tan A = a ÷ b, and B = 90° − A
Area = ½ × a × b
Perimeter = a + b + c
Height to the hypotenuse: h = a × b ÷ c
Pieces of the hypotenuse: a² ÷ c and b² ÷ c
Inradius = (a + b − c) ÷ 2, circumradius = c ÷ 2 (the middle of the hypotenuse is the centre)
Box diagonal: d = √(length² + width² + height²)
Worked example
Legs a = 4 and b = 6 (the starting values).
- Square the legs: 4² = 16 and 6² = 36.
- Add them: c² = 16 + 36 = 52.
- Square root: c = √52. 52 = 4 × 13 and √4 = 2, so c = 2√13 ≈ 7.2111.
- Angle A: tan A = 4 ÷ 6 = 0.6667, so A = tan⁻¹(0.6667) = 33.69°. Angle B = 90° − 33.69° = 56.31°.
- Area: ½ × 4 × 6 = 12. Perimeter: 4 + 6 + 2√13 = 10 + 2√13 ≈ 17.2111.
- Height to the hypotenuse: 4 × 6 ÷ 2√13 = 12 ÷ √13 = 12√13/13 ≈ 3.3282.
- Hypotenuse pieces: 16 ÷ 7.2111 = 2.2188 and 36 ÷ 7.2111 = 4.9923 (they add up to 7.2111).
- Inradius: (4 + 6 − 7.2111) ÷ 2 = 1.3944. Circumradius: 7.2111 ÷ 2 = 3.6056.
- Check: 2.2188 × 7.2111 = 16 = a², as it should be.
Simplifying square roots (surds)
To simplify √n, find the biggest square number that divides n and take its root outside: √52 = √(4 × 13) = 2√13, √72 = √(36 × 2) = 6√2 and √75 = √(25 × 3) = 5√3. If no square bigger than 1 divides it (like √41), it is already as simple as it gets. Fractions work the same way: √(1/2) = √2/2.
Special right triangles
| Triangle | Sides (a : b : c) | Where you meet it |
|---|---|---|
| 45-45-90 | 1 : 1 : √2 | Half a square, cut along the diagonal |
| 30-60-90 | 1 : √3 : 2 | Half an equilateral triangle |
| 3-4-5 | 3 : 4 : 5 | Builders’ square check, set squares |
Pythagorean triples
Whole-number right triangles. The primitive ones share no common factor; all others are multiples of them. Euclid’s formula gives every primitive triple: take whole numbers m > n with no common factor and one of them even, then a = m² − n², b = 2mn and c = m² + n².
| m, n | Triple | Check |
|---|---|---|
| 2, 1 | 3, 4, 5 | 9 + 16 = 25 |
| 3, 2 | 5, 12, 13 | 25 + 144 = 169 |
| 4, 1 | 15, 8, 17 | 225 + 64 = 289 |
| 4, 3 | 7, 24, 25 | 49 + 576 = 625 |
| 5, 2 | 21, 20, 29 | 441 + 400 = 841 |
| 5, 4 | 9, 40, 41 | 81 + 1600 = 1681 |
Checking a corner is square (3-4-5)
Mark 3 along one side from the corner and 4 along the other, then measure between the marks. It should be 5. Bigger multiples are more accurate over a long wall. Typical marks:
| Sides | Diagonal for 90° |
|---|---|
| 3 ft and 4 ft | 5 ft |
| 6 ft and 8 ft | 10 ft |
| 9 ft and 12 ft | 15 ft |
| 0.6 m and 0.8 m | 1 m |
| 1.2 m and 1.6 m | 2 m |
| 3 m and 4 m | 5 m |
If the diagonal is too long, the corner is wider than 90°; too short, and it is tighter. The Is this corner square? tool in Advanced works out the exact angle with the law of cosines. When no allowed error is typed it uses 0.1% of the ideal diagonal (about 1/8 in over 10 ft).
Box (3D) diagonal
Pythagoras on the floor gives the floor diagonal, √(l² + w²). That diagonal and the height make another right triangle, so the space diagonal is √(l² + w² + h²). A 3 × 4 × 12 box: floor diagonal √25 = 5, space diagonal √(25 + 144) = 13.
For a triangle without a right angle (three sides, two sides and an angle, or three points), use the triangle calculator, which handles the law of sines and cosines and the ambiguous SSA case.
The calculator works in double precision and rounds only for display. Exact answers use whole-number fractions, so they appear when your inputs are whole numbers, decimals, fractions or simple roots like √2.
Common questions
What is the Pythagorean theorem?
In a right triangle, the square of the hypotenuse (the long side opposite the 90° angle) equals the sum of the squares of the other two sides: c² = a² + b². With legs 3 and 4, c² = 9 + 16 = 25, so c = 5. It only works for right triangles; for other triangles use the law of cosines.
How do I find a missing leg of a right triangle?
Turn the theorem round: a = √(c² − b²). Square the hypotenuse, take away the square of the leg you know, then take the square root. With hypotenuse 13 and leg 5: 169 − 25 = 144, and √144 = 12. The hypotenuse must be the longest side, or there is no answer.
How do I simplify a square root answer like √52?
Look for the biggest perfect square that divides the number. 52 = 4 × 13, and √4 = 2, so √52 = 2√13, which is about 7.2111. So legs of 4 and 6 give a hypotenuse of exactly 2√13. The calculator shows this exact form next to the decimal whenever one exists.
What is a Pythagorean triple?
Three whole numbers that fit a² + b² = c², such as 3-4-5, 5-12-13 and 8-15-17. Euclid’s formula makes them: pick whole numbers m > n, then a = m² − n², b = 2mn and c = m² + n². With m = 2 and n = 1 you get 3, 4 and 5. Any multiple, like 6-8-10, works too.
How do builders use 3-4-5 to check a corner is square?
Measure 3 units along one wall and 4 along the other, then measure between the two marks. If the corner is exactly 90°, the gap is 5. Bigger multiples such as 6-8-10 are more accurate. If the diagonal is too long, the corner is wider than 90°; too short, and it is tighter.
How do I find the diagonal of a box or room?
Use Pythagoras twice, or in one go: diagonal = √(length² + width² + height²). For a box 3 by 4 by 12, the floor diagonal is √(9 + 16) = 5, and the space diagonal is √(25 + 144) = √169 = 13. This tells you the longest pole that fits inside.
Related calculators
Made by Zulu Calculator, part of AlphaZulu LLC. Formulas are shown in full and rule figures are checked against official sources; see how we build calculators.