Skip to calculator
Libre CalculatorThe universe in numbers

Pythagorean theorem calculator

Find the missing side of a right triangle from the other two.

Calculation

Answer

5 m

Steps

c = √(3² + 4²) = 5 m

The highlighted side is the hypotenuse c
Legs of 3 m and 4 m meet at a right angle; the hypotenuse is 5 m.

Watch the explainer

215 seconds · 8 chapters · captions included

0:00 / 3:35Why squares?

Explanation

The Pythagorean theorem

In a right triangle, the square of the hypotenuse equals the sum of the squares of the two perpendicular legs. Choose exactly which kind of side is missing; all entered lengths are metres and the answer is also in metres.

c² = a² + b²; c = √(a² + b²)

Variables
aleg a, in metres (metres (m))
bleg b, in metres (metres (m))
chypotenuse c, in metres, opposite the right angle (metres (m))

a² + b² = c²; b = √(c² − a²), with c > a

Variables
aleg a, in metres (metres (m))
bleg b, in metres (metres (m))
chypotenuse c, in metres, opposite the right angle (metres (m))

The 3–4–5 right triangle

Leg a3
Leg b4
Result5 m

c = √(3² + 4²) = 5 m

Given hypotenuse 5 m and leg 3 m

Hypotenuse c5
Known leg a3
Result4 m

b = √(5² − 3²) = 4 m

A scaled 5–12–13 triangle

Leg a5
Leg b12
Result13 m

c = √(5² + 12²) = 13 m

A right triangle with 1.5 m and 2 m legs

Leg a1.5
Leg b2
Result2.5 m

c = √(1.5² + 2²) = 2.5 m

Diagram of this result

The right triangle is drawn in the proportions of its sides. Legs a and b meet at the right angle; the side you solved for is drawn in the accent colour.

The diagram represents a right triangle: a and b are perpendicular legs, c is the hypotenuse opposite the right angle. The solved side is labeled from the same calculation result.

Common mistakes

The hypotenuse is always opposite the right angle and is strictly longer than either leg. Do not apply the formula to a non-right triangle. When solving for a leg, subtract the known leg's square from the hypotenuse's square; reversing the subtraction makes the radicand negative. Do not compare side lengths by rounding first: the feasibility check is exact on the canonical decimal inputs.

Assumptions and precision

Exactly one side is missing. Given sides must be positive finite canonical decimals, up to 30 significant digits and adjusted exponent magnitude 100. For a missing leg, the input hypotenuse must be strictly greater than the known leg; equality is degenerate and rejected without a tolerance. Decimal arithmetic and square roots use 50 significant digits, with no intermediate presentation rounding. Root results are approximate; fixtures use 1e-12 relative plus 1e-12 absolute tolerance. Inputs and output are explicitly metres.

How do I identify the hypotenuse?

It is the side opposite the right-angle corner and is the longest side in a nondegenerate right triangle. The two sides that form the right angle are the legs.

Why is an equal hypotenuse and leg rejected?

If c equals a, then b² = c² − a² = 0, so the remaining leg has zero length and the triangle is degenerate, not a valid triangle with positive sides.

References

For right-triangle geometry and the Pythagorean theorem, see OpenStax Prealgebra 2e, geometry topics: https://openstax.org/details/books/prealgebra-2e. The theorem and worked examples are checked against the identity a² + b² = c² using independent arithmetic fixtures.