Skip to main content

Pythagorean Theorem Calculator

Source: Euclid, Elements, Book I, Proposition 47 · Source verified August 20, 2026

Blake Boege
Written by Blake Boege · Founder, Calculator Answers

A Pythagorean theorem calculator is a geometric tool that solves for the length of any side of a right-angled triangle using the formula a² + b² = c², where c is the hypotenuse and a and b are the legs. The theorem is a fundamental principle of Euclidean geometry. It is used extensively in architecture, engineering, navigation, and construction to calculate exact straight-line distances.

Find the hypotenuse or missing leg of any right triangle. Shows step-by-step solution, perimeter, area, and angles.

Quick Answer

Calculate the length of any missing side of a right triangle. Enter the lengths of any two sides to instantly solve for the third side using the Pythagorean theorem.

bac
Result

Awaiting inputs

Was this helpful?

How it works

Formula · a^2 + b^2 = c^2, where c is the hypotenuse. Solving for a leg subtracts from the hypotenuse: a = sqrt(c^2 - b^2).

The Pythagorean theorem (a² + b² = c²) lets you find any missing side of a right triangle if you know the other two.

Find Hypotenuse · c = √(a² + b²)

Find Leg · a = √(c² − b²)

What is the Pythagorean theorem?

The Pythagorean theorem is one of the most famous equations in mathematics. It describes the relationship between the three sides of a right triangle (a triangle with one 90° angle).

THE THEOREM: a² + b² = c²

Where:

  • c is the hypotenuse, the longest side, opposite the right angle
  • a and b are the two legs, the sides that form the right angle

NAMED AFTER: Pythagoras of Samos (around 570-495 BCE), an ancient Greek mathematician. The theorem was actually known to Babylonian and Indian mathematicians before Pythagoras, but his school in ancient Greece formally proved it, which is why his name stuck.

THE THEOREM ONLY WORKS FOR RIGHT TRIANGLES. For other triangles, use the Law of Cosines instead: c² = a² + b² - 2ab × cos(C).

The calculator above solves for any missing side when you know the other two. Choose what you want to find from the dropdown, enter the two known values, and it instantly shows the answer with step-by-step work.

How to use the Pythagorean theorem

FINDING THE HYPOTENUSE (c) when you know both legs:

  1. Square each leg
  2. Add them together
  3. Take the square root of the result

EXAMPLE: Legs are 3 and 4.
- 3² + 4² = 9 + 16 = 25
- √25 = 5
- The hypotenuse is 5

FINDING A LEG when you know the hypotenuse and other leg:

  1. Square the hypotenuse
  2. Subtract the square of the known leg
  3. Take the square root of the result

EXAMPLE: Hypotenuse is 13, one leg is 5.
- 13² - 5² = 169 - 25 = 144
- √144 = 12
- The other leg is 12

COMMON PYTHAGOREAN TRIPLES (sets of three whole numbers that satisfy a² + b² = c²):

  • 3, 4, 5 (the most famous)
  • 5, 12, 13
  • 8, 15, 17
  • 7, 24, 25
  • 9, 40, 41
  • 20, 21, 29

Multiples of these also work: 6, 8, 10 (double of 3-4-5), 9, 12, 15 (triple of 3-4-5), etc.

The distance formula is this theorem in coordinates

The distance formula is not a different rule that happens to resemble this one. It is this theorem, written for a coordinate plane. Put the triangle on axes and the two legs stop being called a and b and start being called the difference in x and the difference in y. The hypotenuse stops being called c and starts being called the distance. Nothing else changes, which is why d = √((x₂ − x₁)² + (y₂ − y₁)²) is just c = √(a² + b²) with longer names for a and b.

xy01426(1, 2)(4, 6)a = 3b = 4c = 5a² + b² = 9 + 16 = 25, so c = 5

The diagram places the same right triangle on a coordinate plane. One point sits at (1, 2) and the other at (4, 6). The horizontal leg, labelled a, has length 3. The vertical leg, labelled b, has length 4, and a small square marks the right angle where they meet. The hypotenuse, labelled c, joins the two points. Since 9 plus 16 is 25, c is 5.

Working a side out by hand

Solving for the hypotenuse, with legs of 3 and 4:

  1. Square each leg. 3² = 9 and 4² = 16.
  2. Add them. 9 + 16 = 25.
  3. Take the square root. √25 = 5, so the hypotenuse is 5.

