Pythagorean Theorem Calculator

The Pythagorean Theorem Calculator solves a² + b² = c² for whichever side you don't know. Enter the two known sides; the calculator gives you the third, plus the triangle's area and perimeter for free. Works for the hypotenuse (the longest side, opposite the right angle) and either leg. The formula is named for Pythagoras of Samos (~570-495 BC) but was known to Babylonian and Indian mathematicians centuries earlier.

Built by Bob Article by Lace QA by Ben Shipped
Leg a (a)
3
Leg b (b)
4
Hypotenuse (c)
5
a² + b² = c²: 3² + 4² = 25 = 5²
Triangle area = ½ × a × b = 6 · Perimeter = a + b + c = 12

How to use

  1. 1

    Pick which side you're solving for: hypotenuse (c) is the most common, but you can also solve for either leg if you have the hypotenuse and one leg.

  2. 2

    Enter the two known sides. The labels update — only the input fields you need stay visible.

  3. 3

    Read the result block: all three sides shown together, with the computed one highlighted in yellow.

  4. 4

    Below the sides, you also get the triangle's area (½ × leg × leg) and perimeter (sum of all three sides). Useful for fencing, flooring, sail design, anything where the right triangle is a real shape.

Frequently asked questions

Ratings & Reviews

Rate this tool

Sign in to rate and review this tool.

Loading reviews…

What is the Pythagorean theorem?

The Pythagorean theorem says: in any right triangle, the square of the hypotenuse equals the sum of the squares of the two legs. Written as a formula, a² + b² = c², where c is the hypotenuse (the longest side, opposite the right angle) and a, b are the two legs (the sides that form the right angle).

The theorem is named for Pythagoras of Samos (~570-495 BC) but the relationship was known centuries earlier. Babylonian clay tablets from around 1800 BC list integer triples that satisfy it. Indian mathematicians described it in the Sulba Sutras around 800 BC. Pythagoras may have been the first to prove it as a general statement rather than collect examples — or his school may have, since most "Pythagorean" results come from the school rather than the man.

The theorem is the workhorse of right-triangle geometry. Given any two sides, you can find the third. The same identity reappears as the distance formula in coordinate geometry, the magnitude formula in vector arithmetic, the line-of-sight formula in surveying, and the diagonal formula for screen sizes and rectangles. Anywhere you need to find a length from two perpendicular components, the Pythagorean theorem is doing the work.

How to use the Pythagorean Theorem Calculator

The calculator solves a² + b² = c² for whichever side you don't know. Three modes:

  1. Hypotenuse from two legs. Enter both legs (a and b); the calculator returns c = √(a² + b²). This is the most common case.
  2. Leg from hypotenuse and other leg. Enter c and one leg; the calculator returns the missing leg via a = √(c² − b²). The hypotenuse must be larger than the known leg — otherwise the triangle does not exist.
  3. The bonuses. Once all three sides are known, the calculator also returns the area (½ · leg · leg) and the perimeter (a + b + c). Useful any time the right triangle is a real shape — fencing, flooring, a sail, a staircase.

The result updates as you type. No Calculate button. Inputs stay in your browser. No sign-up, no banner ad bigger than the answer, no "verify your email to see your hypotenuse." Just the math.

The classic worked examples

Two right triangles every student eventually memorizes:

The 3-4-5 triangle. Legs of 3 and 4, hypotenuse of 5. Check: 3² + 4² = 9 + 16 = 25 = 5². The Pythagorean theorem holds with all integer values. Carpenters and surveyors have used this triple for thousands of years to construct exact right angles in the field — tie knots in a rope at distances 3, 4, and 5 (any unit), stake the rope so the segments form a triangle, and the angle opposite the 5-unit side is exactly 90°. No protractor needed.

The 5-12-13 triangle. Legs of 5 and 12, hypotenuse of 13. Check: 5² + 12² = 25 + 144 = 169 = 13². Another integer triple. If you ever need to verify a right angle and your rope is too short for the 3-4-5 version, the 5-12-13 works the same way — set 5 units on one wall, 12 on the perpendicular wall, and the diagonal should measure exactly 13.

The three forms of the formula:

Solving for the hypotenuse: c = √(a² + b²)

Solving for a leg (given hypotenuse and other leg): a = √(c² − b²)

Same identity, three rearrangements. The calculator picks the right one based on which input is empty.

Pythagorean triples — when all three sides are integers

