Skip to content

Pythagoras Theorem Calculator

c =

5

a² + b² = c² → 9 + 16 = 25
Step-by-step
  1. Solving for the hypotenuse c: c = √(a² + b²)
  2. a² = 9 b² = 16
  3. a² + b² = 25
  4. c = √25 = 5

Estimates for educational purposes — not financial, medical, or legal advice. See terms.

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:

  1. a² = 9, b² = 16
  2. a² + b² = 25
  3. c = √25 = 5

Check: 3² + 4² = 9 + 16 = 25 = 5². ✓

Now run it backwards: solve for a given b = 4 and c = 5:

  1. c² = 25, b² = 16
  2. c² − b² = 9
  3. 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:

  1. a² = 1, b² = 1
  2. a² + b² = 2
  3. 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:

  1. a² = 25, b² = 144
  2. sum = 169
  3. 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.

Frequently asked questions

What is the Pythagorean theorem?

For any right triangle, the square of the hypotenuse equals the sum of the squares of the two legs: a² + b² = c². The hypotenuse (c) is the side opposite the right angle — it's always the longest side. The two legs (a and b) are the other two sides, the ones that form the right angle between them. Given any two sides of a right triangle, the theorem lets you compute the third.

Which side is the hypotenuse?

The one opposite the right angle — or equivalently, the longest side. In a right triangle, the right angle is between the two legs, and the hypotenuse is the side facing away from it. It's always longer than either leg because the theorem says c² = a² + b², which means c > a and c > b whenever a and b are positive. The tool uses 'c' for the hypotenuse by convention; a and b are the legs.

Why do I get an error when I enter c smaller than a leg?

Because that's not a valid right triangle. The hypotenuse must be the longest side — c² = a² + b² means c is always bigger than both a and b. If you try to solve for the missing leg with c = 3 and the other leg = 5, the formula a² = c² − b² gives a² = 9 − 25 = −16, which has no real-number square root. The tool catches this and throws a domain error rather than returning NaN silently.

Do I always need a right triangle?

Yes, a² + b² = c² only holds for right triangles. For general triangles, you need the law of cosines (c² = a² + b² − 2ab·cos(C)), which reduces to the Pythagorean theorem when the angle C is 90° (cos 90° = 0). If your triangle doesn't have a right angle, this tool won't give you correct answers — use a law-of-cosines calculator instead.

What are some famous Pythagorean triples?

A Pythagorean triple is a set of three positive integers (a, b, c) that satisfy a² + b² = c². The most famous is 3-4-5, which is the smallest. Others include 5-12-13, 8-15-17, 7-24-25, 20-21-29, and 9-40-41. Any multiple of a triple is also a triple — 6-8-10, 9-12-15, and so on are all scaled 3-4-5 triangles. These pop up in construction (squaring corners), geometry problems, and computer graphics where integer-coordinate right angles are useful.