Skip to content

Pythagorean Theorem Calculator

Solve for the hypotenuse or leg using the Pythagorean theorem a²+b²=c².

By CalcGenius Editorial TeamLast reviewed August 28, 20253 min read
Pythagorean Theorem Calculator
📊
Enter your values and click Calculate

About

The Pythagorean theorem is one of the oldest and most famous results in mathematics. It states that in any right triangle, the square of the hypotenuse (the side opposite the right angle) equals the sum of the squares of the other two sides (the legs): a² + b² = c², where c is the hypotenuse. The theorem is named after the Greek mathematician Pythagoras (c. 570–495 BCE), though the result was known earlier in Babylonia, India, and China.

Given any two sides of a right triangle, the third follows directly from the theorem. To find the hypotenuse: c = √(a² + b²). To find a leg: a = √(c² − b²) or b = √(c² − a²). The hypotenuse is always the longest side (opposite the right angle), so c² > a² and c² > b² — the expressions under the square roots are always positive for a valid right triangle. If c² < a² or c² < b², the inputs are inconsistent and no real right triangle exists.

A Pythagorean triple is a set of three positive integers satisfying a² + b² = c². The simplest is (3, 4, 5): 9 + 16 = 25. Other common triples include (5, 12, 13), (8, 15, 17), (7, 24, 25), and (20, 21, 29). Multiplying any triple by a positive integer produces another triple — (6, 8, 10) is 2 × (3, 4, 5). Euclid's formula generates all primitive triples (those with gcd = 1): (m² − n², 2mn, m² + n²) for integers m > n > 0 with gcd(m, n) = 1 and m − n odd.

The converse of the Pythagorean theorem is also true: if a triangle has sides a, b, c (with c the longest) and a² + b² = c², then the triangle is right-angled with the right angle opposite c. This generalizes to a triangle classification test: if a² + b² > c², all angles are acute (less than 90°); if a² + b² < c², the angle opposite c is obtuse (greater than 90°). The calculator applies this test automatically and reports the triangle type.

The Pythagorean theorem is the foundation of distance measurement. The Euclidean distance formula √((x₂−x₁)² + (y₂−y₁)²) is just the Pythagorean theorem applied to coordinate differences, and the 3D distance formula √((Δx)² + (Δy)² + (Δz)²) extends it to three dimensions. Builders use the 3-4-5 method to lay out perfect right angles in construction; navigators use the theorem for shortest-path computations; computer graphics use it for collision detection; and special relativity generalizes it to the spacetime interval. Use this calculator to solve any right triangle from two known sides, and use the related law-of-cosines calculator for non-right triangles.

How to Use

  1. 1
    Pick which side to solve for
    Use the Select dropdown to choose whether you want to find the hypotenuse c, leg a, or leg b. The input fields adapt automatically — the calculator asks for the two known sides.
  2. 2
    Enter the two known sides
    Type the lengths of the two known sides. For finding c, enter a and b (the legs); for finding a, enter b and c (with c &gt; b); for finding b, enter a and c (with c &gt; a). The calculator checks the triangle inequality.
  3. 3
    Read the result on the hero
    The hero shows the length of the unknown side, computed via the Pythagorean formula. The breakdown shows the equation used, the substituted values, and the simplified square root.
  4. 4
    Verify the triangle type
    The breakdown classifies the triangle as right (if it satisfies a² + b² = c² exactly), acute, or obtuse — based on comparing a² + b² to c² for the given sides.
  5. 5
    Inspect the worked example
    Open the Worked Example section to see the Pythagorean formula substituted with your specific values and the arithmetic carried out step by step, including the square root simplification.

Formula

Pythagorean theorem (right triangles only):

a² + b² = c² (c = hypotenuse, a and b = legs)

Solving for each side:

c = √(a² + b²) (find hypotenuse from legs)
a = √(c² − b²) (find leg from other leg and hypotenuse)
b = √(c² − a²) (find leg from other leg and hypotenuse)

Converse (triangle classification):

  • a² + b² = c² → right triangle
  • a² + b² > c² → acute triangle
  • a² + b² < c² → obtuse triangle

Euclid's formula for primitive triples:

(m² − n², 2mn, m² + n²) with m > n > 0, gcd(m,n) = 1, m−n odd

Worked Example

Find the hypotenuse of a right triangle with legs a = 3, b = 4:

  • c² = a² + b² = 3² + 4² = 9 + 16 = 25
  • c = √25 = 5
  • Triangle: (3, 4, 5) — the classic Pythagorean triple

