Geometry
Pythagorean theorem calculator
Choose whether the hypotenuse or a leg is missing, enter the two sides you know, and get the third along with perimeter, area, angles and the quantities from Euclid's theorems.
When the Pythagorean theorem is needed
In a right triangle the square built on the hypotenuse equals the sum of the squares built on the legs: a² + b² = c². From this equality any side can be recovered from the other two — the hypotenuse as √(a² + b²), a leg as √(c² − a²) — which is why the theorem appears wherever a horizontal and a vertical measurement have to become a diagonal distance.
The theorem holds only in a right triangle, and that constraint decides whether the calculation means anything. The hypotenuse is by definition the side opposite the right angle, so it is always the longest: if the value entered as the hypotenuse is smaller than a leg, no such triangle exists. For general triangles you need the law of cosines or Heron's formula.
Below the result you also get the altitude to the hypotenuse and the projections of the two legs onto it: these are the quantities of Euclid's two theorems, which almost always follow Pythagoras in the exercise. The altitude is the geometric mean of the two projections, and each leg is the geometric mean of the hypotenuse and its own projection.
Common mistakes
- Adding instead of subtracting when looking for a leg: for the hypotenuse you add the squares, for a leg you subtract them. Going the wrong way gives a leg longer than the hypotenuse, which is the tell-tale sign.
- Forgetting the final square root: a² + b² gives the square of the hypotenuse, not the hypotenuse. With 3 and 4 you get 25 instead of 5.
- Applying the theorem to a triangle that is not right-angled: without the right angle the relation does not hold and the answer means nothing. Always check where the right angle is before calling a side the hypotenuse.
Frequently asked questions
How do you calculate the hypotenuse with the Pythagorean theorem?
Add the squares of the two legs and take the square root: c = √(a² + b²). With legs 3 and 4 you get √(9 + 16) = √25 = 5.
How do you find a leg given the hypotenuse and the other leg?
Subtract the square of the known leg from the square of the hypotenuse and take the root: a = √(c² − b²). With hypotenuse 13 and leg 5 you get √(169 − 25) = √144 = 12.
What is a Pythagorean triple?
Three whole numbers satisfying a² + b² = c², such as 3-4-5, 5-12-13 or 8-15-17. Every multiple of a triple is still a triple: 6-8-10 is twice 3-4-5. The calculator flags it when the triangle you entered is one.
Does the Pythagorean theorem work for all triangles?
No, only right-angled ones. For a general triangle the relation becomes the law of cosines, c² = a² + b² − 2ab·cos(γ), which reduces to Pythagoras when γ is a right angle and the cosine vanishes.
How this calculation works
Pythagorean theorem: a² + b² = c², with c the hypotenuse. Hypotenuse: c = √(a² + b²). Leg: b = √(c² − a²), defined only when c > a. Area: A = (a·b)/2. Perimeter: p = a + b + c. Acute angles: α = arcsin(a/c), β = arcsin(b/c), with α + β = 90°. Euclid's first theorem: a² = c × (projection of a), so the projection of a is a²/c. Euclid's second theorem: the altitude to the hypotenuse is h = (a·b)/c, the geometric mean of the two projections.
Related calculators
Triangle solver
Solve any triangle from three measurements, ambiguous case included.
Perimeter and area
Perimeter, area and derived measurements for nine plane figures, from the square to the ellipse.
Trigonometric formulas
Primary ratios, half-angle, double-angle, addition, prosthaphaeresis and Werner formulas on one or two angles.