A Pythagorean triple is a set of three positive integers (a, b, c) where a² + b² = c² exactly. They are rare and useful. The 3-4-5 and 5-12-13 are the two most famous; there are infinitely many. Every triple can be multiplied by a positive integer to produce another triple: 3-4-5 scales to 6-8-10, 9-12-15, 12-16-20, and so on. The smallest triples that are not scaled versions of smaller triples are called primitive triples.

abcVerification
3459 + 16 = 25
5121325 + 144 = 169
7242549 + 576 = 625
8151764 + 225 = 289
9404181 + 1600 = 1681
116061121 + 3600 = 3721
123537144 + 1225 = 1369
138485169 + 7056 = 7225
202129400 + 441 = 841
2099101400 + 9801 = 10201

Euclid gave a formula that generates every primitive triple: pick two positive integers m > n with no common factors and exactly one of them even. Then a = m² − n², b = 2mn, c = m² + n². Try m=2, n=1: a = 4-1 = 3, b = 4, c = 5 — the 3-4-5 triple. Try m=3, n=2: a = 9-4 = 5, b = 12, c = 13 — the 5-12-13 triple. Every primitive triple comes out of Euclid's formula for some valid (m, n) pair.

Solving for a leg instead of the hypotenuse

Rearrange a² + b² = c² to solve for a: a² = c² − b², so a = √(c² − b²). The order matters — the hypotenuse squared minus a leg squared, not the other way round. If you accidentally compute b² − c², you get a negative number and the square root fails. The hypotenuse is always the largest side, so c² > b² and c² > a² always.

Worked example: a ladder is 5 meters long and the base sits 3 meters from a wall. How high up the wall does it reach? The ladder is the hypotenuse (c = 5), the base distance is one leg (b = 3), and the wall height is the missing leg. a = √(25 − 9) = √16 = 4 meters. Pull the base out another meter and the height drops to a = √(25 − 16) = √9 = 3 meters. Pull it out to b = 4 meters and the height drops to √(25 − 16) = 3 meters. Pull it out to b = 5 meters and the height drops to zero — the ladder is flat on the ground, no longer a triangle.

If you enter values where the "leg" you call known is actually bigger than the hypotenuse, the calculator returns an error rather than producing an imaginary number. The hypotenuse must be the largest of the three sides; that is built into the geometry.

Distance between two points — Pythagorean theorem in disguise

Coordinate geometry borrows the theorem directly. The straight-line distance between two points (x₁, y₁) and (x₂, y₂) on a plane is √((x₂−x₁)² + (y₂−y₁)²). The horizontal distance (x₂−x₁) and the vertical distance (y₂−y₁) are the two legs of a right triangle, and the straight line between the points is the hypotenuse.

The distance from (1, 2) to (4, 6): horizontal = 3, vertical = 4, distance = √(9 + 16) = √25 = 5. The same 3-4-5 triangle, rotated and translated into the coordinate plane. Every distance calculation in 2D graphics, every "how far apart are these two pins on a map," every collision check in a 2D game uses this formula.

In three dimensions: √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²). Same idea, three perpendicular components instead of two. The proof generalizes — you apply Pythagorean once to get the 2D diagonal of the bottom face, then apply it again with that diagonal as one leg and the vertical (z) as the other. The square root absorbs both steps into a single formula.

Where the theorem shows up

The Pythagorean theorem is one of those rare formulas that earns its keep across half the practical world. A short tour:

  • Carpentry — squaring a foundation. Measure 3 feet down one wall, 4 feet down the perpendicular wall, and the diagonal between those marks should be exactly 5 feet. If it is not, the corner is not square and you fix it before pouring concrete.
  • Surveying. Total stations and theodolites measure angles and distances; computing locations from those measurements uses the Pythagorean theorem at every step.
  • Navigation. Straight-line ("rhumb-line" approximations for short distances) between two lat/long pairs comes from a flat-earth Pythagorean computation. Long distances need spherical trigonometry instead — the curvature of the earth breaks the flat-plane assumption.
  • Screen sizes. A 27-inch monitor measures 27 inches diagonally. If you know the aspect ratio (16:9), the width and height are √(27² · 16² / (16² + 9²)) and √(27² · 9² / (16² + 9²)), or about 23.5 and 13.2 inches. The diagonal is the Pythagorean hypotenuse of the width-height rectangle.
  • Physics — vector magnitudes. A velocity with horizontal component 3 m/s and vertical component 4 m/s has a total speed of √(9 + 16) = 5 m/s. The same identity scales to 3D and beyond.
  • Sail design. A triangular sail with a mast (vertical leg), a boom (horizontal leg), and a leech (the hypotenuse from the top of the mast to the end of the boom). The leech length comes straight from Pythagoras.
  • GPS. The trilateration math that computes your position from satellite signal travel times is a 3D Pythagorean computation under the hood.