Find leg a given b = 4 and c = 5:

  • a² = c² − b² = 25 − 16 = 9
  • a = √9 = 3
  • Triangle: (3, 4, 5) ✓

Use the converse to classify (5, 12, 13):

  • a² + b² = 25 + 144 = 169
  • c² = 169
  • a² + b² = c² → right triangle ✓

Generate a primitive triple with m = 3, n = 2:

  • a = m² − n² = 9 − 4 = 5
  • b = 2mn = 2·3·2 = 12
  • c = m² + n² = 9 + 4 = 13
  • Triple: (5, 12, 13) ✓

Tips

  • The hypotenuse is always the longest side — opposite the right angle. If your computed c is not the largest of the three sides, you have mislabeled the inputs.
  • Use the converse to classify any triangle: compute a² + b² and compare to c². Equal → right; greater → acute; less → obtuse.
  • The 3-4-5 triple is the carpenter&apos;s classic for laying out right angles. Stretch a string 3 units along one wall, 4 along the perpendicular, and adjust until the diagonal is exactly 5.
  • Pythagorean triples generated by Euclid&apos;s formula: (m² − n², 2mn, m² + n²) for m &gt; n &gt; 0 with gcd(m, n) = 1 and m − n odd. Try m = 2, n = 1 to get (3, 4, 5).
  • The distance formula √((x₂−x₁)² + (y₂−y₁)²) is just the Pythagorean theorem applied to the coordinate differences. Use the related distance-formula calculator for coordinate-based problems.

Common Mistakes

Common pitfalls
  • Applying the theorem to non-right triangles — the law of cosines is required for general triangles.
  • Forgetting to square the sides before adding — a + b ≠ c for any non-trivial right triangle.
  • Mixing up which side is the hypotenuse — it is always opposite the right angle and is always the longest.
  • Forgetting to take the square root at the end — the theorem gives c², not c.
  • Computing c² < a² or c² < b² (impossible in a right triangle) — indicates input error or mislabeled sides.

Frequently Asked Questions

What is the Pythagorean theorem?
The Pythagorean theorem states that in any right triangle, the square of the hypotenuse (the side opposite the right angle) equals the sum of the squares of the other two sides (the legs). Written algebraically: a² + b² = c², where c is the hypotenuse and a, b are the legs. The theorem is named after the ancient Greek mathematician Pythagoras (c. 570–495 BCE), though the result was known earlier in Babylonia, India, and China.
How do you use the Pythagorean theorem to find a side?
Given any two sides of a right triangle, solve for the third: (1) to find the hypotenuse c, use c = √(a² + b²); (2) to find a leg a, use a = √(c² − b²); (3) to find leg b, use b = √(c² − a²). The hypotenuse is always the longest side (opposite the right angle), so c² &gt; a² and c² &gt; b² — the expressions under the square roots are always positive for a valid right triangle.
What are some Pythagorean triples?
A Pythagorean triple is a set of three positive integers (a, b, c) satisfying a² + b² = c². The simplest is (3, 4, 5): 9 + 16 = 25. Other common triples include (5, 12, 13), (8, 15, 17), (7, 24, 25), and (20, 21, 29). Multiplying any triple by a constant produces another triple (e.g., (6, 8, 10) = 2 × (3, 4, 5)). Euclid&apos;s formula generates all primitive triples: (m² − n², 2mn, m² + n²) for integers m &gt; n &gt; 0 with gcd(m, n) = 1 and m − n odd.
Does the Pythagorean theorem work for non-right triangles?
No — the Pythagorean theorem applies only to right triangles. For non-right triangles, the generalization is the law of cosines: c² = a² + b² − 2ab·cos(C), where C is the angle opposite side c. When C = 90°, cos(90°) = 0, and the law of cosines reduces to the Pythagorean theorem. Use the related law-of-cosines calculator for non-right triangles.
What is the converse of the Pythagorean theorem?
The converse states: if a triangle has sides a, b, c (with c the longest) and a² + b² = c², then the triangle is a right triangle with the right angle opposite side c. This is a powerful test: given three side lengths, compute a² + b² and compare to c². If they are equal, the triangle is right-angled; if a² + b² &gt; c², it is acute (all angles &lt; 90°); if a² + b² &lt; c², it is obtuse (one angle &gt; 90°).
What are real-world applications of the Pythagorean theorem?
The theorem is the foundation of distance measurement in two and three dimensions. The distance formula √((x₂−x₁)² + (y₂−y₁)²) is just the Pythagorean theorem applied to coordinate differences. Builders use it to lay out right angles (the 3-4-5 method), navigators use it for shortest-path computations, computer graphics use it for collision detection and rendering, and special relativity generalizes it to the spacetime interval.

