Pythagorean Theorem Calculator

Find the hypotenuse or a leg of a right triangle, check whether a triangle with given sides is right-angled, work out the diagonal of a box and the distance between points, or look up Pythagorean triples. The answer is written exactly and every result comes with a step-by-step solution and a diagram.

Enter data

Education
What to find
The legs are the sides at the right angle, the hypotenuse is the longest side opposite it. Numbers, decimals (2.5) or fractions (5/2).

Settings

Unit
Decimal places

Result

CalcCore
Enter your data — the result will appear here.

What the Pythagorean theorem calculator does

The calculator solves five typical tasks: it finds the hypotenuse or a leg from two known sides, checks by the converse theorem whether a triangle with given sides is right-angled, works out the diagonal of a rectangular box, the distance between two points in the plane and in space, and looks up Pythagorean triples. The answer is written exactly, with radicals such as 5√2, and a decimal approximation is shown beside it. Every result also includes the perimeter, area, angles and a diagram.

The Pythagorean theorem formula

In a right triangle the square of the hypotenuse equals the sum of the squares of the legs: a² + b² = c². Here a and b are the legs (the sides at the right angle) and c is the hypotenuse (the longest side, opposite the right angle). The theorem holds only for right triangles.

How to find the hypotenuse

If both legs are known, the hypotenuse is c = √(a² + b²). For legs 3 and 4 we get c = √(9 + 16) = √25 = 5. For legs 1 and 1 we get c = √2 ≈ 1.4142: the calculator shows both the exact form and the approximation. The same formula gives the diagonal of a rectangle with sides a and b.

How to find a leg

If the hypotenuse and one leg are known, the other is a = √(c² − b²) (or b = √(c² − a²)). For c = 13 and a = 5 we get b = √(169 − 25) = √144 = 12. The hypotenuse is always longer than either leg, so for c ≤ b or c ≤ a there is no solution, and the calculator says so.

Is a triangle right-angled: the converse theorem

If in a triangle the square of the largest side equals the sum of the squares of the other two, the triangle is right-angled. For sides 7, 24, 25: 49 + 576 = 625 = 25², so the triangle is right-angled. If the sum of the squares is greater, the triangle is acute (for 4, 5, 6: 16 + 25 = 41 > 36); if it is smaller, the triangle is obtuse (for 2, 3, 4: 4 + 9 = 13 < 16). The calculator compares exactly, so it makes no mistakes even with decimal sides, and it also checks the triangle inequality and shows the largest angle.

Pythagorean triples

A Pythagorean triple is three whole numbers a, b, c with a² + b² = c². The best known are (3, 4, 5), (5, 12, 13), (8, 15, 17), (7, 24, 25), (20, 21, 29), (9, 40, 41). All primitive triples (with no common divisor) come from Euclid's formula: a = m² − n², b = 2mn, c = m² + n², where m > n, and m and n are coprime and of opposite parity. For example m = 2, n = 1 gives (3, 4, 5), m = 3, n = 2 gives (5, 12, 13), m = 4, n = 3 gives (7, 24, 25). All other triples are primitive ones multiplied by k = 2, 3, … With a hypotenuse up to 100 there are 52 triples, 16 of them primitive. The number 12 belongs to 4 triples: (5, 12, 13), (9, 12, 15), (12, 16, 20), (12, 35, 37).

Box diagonal and distance between points

The diagonal of a rectangular box with edges a, b, c is d = √(a² + b² + c²): the Pythagorean theorem is used twice, first for the diagonal of the base, then for the triangle with the height c. For 3 × 4 × 12 the base diagonal is 5 and the box diagonal is √(25 + 144) = 13. The distance between (x₁; y₁) and (x₂; y₂) is d = √((x₂ − x₁)² + (y₂ − y₁)²), and in space the term (z₂ − z₁)² is added. For (1; 2) and (4; 6) we get √(9 + 16) = 5.

Where the Pythagorean theorem is used

In building and carpentry a right angle is marked out with the «Egyptian triangle» with sides 3, 4, 5 (or 6, 8, 10): if the diagonal is 5, the angle is right. A 5 m ladder standing 3 m from a wall reaches a height of 4 m. The diagonal of a 40 × 30 cm screen is 50 cm. The distance between points on a map, the diagonal of a room or a wardrobe, the run of a slope, the height of a support — all of these are Pythagorean theorem tasks.

All entered numbers are handled exactly (fractions are not rounded) and roots are simplified: for example √50 is written as 5√2.

FAQ

What is the Pythagorean theorem?

In a right triangle the square of the hypotenuse equals the sum of the squares of the legs: a² + b² = c².

How do I find the hypotenuse?

With the formula c = √(a² + b²). For legs 3 and 4 the hypotenuse is 5.

How do I find a leg?

With a = √(c² − b²) or b = √(c² − a²). For c = 13 and a = 5 the leg b = 12.

Which triangles does the Pythagorean theorem work for?

Only right triangles. For an arbitrary triangle the law of cosines applies: c² = a² + b² − 2ab·cos γ, and for γ = 90° it turns into the Pythagorean theorem.

What if the hypotenuse is smaller than a leg?

Such data is impossible: the hypotenuse is always the longest side of a right triangle. The calculator shows an error message.

How do I check that a triangle is right-angled?

Find the largest side and compare its square with the sum of the squares of the other two. Equality means a right angle (the converse Pythagorean theorem). For 7, 24, 25: 49 + 576 = 625.

What is a Pythagorean triple?

Three whole numbers a, b, c with a² + b² = c², for example (3, 4, 5) or (5, 12, 13). Primitive triples have no common divisor, and the rest come from multiplying by k.

How do I find the diagonal of a rectangle or a box?

The diagonal of an a × b rectangle is √(a² + b²). The diagonal of an a × b × c box is √(a² + b² + c²). For 3 × 4 × 12 it is 13.

How do I find the distance between two points?

d = √((x₂ − x₁)² + (y₂ − y₁)²), and in space (z₂ − z₁)² is added. For (1; 2) and (4; 6) the distance is 5.

How many Pythagorean triples are there?

Infinitely many. With a hypotenuse up to 100 there are 52, of which 16 are primitive. The calculator shows the list for any N up to 10 000.

Can I enter fractions and decimals?

Yes: 2.5 or 5/2. The numbers are handled exactly without rounding, so the answer may be a root such as 5√2.

Why is the answer written with a root?

Because the square of the unknown side is rational and its root simplifies exactly: √50 = 5√2. A decimal value is always shown beside it, and its precision is set by the decimal places.