Pythagorean Theorem Calculator
Result
Missing side
- Area
- 6.00 cm²
- Perimeter
- 12.00 cm
A Pythagorean theorem calculator solves a right triangle from any two of its three sides. Fill in two of the three boxes and the third comes back, along with the area and the perimeter of the triangle. The relation behind it is short: in a right triangle, the squares on the two shorter sides add up to the square on the longest one, which is the side opposite the right angle and is called the hypotenuse. Written as a formula, the two legs squared and added give the hypotenuse squared. That single line contains three solvers. Give the two legs and you add and take a square root to get the hypotenuse. Give the hypotenuse and one leg and you subtract and take a square root to get the other leg. The two directions differ by one sign, and telling them apart is most of what this page does for you. Two of the three boxes must be filled, and that is a real rule rather than a formality: the three sides are not independent, so filling all three either repeats what the theorem already says or contradicts it, and filling only one leaves the shape undetermined. The area and the perimeter come along because they are nearly free once the triangle is complete, and because they are often what the measurement was wanted for in the first place. The theorem is much older than its usual name. The reference entry below notes that the relation was already in use in Babylonian calculations more than a millennium before Pythagoras, on a tablet whose arithmetic depends on it, and that it appears in early Indian altar-construction texts and in Chinese mathematical works as well. The Chinese text known as the Zhoubi Suanjing preserves a dissection argument for it, in which pieces arranged around a central square establish the relationship between the squares on the three sides. What is described today as the Pythagorean theorem is therefore a statement that several civilisations reached, not one person's discovery, and the first recorded proof is Euclid's rather than Pythagoras's. Three things about the answers are worth knowing before you use them. The missing side is almost always an irrational number. Whole-number right triangles exist — three and four giving five is the smallest of them — and they are the exception, so the two decimal places on screen are where the digits stop rather than where the number does. Everything is reported in centimetres and square centimetres whatever units the dropdowns are set to, and on this page the conversion happens before the solving rather than after, which matters because squaring is not linear: a three-four-five triangle entered in inches is no longer three-four-five in centimetres. And the page solves for a side and stops there. It does not tell you whether the sides you have form a whole-number triple, whether the triangle is isosceles or in any other special family, or whether the angle opposite a side is acute or obtuse.
Right triangles solved from each pair of starting sides
| Given | Leg a (cm) | Leg b (cm) | Hypotenuse (cm) | Area (cm²) | Perimeter (cm) |
|---|---|---|---|---|---|
| a, b | 3 | 4 | 5 | 6 | 12 |
| a, b | 5 | 12 | 13 | 30 | 30 |
| a, b | 8 | 15 | 17 | 60 | 40 |
| a, c | 6 | 8 | 10 | 24 | 24 |
| b, c | 5 | 12 | 13 | 30 | 30 |
| a, b | 1 | 1 | 1.41 | 0.5 | 3.41 |
| a, b | 0.5 | 1.2 | 1.3 | 0.3 | 3 |
| a, c | 9 | 12 | 15 | 54 | 36 |
Eight triangles, and the first column names the two sides each row starts from — a, b for two legs, a, c or b, c for a leg with the hypotenuse. That column is there because all three sides are printed once the triangle is solved, so without it you could not tell which one was the answer. The first row is the input the page loads with, the smallest whole-number right triangle, and the second is the next one up. Rows two and five are the same triangle reached two different ways: the five-twelve-thirteen solved from its two legs, and then from a leg and the hypotenuse, and they agree on every column, which is the page checking itself across both branches of the arithmetic. The fourth row is the subtraction branch too, six and ten giving eight, and it is the three-four-five triangle doubled. Rows one and eight are also the same triangle at different scales — nine, twelve and fifteen is three-four-five with every side tripled, so its area is nine times as large and its perimeter three times. Rows two and seven show the same scaling going the other way: half, one point two and one point three is five-twelve-thirteen divided by ten, which is why the decimals there are exact rather than rounded. The third row is another whole-number triple, eight-fifteen-seventeen, and the sixth is the isosceles case where the hypotenuse is the square root of two and the two decimals shown are an approximation. Every number here is recomputed from the two starting sides when the page is built, and all of them are in centimetres.
Formula
a² + b² = c² c = √(a² + b²) a = √(c² − b²) b = √(c² − a²) Area = ab ÷ 2 Perimeter = a + b + c
- a
- One of the two legs, the sides that meet at the right angle. Either leg may be called a, so the two leg boxes are interchangeable — swapping the numbers between them changes nothing about the answer
- b
- The other leg. Which of the two legs you fill in and which you leave blank makes no difference to the triangle; the box labelled b is just the one you did not use for a
- c
- The hypotenuse, the side opposite the right angle and the longest of the three. It is the one box where a mistake is easy to make, because it looks like any other side box — if the page says the hypotenuse must be longer than the leg you gave it, the two numbers have been swapped
- Missing side
- The one side you left blank, worked out from the other two and shown first because it is the question you asked. Note that it may be either a leg or the hypotenuse, depending on which box you left empty
- Area
- Half the product of the two legs, in square centimetres. It uses the legs only: the hypotenuse never enters the area of a right triangle, which is a useful thing to remember when checking one
- Perimeter
- The three sides added together, in centimetres. It is computed from the unrounded lengths, so adding the two printed numbers you typed to the printed missing side can differ from it in the last digit
- Two decimal places
- How wide the three outputs are written. A side that comes out of a square root is irrational unless the triangle happens to be a whole-number triple, so for most inputs the two digits are a cut rather than an ending
It is the right page whenever a right angle is involved and one length is missing. A ladder against a wall, where the two sides you can measure are the wall and the ground and the ladder is the hypotenuse. A rectangular field, where the diagonal is needed for a fence and the two sides are already known. A roof, where the rise and the run are known and the length of the rafter is not. A screen, where the diagonal is quoted and the two sides are not. Anything at all that can be reduced to a rectangle and its diagonal is a job for this page. It is also the page to reach for when checking a distance worked out on a coordinate grid: the horizontal and vertical steps between two points are the legs, and the straight-line distance between them is the hypotenuse, which is why the distance page in this same subcategory and this one carry the same arithmetic in two different costumes. Two habits make the answer easy to trust. The hypotenuse is always the longest side, so a missing side that comes out longer than the hypotenuse you entered is a sign that the two boxes were filled the wrong way round. And the missing side is always shorter than the sum of the other two, because a straight line between two points is shorter than any path that goes round by way of a third; a result that breaks either bound is wrong regardless of how the arithmetic looks. When you have all three legs, the area is worth a glance as a sanity check — a triangle with legs of three and four covers six square units, and one that covers sixty has a decimal point in the wrong place.
Worked examples
Legs of three and four
- The hypotenuse is missing, so add: 3² + 4² = 9 + 16 = 25
- Take the square root: √25 = 5
- Area: (3 × 4) ÷ 2 = 6
- Perimeter: 3 + 4 + 5 = 12
The input the page loads with and the smallest right triangle whose three sides are all whole numbers. Every figure here is exact, which makes it the calibration case: three, four, five, an area of six and a perimeter of twelve, with nothing rounded anywhere. If a reader remembers one right triangle it should be this one, because it is the quickest way to check any other answer in the same units — nine plus sixteen is twenty-five, and a result that does not reduce to that has gone wrong somewhere.
Legs of five and twelve
- Hypotenuse: 25 + 144 = 169
- Square root: √169 = 13
- Area: (5 × 12) ÷ 2 = 30
- Perimeter: 5 + 12 + 13 = 30
The next whole-number triple up, and a coincidence worth noticing rather than mistaking for an error: the area and the perimeter are both thirty. That is a property of this particular triangle and not a rule, and it is easy to prove to yourself that it is not one — the three-four-five triangle above has an area of six and a perimeter of twelve, which are not equal. The area of a right triangle is half the product of the legs while the perimeter is their sum, and the two coincide only when the legs happen to satisfy one particular equation.
A leg and the hypotenuse, with the leg missing
- The missing side is a leg, so subtract: 10² − 6² = 100 − 36 = 64
- Take the square root: √64 = 8
- Area: (6 × 8) ÷ 2 = 24
- Perimeter: 6 + 8 + 10 = 24
The direction that uses subtraction, and the one that catches people out because the two operations differ by nothing more than a sign. It is the three-four-five triangle doubled, which is why the area and the perimeter land on the same number again — doubling every side quadruples the area and doubles the perimeter, and here the two cross. Reading the answer off the page, the missing side of 8 is shorter than the hypotenuse of 10 and longer than the leg of 6, which is exactly where it should sit.
The other leg, from a different pair
- The missing side is a leg, so subtract: 169 − 144 = 25
- Square root: √25 = 5
- Area: (5 × 12) ÷ 2 = 30
- Perimeter: 5 + 12 + 13 = 30
The same triangle as the second example reached from a different pair of boxes, and the page's own check on itself. The five-twelve-thirteen triangle can be solved either from its two legs, which is the second example, or from a leg and the hypotenuse, which is this one, and both routes have to produce the same three sides. Note that the box left blank here is a different one — the answer is a leg again, but it is leg a rather than leg b, and the numbers in the two entry boxes have been swapped relative to the example above.
Both legs the same
- Hypotenuse: 1 + 1 = 2
- Square root: √2 = 1.4142135…, which rounds to 1.41
- Area: (1 × 1) ÷ 2 = 0.5
- Perimeter: 1 + 1 + 1.41421 = 3.41421…, which rounds to 3.41
The smallest isosceles right triangle, and the standard demonstration that the answer is usually not a whole number. The hypotenuse of a square of side one is the square root of two, a number that never terminates and never repeats, and no whole-number triangle has a side ratio of one to one to root two — which is precisely why the theorem's answers have to be rounded. The perimeter is the interesting figure here: it is the only output that depends on the unrounded hypotenuse, and adding the two printed numbers to the printed 1.41 yourself gives the same value on this input, though not on every input.
Legs of half and one point two
- Hypotenuse: 0.25 + 1.44 = 1.69
- Square root: √1.69 = 1.3
- Area: (0.5 × 1.2) ÷ 2 = 0.3
- Perimeter: 0.5 + 1.2 + 1.3 = 3
A whole-number triple in disguise: half, one point two and one point three is the five-twelve-thirteen triangle with every side divided by ten, so it is exact rather than rounded despite the decimals. Triples scale, which means there are infinitely many of them and also that a right triangle with awkward-looking decimal sides can still come out clean. It also makes the point that a decimal answer is not the same thing as a rounded one — this 1.3 is exact and the 1.41 in the example above is not, and the page has no way to tell you which you are looking at.
Limitations
The page solves for a side and gives you the area and the perimeter. It does not tell you whether the sides form a whole-number triple, whether the triangle is isosceles, or anything else about what kind of triangle it is, and that is a decision rather than an omission. The question of whether a set of sides is a Pythagorean triple cannot be answered reliably from inside this page, because the numbers the solver receives have already been converted to centimetres: sides of three and four inches arrive as 7.62 and 10.16, and whether the original three-four-five was a whole-number triple is information that the conversion has already thrown away. A judgement that changed its answer depending on which unit the user selected would be worse than no judgement at all, so the page keeps quiet and a separate tool is the right place for it. Everything is reported in centimetres and square centimetres whatever the dropdowns say, and the conversion happens before the triangle is solved rather than after. Squaring is not linear, so this is not the same as solving in the original unit and converting the answer, and a whole-number triple typed in inches will not produce whole-number centimetres. The missing side comes out of a square root and is irrational for almost every input, so two decimal places is a cut rather than a complete answer, though the inputs themselves may be exact. The perimeter and the area are computed from the unrounded lengths, so reconstructing them from the printed numbers on screen can differ in the last digit. Exactly two of the three boxes must be filled: filling one is refused because the shape is not determined, and filling all three is refused because the three sides constrain one another and a set that disagrees describes no triangle at all. A side of zero is not accepted, unlike the radius on the circle page next door — a triangle with a zero-length side does not exist, and its area and perimeter would both be meaningless. The hypotenuse must be strictly longer than whichever leg is given with it, and when it is not, the page asks you to swap the two numbers rather than reporting an error code; that message means the two boxes were filled the wrong way round, which is the most common mistake this shape invites. Finally, this is a plane triangle with a right angle in it, so oblique triangles, and triangles drawn on a sphere, are outside what the theorem says.
Frequently asked questions
- Which two boxes do I fill in?
- Any two of the three. The two legs, or one leg and the hypotenuse — both work, and the page works out which case it is by seeing which box you left empty. What it will not accept is one box on its own or all three together. A single side does not determine a right triangle, so there would be nothing to solve, and all three over-determine it, since any two sides already fix the third and a set that disagrees has no triangle behind it.
- How do I know whether to add or subtract?
- It depends on which box you left blank. If the hypotenuse is the missing one, you add the squares of the two legs and take the square root. If a leg is missing, you subtract the square of the known leg from the square of the hypotenuse and take the square root of what is left. The page decides for you from the shape of the input, which is the main reason to use it rather than a calculator: the two cases differ by one sign, and mixing them up is the standard way to get a wrong answer that looks perfectly plausible.
- The page says the hypotenuse must be longer than the leg. What did I do wrong?
- The two numbers are in the wrong boxes. The hypotenuse is the side opposite the right angle and it is always the longest of the three, so it can never be shorter than a leg or equal to one. Swapping the two values will fix it. This is the most common mistake on this page because both boxes look alike — nothing on a plain text field says which one is meant to hold the long side, and a triangle with sides of 5, 5 and 3 does not exist.
- Why does the missing side have decimals when I typed whole numbers?
- Because the square root of a whole number is usually not a whole number. Whole-number right triangles — three-four-five, five-twelve-thirteen, eight-fifteen-seventeen — are real and infinite in number, but they are a small minority of all the right triangles there are. For anything else the missing side is an irrational number and the two decimal places shown are where it has been cut. An answer of 7.62 is an approximation; an answer of 8 is exact.
- Does the page tell me if my triangle is a 3-4-5?
- No, and it deliberately does not try. By the time the arithmetic runs, the lengths have been converted into centimetres, so a triangle entered as three and four inches reaches the solver as 7.62 and 10.16 — the information about whether the original sides were whole numbers is gone before the question could be asked. A check that gave different answers depending on which unit was selected would be worse than no check, so the page solves for the side and leaves the classification to a separate tool.
- Is the area the same as the perimeter?
- Only by coincidence, and the page's own table contains one such coincidence: a five-twelve-thirteen triangle has an area of thirty square centimetres and a perimeter of thirty centimetres. The two are different kinds of quantity and the equality is in the digits only. The area of a right triangle is half the product of the legs, the perimeter is the sum of all three sides, and they happen to coincide for this triangle and a handful of others. The three-four-five triangle two rows up has an area of six against a perimeter of twelve.
- Can one of the sides be zero?
- No. A triangle with a side of zero length is not a triangle — the three points would be collinear or coincident, and both the area and the perimeter would lose their meaning. This is a genuine difference from the circle page in the same subcategory, where a radius of zero is a legitimate input describing a circle shrunk to a point. A side of zero is refused here at the field itself, and a negative length is refused in the same way.
References
- Pythagorean theorem — the relation between the legs and the hypotenuse of a right triangle, with the history the introduction draws on: use in Babylonian calculations more than a millennium before Pythagoras, early Indian and Chinese sources, and the Zhoubi Suanjing dissection argument in which pieces around a central square establish the relation between the three side squares (Dauben 2007, Maor 2007) — Wolfram MathWorld (United States)
- Pythagorean triple — the whole-number side sets such as 3, 4, 5 that the page produces but deliberately does not identify, and the reason they are the exception rather than the rule — Wolfram MathWorld (United States)
- Right triangle — the shape the page solves, with the hypotenuse defined as the side opposite the right angle and therefore the longest of the three — Wolfram MathWorld (United States)
- 教育部关于印发义务教育课程方案和课程标准(2022 年版)的通知——The fifth item in the annex list of this notice is the Mathematics Curriculum Standards for Compulsory Education (2022 edition); the Pythagorean theorem and its converse are part of the compulsory-education mathematics curriculum, and the wording of the standards and the grade-band breakdown are governed by that annex — 中华人民共和国教育部