Math
Pythagorean theorem calculator
The oldest useful equation in geometry, and still the fastest way to check whether a corner is square.
The theorem
In any right-angled triangle, the square on the hypotenuse equals the sum of the squares on the other two sides:
a² + b² = c²
c is always the hypotenuse — the side opposite the right angle, and always the longest. Getting that wrong is the single most common error, and it shows up as a hypotenuse shorter than one of the legs, which is geometrically impossible. The calculator rejects that case rather than returning a nonsense root.
Rearranging for a leg
To find a missing leg rather than the hypotenuse, subtract instead of add: a = √(c² − b²). The subtraction is what makes the ordering matter — if you accidentally subtract the larger square from the smaller you get a negative under the root and no real answer.
Pythagorean triples
Some right triangles have three whole-number sides. The small ones are worth memorising because they appear constantly in exams and on building sites:
- 3, 4, 5 — and every multiple: 6-8-10, 9-12-15, 30-40-50
- 5, 12, 13
- 8, 15, 17
- 7, 24, 25
The 3-4-5 triple is the basis of the builder's method for checking a square corner: measure 3 units along one wall, 4 along the other, and if the diagonal between those marks is exactly 5, the corner is exactly 90°. Carpenters usually work in feet and use 6-8-10 for better accuracy over a longer run.
Where it gets used
Straight-line distance between two points is Pythagoras in disguise: the distance formula √((x₂−x₁)² + (y₂−y₁)²) is just the theorem applied to the horizontal and vertical gaps. The same idea extends to three dimensions by adding a third squared term, which is how you find the diagonal of a box.
Practical uses are everywhere: the length of a roof rafter from rise and run, whether a sofa fits diagonally through a doorway, ladder safety angles, screen sizes quoted as a diagonal, and the shortest path across a field rather than round two edges.
Only for right triangles
The theorem holds only when one angle is exactly 90°. For any other triangle you need the law of cosines, c² = a² + b² − 2ab·cos(C), which reduces to Pythagoras when C = 90° because cos(90°) = 0.
The converse is also true and genuinely useful: if a² + b² = c² holds for three lengths, the triangle they form must be right-angled. That is what makes the 3-4-5 check valid rather than merely suggestive.
Common questions
Which side is the hypotenuse?
The one opposite the right angle, which is always the longest side. If your "hypotenuse" is shorter than one of the legs, you have mislabelled the triangle.
How do I find a leg instead of the hypotenuse?
Rearrange to a = square root of (c squared minus b squared). Subtract rather than add, and make sure you subtract the leg from the hypotenuse, not the other way round.
What is a Pythagorean triple?
A right triangle whose three sides are all whole numbers, such as 3-4-5 or 5-12-13. Every multiple of a triple is also a triple, which is why 6-8-10 and 9-12-15 work too.
Does the theorem work on non-right triangles?
No. For other triangles use the law of cosines: c squared equals a squared plus b squared minus 2ab cos C. When C is 90 degrees its cosine is zero and the formula collapses back to Pythagoras.