Audited 25 May 2026·Last updated 27 Jul 2026·6 citations·Tier 1·0 uses

Pythagorean Theorem Calculator

Free pythagorean theorem calculator: solve a right triangle for the hypotenuse or a missing leg, plus area and perimeter, with worked steps and proofs.

Pythagorean Theorem Calculator

What do you want to solve for?
One of the two legs of the right triangle (the sides adjacent to the right angle). Leave blank in leg mode if a is the side you're solving for.
The other leg of the right triangle. Leave blank in leg mode if b is the side you're solving for.
The hypotenuse — the side opposite the right angle and always the longest. Required in leg mode; ignored in hypotenuse mode.
Hypotenuse (c)
5
The hypotenuse — the side opposite the right angle, equal to √(a² + b²). Always the longest side of a right triangle.
Leg a
3
Leg b
4
Area
6
Perimeter
12

Background.

The Quanta pythagorean theorem calculator solves any right triangle in either direction: enter the two legs and it returns the hypotenuse, or enter the hypotenuse and one leg and it returns the missing leg, along with the triangle's area and perimeter for free. The theorem itself — a² + b² = c² — is the most famous equation in classical geometry and arguably the single most-used result in all of applied mathematics. It is what lets a carpenter check that a wall is square by measuring 3 feet along the floor, 4 feet up the wall, and 5 feet on the diagonal; it is how a surveyor turns two perpendicular tape measurements into a property's boundary length; it is the reason a 65-inch television is actually 56.6 inches wide and 31.9 inches tall once you account for its 16:9 aspect ratio; and it is the foundation under every distance formula, every vector magnitude, every Euclidean norm in machine learning, and every GPS triangulation algorithm.

The relationship was known to Babylonian scribes nearly a thousand years before Pythagoras was born — the cuneiform tablet Plimpton 322, dated to around 1800 BCE, lists fifteen Pythagorean triples — and was independently catalogued by mathematicians in ancient India (the Sulba Sutras), China (the Zhou Bi Suan Jing), and Greece, where Pythagoras's school is credited with the first general proof some time in the 6th century BCE. The most rigorous proof in the Western tradition is Proposition 47 of Book I of Euclid's Elements, written about 300 BCE, and that proof has been taught essentially unchanged for 2,300 years.

This page walks you through three of the cleanest proofs (rearrangement, similar triangles, and pure algebra), the integer-solution "Pythagorean triples" like 3-4-5 and 5-12-13 and 8-15-17 that have fascinated number theorists since Fermat, the impossible-geometry case that the calculator catches for you when someone enters a hypotenuse shorter than one of its legs, and a handful of practical applications — from roof pitch to screen diagonals to construction layout — where you'll find yourself reaching for this exact arithmetic in everyday life. Whether you arrived here to do a homework problem, to measure a room, to verify a contractor's framing, or simply to remember a theorem you last met in ninth grade, this calculator and the explainer below it cover every variant of the question.

What is pythagorean theorem calculator?

The Pythagorean theorem is a statement about right triangles: in any triangle that contains a 90-degree angle, the square of the length of the longest side (the hypotenuse) equals the sum of the squares of the lengths of the other two sides (the legs). Written compactly: a² + b² = c², where c is the side opposite the right angle. The theorem is named for the Greek philosopher and mathematician Pythagoras of Samos (~570–495 BCE), whose followers are credited with the first known general proof, but the relationship itself was demonstrably known to earlier civilizations — Babylonian scribes had a complete table of Pythagorean triples on the Plimpton 322 tablet around 1800 BCE, and the Indian Sulba Sutras (c. 800–500 BCE) gave the rule for constructing a square equal in area to two combined squares, which is exactly the theorem in geometric form. What makes the theorem foundational rather than just useful is that the converse is also true: if a triangle's sides satisfy a² + b² = c², then the triangle must have a right angle opposite the longest side. That converse, also proved by Euclid (Elements Book I, Prop. 48), is what allows the theorem to be used in reverse — to check whether a corner is square, to define perpendicularity in coordinate geometry, and to extend the entire idea of distance from triangles to vector spaces of any dimension. In modern mathematics the theorem generalizes far beyond triangles: the Euclidean distance between two points, the magnitude of a vector, the L² norm in machine learning, the metric of flat spacetime in special relativity, and the orthogonality conditions in Fourier analysis are all direct descendants of a² + b² = c².

