Pythagorean Theorem Calculator

Pythagorean theorem

Enter any two sides of a right triangle and the calculator returns the third with a² + b² = c². It works both ways: find the hypotenuse from the two legs, or find a missing leg when you know the hypotenuse and the other leg. It also returns the interior angles in degrees and radians, useful for construction layouts, screen geometry and trigonometry homework.

How the calculation works

  1. 1

    Choose the unknown side

    Select hypotenuse (c) from legs a and b, or select a missing leg from the hypotenuse and the other leg.

  2. 2

    Enter the two known lengths

    Use any positive real numbers. Keep both measurements in the same unit, such as cm, m, in or ft.

  3. 3

    Apply the theorem

    For the hypotenuse use c = √(a² + b²). For a leg use a = √(c² - b²) or b = √(c² - a²).

  4. 4

    Read the result

    You get the missing side and the angle opposite each side. The 90° angle is always between the two legs.

Common Pythagorean triples

Integer side lengths that satisfy a² + b² = c²:

a b c
3 4 5
5 12 13
8 15 17
7 24 25
20 21 29
9 40 41

Multiples of any triple are also triples: 6-8-10, 9-12-15, and so on. Builders use the 3-4-5 method in any unit, from centimetres to feet, to check a square corner. If one leg is 3 units, the other is 4 units and the diagonal is exactly 5 units, the corner is 90°.

When the theorem applies

  • Right triangles only. If none of the angles is 90°, use the law of cosines: c² = a² + b² - 2ab·cos C.
  • Flat Euclidean space. The theorem holds on a plane. On a sphere, such as the Earth over long distances, it does not.
  • Straight-line distance. You are measuring one straight segment, not a path that bends along two sides.

Practical uses

  • Carpentry and site layout. Use 3-4-5 or 30-40-50 cm to square walls, tiles and garden beds.
  • Screen and monitor diagonals. For a 16:9 display, the diagonal follows d = √(w² + h²); with the diagonal known, you can solve back for width and height.
  • Ladder checks. A 5 m ladder with the base 1.25 m from the wall reaches √(5² - 1.25²) ≈ 4.84 m up the wall.
  • GIS at short distances. A flat approximation can be fine over a few kilometres. Over hundreds of kilometres, use a geodesic formula such as haversine or Vincenty.

Extending to 3D

For a rectangular box with side lengths a, b and c, the space diagonal is √(a² + b² + c²). The formula follows from applying Pythagoras twice: first to the base diagonal, then to that diagonal and the vertical side.

Frequently Asked Questions

Only for right triangles, meaning triangles with one 90° angle. For other triangles use the law of cosines, which generalizes Pythagoras for any included angle.

It is the smallest Pythagorean triple with integer sides. Builders use it because the marks are easy to set out with a tape measure and scale cleanly to 30-40-50, 6-8-10 and larger layouts.

Yes. The theorem works with any positive real numbers, not just integers. Real measurements often produce decimal results.

Negative side lengths do not have physical meaning. The calculator rejects them; if you typed a minus sign by mistake, remove it.

Not reliably. Earth is curved, so a flat Pythagoras calculation over hundreds of kilometres can be off by several percent. Use haversine or Vincenty for geodesic distance.

Related Tools