Right triangles only

The Pythagorean theorem applies only to right triangles — triangles with one 90° angle. The side opposite the right angle is the hypotenuse (always the longest side); the other two sides are the legs. The theorem relates the three side lengths: a² + b² = c², where c is the hypotenuse. For non-right triangles, use the law of cosines instead.

Solving for any side

Given any two sides of a right triangle, the third follows from the Pythagorean theorem. To find the hypotenuse: c = √(a² + b²). To find a leg: a = √(c² − b²) or b = √(c² − a²). The hypotenuse is always the longest side, so c² > a² and c² > b² — the expressions under the square roots are always positive for a valid right triangle.

Pythagorean triples

A Pythagorean triple is a set of three positive integers satisfying a² + b² = c². The simplest is (3, 4, 5): 9 + 16 = 25. Other common triples include (5, 12, 13), (8, 15, 17), and (7, 24, 25). Multiplying any triple by a constant produces another triple — (6, 8, 10) = 2 × (3, 4, 5). Carpenters use the 3-4-5 method to lay out perfect right angles in construction.

Converse and triangle type

The converse of the Pythagorean theorem: if a² + b² = c² holds for sides a, b, c with c the longest, then the triangle is right-angled. This generalizes to a triangle-type test: if a² + b² > c², the triangle is acute (all angles < 90°); if a² + b² < c², it is obtuse (one angle > 90°). Useful for classifying triangles from side lengths alone.

Pythagorean theorem applied to common right triangles — verify the calculator against these hand-checked examples.
Inputs (a, b, c)TaskEquationResultTripleNotes
3, 4, → cFind hypotenusec² = 9 + 16 = 255.000000(3, 4, 5)Primitive triple
5, 12, → cFind hypotenusec² = 25 + 144 = 16913.000000(5, 12, 13)Primitive triple
8, 15, → cFind hypotenusec² = 64 + 225 = 28917.000000(8, 15, 17)Primitive triple
6, 8, → cFind hypotenusec² = 36 + 64 = 10010.000000(6, 8, 10)2 × (3, 4, 5)
→ a, 4, 5Find leg aa² = 25 − 16 = 93.000000(3, 4, 5)Reverse: solve for leg
7, → b, 25Find leg bb² = 625 − 49 = 57624.000000(7, 24, 25)Reverse: solve for leg
The Pythagorean theorem underlies all distance
The Euclidean distance formula √((x₂−x₁)² + (y₂−y₁)²) is just the Pythagorean theorem applied to coordinate differences. The 3D distance formula √((Δx)² + (Δy)² + (Δz)²) extends it to three dimensions. Every distance computation in physics, engineering, and computer graphics ultimately reduces to the Pythagorean theorem.
Use the converse to classify any triangle
Given three side lengths a, b, c (with c the longest), compute a² + b² and compare to c². If equal, the triangle is right-angled. If a² + b² > c², the triangle is acute (all angles < 90°). If a² + b² < c², the triangle is obtuse (one angle > 90°). This single test classifies any triangle from its side lengths alone.
Right triangles only
The Pythagorean theorem applies only to right triangles — those with one 90° angle. For non-right triangles, the generalization is the law of cosines: c² = a² + b² − 2ab·cos(C), where C is the angle opposite side c. When C = 90°, cos(90°) = 0 and the law reduces to a² + b² = c². Use the related law-of-cosines calculator for non-right triangles.

Authoritative References

  • Wikipedia — Pythagorean theorem— wikipedia.org
    Wikipedia&apos;s article on the Pythagorean theorem covers the statement, proofs (algebraic, geometric, and via similar triangles), Pythagorean triples, and the converse.
  • Wolfram MathWorld — Pythagorean Theorem— wolfram.com
    MathWorld&apos;s encyclopedic reference covers the theorem, its many proofs, Pythagorean triples, and generalizations to non-Euclidean geometries.
  • Khan Academy — Pythagorean theorem— khanacademy.org
    Khan Academy&apos;s free geometry unit covers the Pythagorean theorem, its converse, and applications with worked examples and practice problems.
  • Cut-the-Knot — Pythagorean theorem proofs— cut-the-knot.org
    Cut-the-Knot&apos;s interactive site presents over 100 distinct proofs of the Pythagorean theorem, including Euclid&apos;s windmill and the Bhaskara proof.

Try our other free calculators

CalcGenius has 1,200+ free, ad-free, browser-based calculators for finance, health, math, science, and everyday life. No sign-up required.

Pythagorean Theorem Verified Answer & Steps — Instant Math S