How to use this calculator.

  1. Pick the mode at the top. "Hypotenuse (c)" is the most common — use it when you know the two legs and want the diagonal. "Missing leg" is the inverse — use it when you know the hypotenuse and one leg and want the other.
  2. In hypotenuse mode, enter leg a and leg b in the same unit (both inches, both metres, both feet — the theorem does not care which unit you use as long as you are consistent). The hypotenuse, area, and perimeter all update as you type.
  3. In leg mode, enter the hypotenuse c and exactly one of the two legs (a or b). Leave the side you want to solve for blank or at zero. The calculator returns the missing leg plus area and perimeter.
  4. Read the primary result (the hypotenuse in mode 1, the solved leg in mode 2) and the secondary breakdown. The breakdown echoes back all three sides so you can verify the triangle you actually solved is the one you meant to enter.
  5. If you enter a hypotenuse that is shorter than one of the legs, the calculator will flag it as impossible geometry — that combination of sides cannot form a right triangle. Increase the hypotenuse or decrease the leg until c is strictly greater than both a and b.
  6. Use the area and perimeter outputs for downstream problems — flooring estimates, fencing, paint coverage, sheet-metal cuts — without having to re-derive them from the side lengths.

The formula.

c = √(a² + b²)

The core formula is a² + b² = c², and the calculator simply rearranges it depending on which side is missing. To solve for the hypotenuse, take c = √(a² + b²); to solve for a missing leg given the hypotenuse and the other leg, take a = √(c² − b²) or b = √(c² − a²). Three short proofs are worth knowing. Rearrangement proof: take four identical right triangles and arrange them inside a larger square so the hypotenuses form an inner square. The big square has side (a+b) and area (a+b)². The four triangles cover area 4 × (½ab) = 2ab. What remains is the inner square of side c with area c². So (a+b)² = 2ab + c². Expand the left side: a² + 2ab + b² = 2ab + c². Subtract 2ab from both sides: a² + b² = c². Similar-triangles proof: drop a perpendicular from the right angle onto the hypotenuse. This creates two smaller right triangles that are each similar to the original. From the ratios of corresponding sides, a² = c·p and b² = c·q, where p and q are the segments the perpendicular cuts the hypotenuse into. Add: a² + b² = c·(p + q) = c·c = c². Algebraic / coordinate proof: place the right angle at the origin with the legs along the positive x and y axes. The endpoints of the legs are (a, 0) and (0, b). The distance between them by the Pythagorean distance formula is √((a−0)² + (0−b)²) = √(a² + b²), which is exactly c. The area output is the standard right-triangle area, (a × b) ÷ 2, because the two legs are perpendicular and thus serve directly as base and height. The perimeter output is simply a + b + c, the sum of all three sides. Internally the calculator rejects negative or zero side lengths (a real triangle cannot have a side of length zero) and rejects any leg-mode input where c² ≤ a² or c² ≤ b², because in that case no right triangle exists with those measurements.

A worked example.

Example

The classic 3-4-5 right triangle. Selecting hypotenuse mode and entering a = 3 and b = 4 returns c = 5, area = 6, and perimeter = 12. The arithmetic: c = √(3² + 4²) = √(9 + 16) = √25 = 5. Area = (3 × 4) ÷ 2 = 6 square units. Perimeter = 3 + 4 + 5 = 12 units. The 3-4-5 triangle is the smallest "Pythagorean triple" — a set of three whole numbers that satisfy the theorem exactly — and it is the one carpenters, masons, and stage-set builders have used for millennia to lay out perfect right angles in the field. Stretch a tape 3 units along one line, 4 units along the other, and if the diagonal between the endpoints measures exactly 5 units the corner is square. The same trick scales: 6-8-10, 9-12-15, 30-40-50 all work, because multiplying every side of a Pythagorean triple by the same positive number gives another Pythagorean triple. If instead you knew the hypotenuse was 5 and one leg was 3, switching to leg mode and entering c = 5, a = 3 returns b = 4 — the inverse problem, solved by the same theorem read in reverse.

a3
b4
solve Forhypotenuse

Frequently asked questions.

