Geometry

Pythagorean Theorem Calculator

Enter two sides of a right triangle and find the third. The tool also shows the angles, the area and the perimeter of the triangle.

Calculator

Educational use: results are estimates made for study and reference. Checking the answer and deciding what to do with it is the sole responsibility of whoever uses the tool. Read the legal notice.

On this page
  1. How to use it
  2. The theorem, drawn
  3. The formula and how to rearrange it
  4. Solved examples
  5. Pythagoras and the others
  6. Pythagorean triples: whole numbers that make the math work
  7. Things to watch out for when applying it
  8. Where the theorem goes to work
  9. When the result can mislead
  10. Questions that almost always come up
  11. Curious details
  12. The vocabulary of the right triangle
  13. More geometry tools

How to use it

The Pythagorean theorem only holds for triangles that have a 90° angle (the right angle). If your triangle is like that, the rest is simple:

  1. Choose what you are looking for: the hypotenuse (the side opposite the right angle, always the longest) or a leg (each of the two sides that form the right angle).
  2. Type the two sides you know, in the same unit.
  3. Calculate. The third side appears highlighted, along with the acute angles, the area and the perimeter.

If you want the hypotenuse, enter the two legs. If you want a leg, enter the hypotenuse and the other leg. Golden tip: the hypotenuse is always the longest of the three sides, and if the number you typed as the hypotenuse is smaller than or equal to the leg, the tool will warn you that something is wrong.

The theorem, drawn

The most beautiful version of the theorem is geometric: the area of the square built on the hypotenuse equals the sum of the areas of the squares built on the legs. Look at the 3-4-5 triangle, where the areas are 9 + 16 = 25.

a² = 9 b² = 16 c² = 25 345
Right triangle with sides 3, 4 and 5. The big square (hypotenuse, area 25) equals the two smaller ones together (9 + 16).

The formula and how to rearrange it

a² + b² = c²a and b are the legs · c is the hypotenuse

Three forms come out of it, and those are the ones you will use:

c = √(a² + b²)
a = √(c² − b²)
b = √(c² − a²)hypotenuse on the first line · legs on the other two

Notice that to find the hypotenuse the squares are added, and to find a leg they are subtracted. It is easy to remember: the hypotenuse is the longest side, so it is the one that "receives" the sum.

Other things that come out of the same triangle

  • Area = leg a × leg b ÷ 2 (the legs are already the base and the height, because they are perpendicular).
  • Acute angles: the angle opposite leg a equals arctan(a ÷ b). The other one is 90° minus the first. In the 3-4-5 triangle, they are about 36.87° and 53.13°.
  • Converse: if three sides satisfy a² + b² = c², the triangle is necessarily a right triangle. This is very useful for checking squareness.

Solved examples

1. The ladder against the wall

A 5 m ladder leans against a wall, with its foot 3 m from the wall. How high up the wall does it reach?

ladder = hypotenuse (c = 5), distance = leg (a = 3) b = √(5² − 3²) = √(25 − 9) = √16 = 4

The ladder reaches 4 m up the wall.

2. The television screen

A screen is 48 in wide and 27 in tall. How long is the diagonal, which is the advertised number?

c = √(48² + 27²) = √(2,304 + 729) = √3,033 ≈ 55.07

The diagonal is about 55 inches, which is why this TV is sold as "55 inches." (And 48 × 27 is a 16:9 ratio.)

3. The builder's square

To check whether a floor corner is square, you mark 3 m along one wall, 4 m along the other and measure the distance between the marks.

if it is square: √(3² + 4²) = 5 m

If the measurement comes out at 5 m, the corner is 90°. Any multiple works the same way: 6-8-10, 9-12-15 and so on.

4. The diagonal of a square

A square with a side of 10 cm.

d = √(10² + 10²) = √200 ≈ 14.14 cm

The diagonal of a square is always side × √2 (about 1.414 times the side).

5. Distance between two points

Two points on a grid map: A (1, 2) and B (7, 10).

difference in x = 6, difference in y = 8 distance = √(6² + 8²) = √100 = 10

It is the same theorem in disguise: the straight-line distance is the hypotenuse of a triangle whose legs are the differences in x and in y.

Pythagoras and the others

Despite the name, the theorem is much older than Pythagoras (6th century BC). A Babylonian clay tablet known as Plimpton 322 lists sets of numbers that satisfy the relationship, and Indian and Chinese texts also show the result, in some cases tied to construction and land measurement.

The credit given to the school of Pythagoras is for turning the result into a proof, a justification that holds for every right triangle, not just for numerical examples. Since then, the theorem has gained hundreds of different proofs, including one by a president of the United States, James Garfield, who discovered it in 1876 while serving in Congress.

Pythagorean triples: whole numbers that make the math work

A Pythagorean triple is a set of three whole numbers that satisfies a² + b² = c². Memorizing the first few speeds up problem solving and test taking a lot.

