Education

Pythagorean Theorem Calculator

Calculate the hypotenuse or a leg of a right triangle. The simulator updates in real time as you enter values.

The Pythagorean theorem is one of the foundations of Euclidean geometry and one of the most widely known and applied mathematical concepts. It states that in a right triangle, the square of the hypotenuse (the side opposite the right angle) equals the sum of the squares of the other two sides (legs): a² + b² = c². This relationship has thousands of applications in architecture, engineering, surveying and physics.

This calculator lets you calculate the hypotenuse knowing both legs, or calculate a leg when you know the hypotenuse and the other leg. The visual simulator updates in real time so you can see the right triangle with the correct proportions. Particularly useful for secondary school and vocational training problems or construction work.

What do you want to calculate?

Enter values to calculate.

Simulator
↺ reset90°a = ?b = ?c = ?

How to apply the theorem step by step

The theorem relates the three sides of a right triangle through the formula a² + b² = c², where c is always the hypotenuse (the side opposite the right angle). To find the hypotenuse you square both legs, add them and take the square root of the total. To find a leg you do the opposite: subtract the square of the known leg from the square of the hypotenuse and take the root. The key is to correctly identify which side is the hypotenuse before you start.

Worked example

Take a right triangle with legs of 6 and 8 units. Applying the formula: c = √(6² + 8²) = √(36 + 64) = √100 = 10. The hypotenuse is 10 units. If instead we knew the hypotenuse (10) and one leg (6), the other leg would be √(10² − 6²) = √(100 − 36) = √64 = 8.

Most common Pythagorean triples

Leg aLeg bHypotenuse c
345
51213
81517
72425
202129
94041

How to interpret the result

The result shown by the calculator is mathematically exact, but it will often have decimals because most triangles do not form perfect Pythagorean triples. In a classroom problem you are usually asked to round to two decimal places; in construction or carpentry it is enough to round to the unit of measurement you are using (millimetres or centimetres). Remember that the three sides must share the same units: if the legs are in metres, the hypotenuse will also come out in metres.

Three real problems solved

A ladder against a wall: if it is 5 m long and you place the base 1.5 m from the wall, the height it reaches is √(5² − 1.5²) = √(25 − 2.25) = √22.75 ≈ 4.77 m. This is the calculation firefighters and painters make, and it also tells you whether the angle is safe, because a ladder that is too vertical tips backwards. The television: a TV's inches measure the diagonal, not the width. A 16:9 panel 120 cm wide and 67.5 cm high has a diagonal of √(120² + 67.5²) ≈ 137.7 cm, that is about 54 inches. This is why two TVs with the same inches but different proportions take up different widths. Squaring a room: measure 3 m along one wall, 4 m along the other, and check that the distance between those two points is exactly 5 m. If it is, the corner is a perfect right angle. It is the old 3-4-5 trick builders have used for centuries, and it needs no tool beyond a tape measure.

When the theorem cannot be applied

The theorem only works in right triangles, that is, those with an angle of exactly 90 degrees, and on a flat surface. If the triangle has no right angle, the correct relation is the law of cosines, which adds a correction term: c² = a² + b² − 2ab·cos(C). When angle C is 90 degrees its cosine is zero, the term vanishes and Pythagoras is recovered, turning out to be a particular case. Nor does it apply as such on curved surfaces: in spherical geometry, used for navigation or for distances over the Earth, a triangle's angles add up to more than 180 degrees and distances follow other formulas. And a practical detail: always check that the side you call the hypotenuse is the longest one, because confusing it with a leg is the most common mistake when setting up the problem.

Results are mathematically exact. Round to the number of decimal places you need for your practical application.

Frequently asked questions

The Pythagorean theorem states that in every right triangle, the sum of the squares of the two legs equals the square of the hypotenuse: a² + b² = c². It was proved by the Greek mathematician Pythagoras in the 6th century BC.

The hypotenuse (c) is the longest side of a right triangle and is opposite the right angle. The legs (a and b) are the two sides that form the right angle.

The 3-4-5 triple is the most famous: 3² + 4² = 9 + 16 = 25 = 5². Other well-known triples are 5-12-13, 8-15-17 and 7-24-25.

When you know the hypotenuse and one of the legs, you find the other leg by subtracting instead of adding. Starting from a² + b² = c², you rearrange to b² = c² − a², so b = √(c² − a²). For example, if the hypotenuse is 13 and one leg is 5, the other leg is √(13² − 5²) = √(169 − 25) = √144 = 12. For the operation to make sense, the hypotenuse must always be greater than the known leg; otherwise no right triangle can exist with those values.

It is one of the most useful tools outside the classroom. In construction and carpentry the 3-4-5 relationship is used to check that a corner forms a perfect right angle without a set square. In surveying and navigation it lets you calculate straight-line distances from horizontal and vertical displacements. It also appears when working out the diagonal of a screen or a room, the length of a ramp or a ladder leaning against a wall, and it is the basis of the distance formula between two points in analytic geometry.

Yes, and the extension is very natural. To find the diagonal of a rectangular box you simply apply the theorem twice, which gives d = √(length² + width² + height²). For a 3 × 4 × 12 cm box, the internal diagonal is √(9 + 16 + 144) = √169 = exactly 13 cm. This is the calculation that determines whether a long object fits diagonally inside a car boot, a shipping box or a cabin suitcase, and the one design software uses to compute distances in space. The same idea generalises to any number of dimensions, and it is the basis of the Euclidean distance that statistics and machine learning use to measure how similar two sets of data are.

Related calculator: Unit converter

Related guide

Related calculators