Why does the theorem work?

More than 370 distinct proofs have been published. The most common high-school proof is the "rearrangement" proof: draw a square with side length (a + b), then place four copies of the right triangle inside, two arrangements. In one arrangement the leftover area is two squares of size a² and b². In the other arrangement the leftover area is one square of size c². The outer square has the same total area in both arrangements, so a² + b² = c². No algebra, just shapes.

Euclid's original proof (Elements, Book I, Proposition 47) is more constructive: drop a perpendicular from the right-angle vertex to the hypotenuse. This splits the right triangle into two smaller right triangles, both similar to the original. The proportions from the similarity give a² = c · (first segment) and b² = c · (second segment). Adding: a² + b² = c · (first + second) = c · c = c². Clean and self-contained.

The theorem is special enough that James Garfield, before he was the 20th US president, published his own proof in 1876 using a trapezoid construction. It is on the short list of math results that have inspired more proofs than any other.

Related calculators

Right-triangle geometry shows up in enough places that several adjacent calculators are worth knowing:

  • Square Root Calculator — the operation at the heart of every Pythagorean computation. Once you have a² + b², you take its square root to get c.
  • Root Calculator — the general n-th root version. Useful when the Pythagorean theorem generalizes (4D distance, n-dimensional norms).
  • Exponent Calculator — the inverse operation. Useful for verifying a Pythagorean answer by squaring it back.

Frequently asked questions

What is the formula?

a² + b² = c², where c is the hypotenuse (longest side, opposite the right angle) and a, b are the two legs (the sides forming the right angle). Solving for c: c = √(a² + b²). Solving for a leg, given the hypotenuse and the other leg: a = √(c² − b²). The hypotenuse is always larger than either leg — that is a built-in constraint of any right triangle.

Does the theorem only work for right triangles?

Yes. The Pythagorean theorem is specifically about right triangles — one of the three angles must be exactly 90°. For non-right triangles you use the Law of Cosines: c² = a² + b² − 2ab · cos(C). When C = 90°, cos(C) = 0 and the law of cosines collapses to a² + b² = c². The Pythagorean theorem is a special case.

What is a 3-4-5 triangle?

The most famous Pythagorean triple. 3² + 4² = 9 + 16 = 25 = 5², so a triangle with legs 3 and 4 has a hypotenuse of exactly 5. Carpenters use it to construct exact right angles in the field: tie knots in a rope at 3, 4, and 5 units, stake the rope as a triangle, and the angle opposite the 5-unit side is 90° on the nose. Other small triples: 5-12-13, 8-15-17, 7-24-25, 20-21-29.

How do I find the distance between two points?

The Pythagorean theorem in disguise. The distance between (x₁, y₁) and (x₂, y₂) is √((x₂−x₁)² + (y₂−y₁)²). The horizontal distance and vertical distance are the two legs of a right triangle, and the straight line between the points is the hypotenuse. In 3D: √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²). Same idea, one more leg.

What are some real-world uses?

Carpentry (squaring a foundation), surveying (computing positions from angle and distance measurements), navigation (straight-line distance for short hops), screen sizing (diagonal from width and height), physics (resultant vector magnitudes), sail design, satellite line-of-sight, GPS trilateration, and almost every CAD or graphics operation that computes a length. If you need a length from two perpendicular components, the Pythagorean theorem is doing the work.

Why does it work?

Many proofs exist — more than 370 published. The intuitive one (Euclid's): drop a perpendicular from the right-angle vertex to the hypotenuse. This splits the right triangle into two smaller right triangles, both similar to the original. The proportions give a² = (hypotenuse · first segment) and b² = (hypotenuse · second segment). Adding: a² + b² = hypotenuse · (first + second) = hypotenuse · hypotenuse = c². Clean and constructive — no algebra needed.

What is the area formula for a right triangle?

Area = ½ · leg₁ · leg₂. The two legs form the base and height; the formula is the standard ½ · base · height. The calculator computes this for free once it knows both legs. For arbitrary (non-right) triangles you would need Heron's formula or the sine version (½ · a · b · sin(C)), but for right triangles the two legs are perpendicular by definition, so the simple formula is exact.

Are the inputs limited to integers?

No — any positive real number works. The formula does not care. A right triangle with legs 1.5 and 2.0 has hypotenuse 2.5. So does a triangle with legs √2 and √3 (hypotenuse √5). So does one with legs 0.001 and 0.002 (hypotenuse 0.002236). The calculator displays up to 6 decimal places for irrational results.