LegsHypotenuseCheck
3 and 459 + 16 = 25
5 and 121325 + 144 = 169
8 and 151764 + 225 = 289
7 and 242549 + 576 = 625
20 and 2129400 + 441 = 841
9 and 404181 + 1,600 = 1,681

Any multiple of a triple is also a triple: 6-8-10, 9-12-15, 10-24-26. That is why 3-4-5 is the builders' favorite.

Things to watch out for when applying it

Using it on a triangle that is not a right triangle

The theorem only holds with a right angle. For any other triangle, you use the law of cosines, which contains Pythagoras as the special case when the angle is 90°.

Calling the wrong side the hypotenuse

The hypotenuse is always "across from" the 90° angle and is always the longest side. Swapping the roles gives absurd results.

Forgetting to take the square root

At the end of adding or subtracting the squares, you still have to take the root. Saying that the hypotenuse of the 3-4-5 triangle is 25 (and not 5) is a classic.

Simply adding the legs

For 3 and 4, the hypotenuse is not 7, it is 5. Adding the sides gives the "L-shaped" path, and the hypotenuse is the straight-line shortcut, which is always shorter.

Subtracting in the wrong order

To find a leg, subtract the square of the known leg from the square of the hypotenuse. Doing the opposite gives the root of a negative number, which the tool detects and flags.

Where the theorem goes to work

  • Construction: checking squareness, calculating the length of ramps, stairs, rafters and diagonal braces.
  • Screens and monitors: relating width, height and diagonal.
  • Navigation and maps: straight-line distance between two points on a plane.
  • Games and computer graphics: measuring distances between characters and objects.
  • Sports: the length of the diagonal of a field or court.
  • Physics: combining perpendicular vectors, such as the velocity of a boat in a current.

When the result can mislead

The theorem is exact, but the precision of the result depends on the precision of the measurements you typed. A ladder measurement that is off by 2 cm, for example, changes the result. In construction work and installations, confirm the measurements and the squareness independently.

The tool shows results with up to six decimal places and identifies Pythagorean triples only when all three sides are whole numbers. It does not check whether the triangle in your problem really is a right triangle: that check is the responsibility of whoever uses it.

Bottom line: this tool is educational. Results do not replace your own checking, and how you use them is entirely your responsibility. More details in the legal notice.

Questions that almost always come up

What does the Pythagorean theorem say?

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

What is a hypotenuse and what are legs?

The hypotenuse is the side opposite the right angle and the longest side of the triangle. The legs are the two sides that form the right angle.

How do I calculate a leg when I know the hypotenuse?

Use b = √(c² − a²). For example, with a hypotenuse of 13 and a leg of 5: √(169 − 25) = √144 = 12.

Does the theorem work for any triangle?

No, only for right triangles. For other triangles, you use the law of cosines.

How can I tell whether a triangle is a right triangle from its sides alone?

Check whether the square of the longest side equals the sum of the squares of the other two. With 6, 8 and 10: 36 + 64 = 100, so it is a right triangle.

What is a Pythagorean triple?

A set of three whole numbers that satisfies a² + b² = c², such as 3-4-5, 5-12-13 and 8-15-17.

How do I calculate the diagonal of a rectangle?

Treat the sides as legs: diagonal = √(length² + width²). A 4 × 3 rectangle has a diagonal of 5.

How do I calculate the diagonal of a square?

Multiply the side by √2 (approximately 1.4142). A square with a side of 10 has a diagonal of about 14.14.

Why does the tool show angles?

Because once you know all three sides, the acute angles come straight from trigonometry (arctangent). It is a bonus for anyone who is also studying sine and cosine.

Why did it not work with my hypotenuse being shorter than the leg?

Because the hypotenuse is always the longest side of a right triangle. If the value you typed is smaller than or equal to the leg, the data is impossible, and the tool warns you.

Curious details

  • The world thanks √2. The diagonal of a square with side 1 is √2, the first irrational number ever discovered. Tradition says the discovery caused discomfort in the Pythagorean school, which believed that everything could be expressed as ratios of whole numbers.
  • Infinite triples. There are infinitely many Pythagorean triples, and a formula (Euclid's) generates all the primitive ones: a = m² − n², b = 2mn, c = m² + n².
  • In three dimensions, the diagonal of a box with edges a, b and c is √(a² + b² + c²), a direct extension of the theorem.

The vocabulary of the right triangle

Right triangle
A triangle that has a 90° angle.
Hypotenuse
The side opposite the right angle. It is always the longest side of a right triangle.
Leg
Each of the two sides that form the right angle.
Pythagorean triple
Three positive whole numbers a, b and c with a² + b² = c².
Square root
The inverse operation of squaring: √25 = 5 because 5² = 25.
Acute angle
An angle smaller than 90°. A right triangle has two of them.
Arctangent
A function that, given the ratio between two legs, returns the corresponding angle.

More geometry tools