What is the Pythagorean theorem in simple terms?
In any right triangle, if you square the lengths of the two shorter sides (the legs) and add the squares together, the total equals the square of the longest side (the hypotenuse). Written as an equation: a² + b² = c². Equivalently, the area of a square built on the hypotenuse equals the combined area of squares built on the two legs — that geometric picture is how Euclid originally stated the result in Book I, Proposition 47 of the Elements.
How do I find the hypotenuse of a right triangle?
Square both legs, add the results, then take the square root. If the legs are 5 and 12, the hypotenuse is √(5² + 12²) = √(25 + 144) = √169 = 13. The two legs can be in any units — inches, centimetres, miles — as long as they are the same unit; the hypotenuse comes out in that same unit. The Quanta calculator does the squaring, addition, and square root for you in one step.
How do I find a missing leg when I know the hypotenuse?
Rearrange the theorem. Starting from a² + b² = c², subtract the known leg's square from both sides: the missing leg = √(c² − known²). If the hypotenuse is 13 and one leg is 5, the other leg is √(169 − 25) = √144 = 12. Use the calculator's "missing leg" mode and leave the unknown side blank. Note that c² must be strictly greater than the known leg's square — otherwise the triangle is geometrically impossible.
Who actually discovered the Pythagorean theorem?
The relationship was known to Babylonian mathematicians at least a thousand years before Pythagoras. The cuneiform tablet Plimpton 322, dated to roughly 1800 BCE, is a sorted list of fifteen Pythagorean triples — far too systematic to be accidental. Ancient Indian texts (the Sulba Sutras, c. 800–500 BCE), Chinese astronomical writings (the Zhou Bi Suan Jing), and Egyptian rope-stretchers all show evidence of using the 3-4-5 relationship in construction. What Pythagoras's school (6th century BCE) is credited with — and what survives only in later sources — is the first general proof that the relationship holds for all right triangles, not just specific integer cases. The first surviving rigorous proof in the Western tradition is Euclid's, written around 300 BCE.
What is a Pythagorean triple?
A Pythagorean triple is a set of three positive whole numbers (a, b, c) that satisfy a² + b² = c² exactly. The smallest and most famous is 3-4-5: 9 + 16 = 25. Other primitive triples (ones where a, b, c share no common factor) include 5-12-13, 8-15-17, 7-24-25, 20-21-29, and 9-40-41. Multiplying every member of a triple by the same positive integer produces another, larger triple (6-8-10, 9-12-15, and so on). Euclid proved in Book X of the Elements that every primitive triple can be generated by the formula a = m² − n², b = 2mn, c = m² + n², where m > n > 0 are positive integers of opposite parity sharing no common factor. There are infinitely many.
Does the Pythagorean theorem only work for right triangles?
Yes — the strict equality a² + b² = c² is true for and only for right triangles. For acute triangles (all angles less than 90°), c² < a² + b². For obtuse triangles (one angle greater than 90°), c² > a² + b². Those two inequalities are corollaries of the law of cosines, c² = a² + b² − 2ab·cos(C), which reduces to the Pythagorean theorem when the angle C is 90° because cos(90°) = 0. The law of cosines is the natural generalization of the Pythagorean theorem to triangles that aren't right-angled.
How is the Pythagorean theorem used in real life?
More places than people realize. Carpenters use the 3-4-5 trick to square corners. Surveyors and GPS systems use it to compute straight-line distances from coordinate differences. Television and monitor sizes are diagonal measurements derived from width and height via the theorem — a 16:9 screen with a 55-inch diagonal is 47.9 inches wide and 27.0 inches tall. Roof pitch calculations rely on it (the rafter is the hypotenuse of the run and rise). Navigation, robotics, computer graphics, image-processing algorithms, machine-learning distance metrics (Euclidean L² norm), and special relativity's spacetime interval all rest on the same a² + b² = c² scaffolding extended to higher dimensions and slightly more general geometries.
What is the converse of the Pythagorean theorem and why does it matter?
The converse says: if a triangle's three side lengths satisfy a² + b² = c², then the triangle must have a right angle opposite c. Euclid proved it in Elements Book I, Proposition 48 — immediately after the theorem itself. The converse is what makes the theorem a useful test in the wild: rather than measuring an angle directly, you measure three lengths and check the equation. That is exactly how a carpenter uses the 3-4-5 rule to verify a square corner without ever pulling out a protractor.
Why does the calculator say my triangle is impossible?
In leg mode you provided a hypotenuse c that was less than or equal to the known leg. The hypotenuse is by definition the longest side of a right triangle — opposite the largest angle, which is the 90° angle — so it must be strictly greater than either leg. If you typed c = 5 and a = 5, the second leg would have to be √(25 − 25) = 0, which is degenerate; if you typed c = 4 and a = 5, the equation demands the second leg be √(16 − 25) = √(−9), which is not a real number. Increase c until it exceeds both legs and the calculation will succeed.
How is the Pythagorean theorem extended to three dimensions?
It generalizes directly. The diagonal of a rectangular box with side lengths a, b, c is d = √(a² + b² + c²) — applying the planar theorem twice, first to find the diagonal of one face (√(a² + b²)) and then to combine that with the third edge. The same pattern continues into any number of dimensions: the distance between two points in n-dimensional space is the square root of the sum of the squared differences of their coordinates. That formula — the Euclidean norm — is one of the most-used computations in physics, statistics, and machine learning, and it is the Pythagorean theorem all the way down.

In this category

Embed

Quanta Pro

Paid features are coming later.

  • All 313 calculators remain free
  • No billing is enabled
Coming soon