Given any two sides of a right triangle, compute the third using the Pythagorean theorem a² + b² = c². Pick which side you’re solving for (hypotenuse or either leg), enter the other two, and the tool returns the answer with a step-by-step derivation.
The theorem
For a right triangle with legs of length a and b and hypotenuse of length c:
a² + b² = c²
The hypotenuse is the side opposite the right angle (and always the longest side). The two legs are the sides that meet at the right angle. The theorem says that squaring and adding the legs gives you the square of the hypotenuse — a fundamental relationship that holds for every right triangle regardless of size or orientation.
Three solver directions
Hypotenuse from legs (a, b → c): c = √(a² + b²). This is the most common direction — you know the two legs and want to find the longest side. No constraints; any positive a and b give a valid c.
Leg from the other leg and the hypotenuse (b, c → a or a, c → b): a = √(c² − b²) or b = √(c² − a²). This is the inverse direction. It only works when the hypotenuse is strictly greater than the known leg, because c² − b² must be positive for the square root to be real. If you enter c ≤ b, the tool throws a domain error instead of returning NaN.
Example: 3-4-5 triangle
The classic Pythagorean triple. Solve for c given a = 3 and b = 4:
- a² = 9, b² = 16
- a² + b² = 25
- c = √25 = 5
Check: 3² + 4² = 9 + 16 = 25 = 5². ✓
Now run it backwards: solve for a given b = 4 and c = 5:
- c² = 25, b² = 16
- c² − b² = 9
- a = √9 = 3
The round trip matches, as it should. Every Pythagorean triple works both directions in this way.
Example: isosceles right triangle
Legs both equal to 1. Solve for c:
- a² = 1, b² = 1
- a² + b² = 2
- c = √2 ≈ 1.4142
The ratio 1 : 1 : √2 is the signature of an isosceles right triangle — the half-square. Any unit square’s diagonal is √2 units long, and scaling up scales the diagonal proportionally: a square with side 10 has diagonal 10√2 ≈ 14.14.
Example: 5-12-13 triangle
Another famous integer triple. Solve for c with a = 5 and b = 12:
- a² = 25, b² = 144
- sum = 169
- c = √169 = 13
Other well-known integer right triangles: 6-8-10, 7-24-25, 8-15-17, 9-40-41, 20-21-29. Any multiple of a Pythagorean triple is also a Pythagorean triple, so 30-40-50 is just a scaled 3-4-5.
Where this comes from
The Pythagorean theorem is named after the Greek mathematician Pythagoras of Samos (6th century BCE), though the relationship was known to Babylonian and Indian mathematicians long before him. The theorem is proven many different ways — Euclid’s original proof used similar triangles, Einstein’s boyhood proof used dissection, and there are hundreds of known visual / geometric proofs. A common one places four identical right triangles around a tilted square inside a larger square, and algebraic simplification of the total area gives a² + b² = c² directly.
Generalising the theorem: for non-right triangles, the law of cosines says c² = a² + b² − 2ab·cos(C), where C is the angle opposite c. When C = 90°, cos C = 0 and the extra term vanishes, giving you back a² + b² = c². So the Pythagorean theorem is a special case of a more general triangle identity.
What this tool does not do
It doesn’t solve non-right triangles. For general triangle side and angle problems, use a law-of-cosines or law-of-sines calculator. The Pythagorean theorem only applies when one angle is exactly 90°.
It doesn’t compute angles. Given all three sides you can compute the angles via inverse trig (asin, acos, atan), but the tool only returns the missing side. For angles, you need a dedicated right-triangle calculator.
It doesn’t handle n-dimensional generalisations. The 3D version (the distance formula) lives in a separate tool — see the distance between two points calculator for the 2D and 3D case. In n dimensions, the formula generalises to c = √(a₁² + a₂² + … + aₙ²), but this tool only handles the 2-leg (2D right triangle) case.
It doesn’t detect Pythagorean triples. If you enter three integer sides, the tool doesn’t tell you that 5-12-13 is a triple — it just uses them as inputs. For integer-triple generation, you need a dedicated tool.
It doesn’t visualise the triangle. There’s no SVG of the triangle drawn to scale, just the numeric answer and step-by-step working.