Solving for a missing leg runs the same steps in reverse, and the subtraction goes one way only. With a hypotenuse of 13 and one leg of 5: 13² = 169, 5² = 25, and 169 − 25 = 144, so the other leg is √144 = 12. The hypotenuse is always the square you subtract from, never the one you subtract.

Edge cases, and what the answer means

  • A leg longer than the hypotenuse. There is no such triangle, so the calculator refuses rather than returning a number. In a right triangle the hypotenuse is opposite the largest angle, and so it is always the longest side. If your figures say otherwise, two sides have been swapped.
  • A leg exactly equal to the hypotenuse. Also rejected, and for the same reason. It would leave the other leg at zero length, which is a straight line rather than a triangle.
  • Answers that are not whole numbers. These are the normal case, not a problem. Legs of 3 and 4 give exactly 5, but legs of 2 and 3 give √13, which is 3.6056 to four places. Whole-number triples like 3-4-5 and 5-12-13 are rare enough to be worth naming.
  • Right angles only. The theorem holds for right triangles and nothing else. For a triangle with no right angle you need the law of cosines, which reduces to this theorem when the angle happens to be 90 degrees.

This page solves for one missing side and stops there. If you also want the two acute angles, the area or the perimeter, the right triangle calculator takes any two known parts, including an angle rather than a side, and returns the rest of the shape. The isosceles right triangle, the 45-45-90 case, is simply that solver with two equal legs.

Your measurements stay in the page

Every side length you enter is processed by this page in your browser. The measurements and the result are not sent to a server, not stored after you close the tab, and not visible to anyone else. There is no account and nothing to sign up for.

Real-world applications

The Pythagorean theorem is not just a classroom exercise. It is used constantly in real applications:

CONSTRUCTION:

  • Checking that walls are square (3-4-5 method: measure 3 feet along one wall, 4 feet along the adjacent wall, and the diagonal should be exactly 5 feet)
  • Calculating roof rise and run
  • Determining diagonal bracing lengths
  • Stairs: rise² + run² = stringer length²

NAVIGATION:

  • Finding straight-line distance between two points on a map
  • Calculating ship or aircraft heading distance
  • GPS systems use Pythagorean math for 2D distance estimation

DESIGN AND TECHNOLOGY:

  • TV and monitor sizes (diagonal measurement). A 'full HD' 16:9 TV with 1920×1080 pixels has a diagonal of √(1920² + 1080²) ≈ 2203 pixels
  • Calculating cable/wire lengths for installations
  • Phone screen size advertising

SPORTS:

  • Baseball: distance from home plate to second base (with 90 feet between bases)
    - 90² + 90² = 16,200
    - √16,200 ≈ 127.3 feet
  • Diagonal of a tennis court, soccer field, basketball court

DAILY LIFE:

  • Will that ladder reach that high window? (ladder = c, distance from wall = a, height to reach = b)
  • Can you fit a 70-inch TV through a 65-inch door? (depends on diagonal vs. door diagonal)
  • Calculating shortcuts across rectangular spaces

PHYSICS:

  • Vector addition (combining forces or velocities perpendicular to each other)
  • Distance and displacement calculations
  • The relationship between resistance, reactance, and impedance in electrical circuits

Proving the Pythagorean theorem

There are over 350 known proofs of the Pythagorean theorem. The oldest surviving written one is Euclid, Elements, Book I, Proposition 47, which is the source cited for this page: it proves the squares on the two legs together equal the square on the hypotenuse, using areas rather than algebra. Here is one of the simplest visual proofs:

THE 'SQUARE WITHIN A SQUARE' PROOF:

  1. Draw a large square with side (a + b)
  2. Inside, draw four identical right triangles, each with legs a and b
  3. The triangles form a smaller square in the center with side c (the hypotenuse)

The area of the big square = (a + b)²

The big square equals: the inner square + the four triangles
(a + b)² = c² + 4(½ab)
a² + 2ab + b² = c² + 2ab
a² + b² = c² ✓

OTHER NOTABLE PROOFS:

  • President James Garfield (1881) discovered a proof using a trapezoid
  • Einstein supposedly came up with his own proof as a child
  • Some proofs use algebra; others use only geometry
  • Indian mathematician Bhaskara provided a simple 'Behold!' proof with no words

The variety of proofs shows the theorem's foundational importance. It connects geometry, algebra, and trigonometry. Almost every advanced math topic builds on it.

