Pythagorean Theorem Calculator
Solve a² + b² = c² for any missing side, check whether three sides form a right triangle, or extend the theorem to the space diagonal of a box. Enter numbers in any common length unit, control the significant figures, and see a live to-scale diagram plus a step-by-step derivation.
Fill any two of leg a, leg b or hypotenuse c and leave the third blank — the calculator solves for it and shows the working.
What is the Pythagorean theorem?
The Pythagorean theorem states that in any right triangle — a triangle with one 90° angle — the square built on the hypotenuse has the same area as the two squares built on the other two sides added together. Written as an equation:
Because the theorem only involves squares of lengths, it doesn't matter which leg you call a and which you call b, and it works in any consistent unit — meters, feet or pixels — as long as all three sides use the same one.
Pythagorean theorem, case by case
The four cases below cover every way this calculator is used — finding the hypotenuse, finding a missing leg, checking whether a triangle is right-angled, and extending the theorem to a 3D box. Each card shows the formula, a scaled diagram, and a fully worked example with the actual numbers.
Find the hypotenuse from two legs
When both legs of a right triangle are known, square each one, add the two squares, then take the square root. The result is the hypotenuse — the side opposite the 90° angle and always the longest of the three.
Find a missing leg from the hypotenuse and one leg
If the hypotenuse and one leg are known, rearrange the theorem to isolate the unknown leg. Subtract the known-leg square from the hypotenuse square first, then take the square root.
Check whether a triangle is a right triangle
Given all three sides, sort them so the largest is c, then test whether a² + b² equals c². If the two sides are equal the triangle has a 90° angle opposite c; if a² + b² is smaller, the angle at c is obtuse; if larger, it's acute.
3D space diagonal of a rectangular box
Apply the theorem twice: first to length and width to get the base diagonal, then again with that diagonal and the height. The two steps collapse into a single formula that works for any box.
Why it works — a short visual proof
Take four identical copies of the right triangle (legs a and b, hypotenuse c) and arrange them inside a larger square whose side length is a + b, with each triangle tucked into one corner. The outer square therefore has area (a + b)².
The four triangles occupy an area of 4 × (½·a·b) = 2ab. Whatever is left over in the middle is a smaller tilted square whose side is exactly the hypotenuse c, so its area is c². Because the total is the same either way:
Expanding the left side gives a² + 2ab + b² = 2ab + c². Cancel the 2ab from both sides and you're left with a² + b² = c². The same theorem drops out no matter how the four triangles are re-arranged inside the same outer square, which is why there are dozens of geometric proofs of this one identity.
Pythagorean triples
A Pythagorean triple is a set of three positive whole numbers that satisfy a² + b² = c² exactly. A triple is called primitive when its three numbers share no common factor bigger than 1 — every other triple is just a whole-number multiple of a primitive one (6-8- 10 is 2 × 3-4-5, 9-12-15 is 3 × 3-4-5, and so on).
| a | b | c | Notes |
|---|---|---|---|
| 3 | 4 | 5 | Smallest primitive triple |
| 5 | 12 | 13 | Primitive |
| 6 | 8 | 10 | 2 × (3, 4, 5) |
| 7 | 24 | 25 | Primitive |
| 8 | 15 | 17 | Primitive |
| 9 | 12 | 15 | 3 × (3, 4, 5) |
| 9 | 40 | 41 | Primitive |
| 11 | 60 | 61 | Primitive |
| 12 | 35 | 37 | Primitive |
| 13 | 84 | 85 | Primitive |
| 20 | 21 | 29 | Primitive — nearly isosceles |
| 20 | 48 | 52 | 4 × (5, 12, 13) |
| 28 | 45 | 53 | Primitive |
| 33 | 56 | 65 | Primitive |
| 36 | 77 | 85 | Primitive |
| 39 | 80 | 89 | Primitive |
| 48 | 55 | 73 | Primitive |
| 65 | 72 | 97 | Primitive |
Beyond right triangles: the Law of Cosines
The Pythagorean theorem only holds for right triangles. For any other triangle, replace the 90° with the actual angle C opposite side c:
When C = 90°, cos(C) = 0 and the extra term vanishes — you're back to a² + b² = c². When C is smaller than 90° the extra term is subtracted, making c shorter; when C is larger than 90° cos(C) is negative and the term adds, making c longer. Use our Triangle Calculator when you need the full Law-of-Cosines solver.
Where you'll actually use it
- Construction & DIY — checking that a corner is truly square by measuring 3-4-5 (or any multiple) along the two walls.
- Screens & displays — converting a stated diagonal into width and height for a given aspect ratio, or the other way around.
- Navigation & GIS — the 2D distance formula d = √((Δx)² + (Δy)²) is the Pythagorean theorem applied to coordinate differences.
- Physics — combining perpendicular vector components (velocity, force) into a resultant magnitude.
- Games & graphics — computing the straight-line distance between two on-screen points to trigger collisions or aim projectiles.
Common mistakes
- Mixing up which side is the hypotenuse. It's always opposite the 90° angle and always the longest side — if the c you entered isn't the biggest of the three, the calculator warns you.
- Forgetting to square-root at the end. a² + b² gives you c², not c — remember the √.
- Mixing units. If a is in centimeters and b is in inches, convert first; the theorem doesn't do unit conversion for you.
- Applying the theorem to a non-right triangle. Use the Law of Cosines instead — see the Triangle Calculator.
Frequently asked questions
+What is the Pythagorean theorem?
The Pythagorean theorem states that in any right triangle, the square built on the hypotenuse (the side opposite the right angle) has the same area as the two squares built on the other two sides added together. Written as an equation it is a² + b² = c², where a and b are the two legs and c is the hypotenuse.
+What's the formula for finding the hypotenuse?
Rearrange a² + b² = c² for c to get c = √(a² + b²). Square each leg, add the two results, then take the square root. For example, with legs 3 and 4 the hypotenuse is √(9 + 16) = √25 = 5.
+Can I use this calculator for a non-right triangle?
No. The Pythagorean theorem only holds when one angle is exactly 90°. For any other triangle use the Law of Cosines, c² = a² + b² − 2ab·cos(C), which reduces to the Pythagorean theorem when C = 90° because cos(90°) = 0.
+What is a Pythagorean triple?
A Pythagorean triple is a set of three positive whole numbers a, b, c that satisfy a² + b² = c² exactly. The smallest is (3, 4, 5); other common primitives include (5, 12, 13), (8, 15, 17) and (7, 24, 25). Any whole-number multiple of a primitive triple — such as (6, 8, 10) = 2 × (3, 4, 5) — is also a triple.
+How do I find the space diagonal of a box in 3D?
Extend the theorem to three dimensions: d = √(l² + w² + h²), where l, w and h are the length, width and height of the box. For example, a 3 × 4 × 12 box has a space diagonal of √(9 + 16 + 144) = √169 = 13.
+Does the order of the legs matter?
No. Because a² + b² is symmetric in a and b, swapping the two legs gives the same hypotenuse. In the reverse-checker the calculator automatically sorts the three sides so the largest one is treated as c before it tests a² + b² = c².
+What units can I mix in the inputs?
You can't mix units in a single calculation — all three sides must be in the same unit. The unit picker converts everything to a common base internally, so you can enter values in mm, cm, m, km, in, ft or yd and the result comes back in whichever unit you select for the output.