Common mistakes

  1. APPLYING IT TO NON-RIGHT TRIANGLES. The theorem ONLY works for triangles with a 90° angle. For other triangles, use the Law of Cosines.
  2. CONFUSING THE HYPOTENUSE. The hypotenuse is always the LONGEST side, opposite the right angle. If you label the wrong side as c, you'll get incorrect results. The hypotenuse is never one of the sides forming the right angle.
  3. FORGETTING TO TAKE THE SQUARE ROOT. After computing a² + b², many students give that as the answer. You need to take the square root to get the actual side length.
  4. SQUARE ROOT GIVING NEGATIVE OR IMAGINARY NUMBERS. If you're solving for a leg and the math gives a negative under the square root, you have made an error, usually treating a leg as the hypotenuse, or vice versa. The hypotenuse must be larger than either leg.
  5. UNITS CONSISTENCY. All three sides must be in the same units. You can't have a in feet and b in inches without converting first.
  6. ASSUMING IT WORKS IN 3D. Pythagoras works in 2D. For 3D distance, use d = √(x² + y² + z²) which is the theorem extended, but solved differently.

Related Calculators

Frequently asked questions

Yes, literally. Place a right triangle on a coordinate plane and the leg a becomes the difference in x, the leg b becomes the difference in y, and the hypotenuse c becomes the distance between the two points. The distance formula is c = √(a² + b²) with longer names for a and b, which is why anyone who can use one can already use the other.

Because no such right triangle exists. The hypotenuse sits opposite the right angle, which is the largest angle in the triangle, so it is always the longest side. Entering a longer leg would put a negative number under the square root. Rather than return a meaningless result, the calculator says the hypotenuse must be larger, which almost always means two sides were entered the wrong way round.

That is rejected too. If one leg equalled the hypotenuse, the other leg would have to be zero, and a side of zero length is a straight line rather than a triangle. The gate is 'must be larger', not 'must not be smaller', for that reason.

Subtract instead of add, and always subtract from the hypotenuse. With a hypotenuse of 13 and a leg of 5, square both to get 169 and 25, subtract to get 144, then take the square root for 12. Reversing that subtraction is the single most common error, and it is what produces a negative under the root.

No. It holds only when one angle is exactly 90 degrees. For any other triangle you need the law of cosines, c² = a² + b² − 2ab·cos(C), which subtracts a correction term. When C is 90 degrees its cosine is zero, the correction disappears, and the law of cosines becomes this theorem exactly.

It states that in a right triangle, the square of the hypotenuse equals the sum of the squares of the other two sides. Mathematically: a² + b² = c², where c is the hypotenuse (the side opposite the 90° angle). It only works for right triangles.

Square both legs, add them, then take the square root. For legs of 3 and 4: 3² + 4² = 9 + 16 = 25, and √25 = 5. So the hypotenuse is 5. The calculator above does this instantly.

Square the hypotenuse, subtract the square of the known leg, then take the square root. For hypotenuse 13 and leg 5: 13² - 5² = 169 - 25 = 144, and √144 = 12. So the missing leg is 12.

Sets of three whole numbers that satisfy a² + b² = c². The most famous is 3-4-5. Others include 5-12-13, 8-15-17, 7-24-25, and 9-40-41. Any multiple of a triple also works (6-8-10, 9-12-15, etc.).

No, only right triangles (triangles with one 90° angle). For other triangles, use the Law of Cosines: c² = a² + b² - 2ab × cos(C), which reduces to the Pythagorean theorem when C = 90° because cos(90°) = 0.

Named after Pythagoras of Samos (around 570-495 BCE), a Greek philosopher and mathematician. However, the relationship was known to Babylonian, Indian, and Chinese mathematicians earlier. Pythagoras's school in Greece is credited with the first formal proof, which is why his name attached to it.

Constantly. Construction uses it to check square corners. Navigation uses it for distance calculations. TV/monitor sizes are diagonal measurements found with the theorem. Sports fields, ladder placements, cable lengths, and even GPS systems all rely on Pythagorean math.

That's normal and common. Most real-world measurements produce decimal hypotenuses. A 3×7 rectangle has a diagonal of √(3² + 7²) = √58 ≈ 7.6158. The calculator shows decimal results to 4 places by default; you can round to whatever precision you need.

The side length itself is always positive. If you set up the equation incorrectly (treating a leg as the hypotenuse, for instance), you might get a negative under the square root, which has no real solution. This is a signal that you've assigned the sides incorrectly. The hypotenuse must be longer than either leg.

The math is exact. The calculator uses standard arithmetic and the JavaScript Math.sqrt function, which is precise to about 15 decimal places. The 4-decimal display is just for readability; internally the precision is much higher.