Skip to content
Quasar Tools Logo

Pythagorean Theorem Solver and Formula Guide

The complete guide to the Pythagorean theorem: formula, proof, all three solving modes, Pythagorean triples, real-world applications, and a free online solver.

DH
Tutorials & How-Tos12 min read2,700 words

The Pythagorean theorem — a² + b² = c² — is the single most applied formula in geometry, used by architects, engineers, developers, and students every day to find the missing side of a right triangle. This guide explains the formula in full, walks through all three solving modes with worked examples, covers Pythagorean triples, and shows you how the free online Pythagorean theorem solver handles every case in under a second.

2,500+Years of useKnown since ~500 BCE
370+Distinct proofsMore than any other theorem
Pythagorean triplesInfinitely many integer solutions

What is the Pythagorean theorem?

The Pythagorean theorem states that in any right triangle, the area of the square drawn on the hypotenuse equals the combined area of the squares drawn on the two legs. Expressed algebraically: a² + b² = c², where c is the hypotenuse (the longest side, opposite the 90-degree angle) and a and b are the two shorter sides called the legs.

Why it only applies to right triangles

The equality a² + b² = c² holds precisely because the right angle creates a geometric relationship where the squares on the legs tile exactly into the square on the hypotenuse. Change the angle between the legs and this tiling breaks down. For an acute triangle, a² + b² is greater than c². For an obtuse triangle, a² + b² is less than c². This directional comparison is the basis of the converse theorem — and the reason you must confirm you are working with a right triangle before applying the formula.

A brief history

Babylonian clay tablets from around 1800 BCE contain numerical examples of right-triangle relationships — including the (3, 4, 5) triple — predating Pythagoras by over a millennium. Indian mathematician Baudhayana described the theorem in the Sulba Sutras around 800 BCE. Pythagoras (570–495 BCE) is credited with the first formal proof in the Western mathematical tradition. Today there are over 370 documented proofs, more than for any other theorem in mathematics. The proof by rearrangement, by similar triangles, and by algebraic identity are the most commonly taught in school curricula.

Note

The theorem is a special case of the **Law of Cosines**: c² = a² + b² − 2ab·cos(C). When the angle C is 90°, cos(90°) = 0, so the correction term drops out and you get a² + b² = c². This relationship links the Pythagorean theorem to all of trigonometry.

The formula explained

The formula a² + b² = c² has three components. Each letter represents the length of one side of a right triangle. Understanding which side is which is more important than memorising the letters themselves.

  • a — one leg of the right triangle (a shorter side)
  • b — the other leg of the right triangle (the other shorter side)
  • c — the hypotenuse (always the longest side, always opposite the right angle)
  • ² (squared) — multiply the value by itself: a² means a × a
  • √ (square root) — used when solving for a side: the inverse of squaring

The three derived solving formulas

The original equation a² + b² = c² can be rearranged algebraically to isolate any one of the three sides. Each rearrangement gives you a direct formula for computing that side from the other two known values.

GoalFormulaWhen to use it
Find hypotenuse cc = √(a² + b²)Both legs a and b are known
Find leg aa = √(c² − b²)Hypotenuse c and leg b are known
Find leg bb = √(c² − a²)Hypotenuse c and leg a are known

Worked example: all three modes

Consider a right triangle with legs a = 5 and b = 12. To find the hypotenuse: c = √(25 + 144) = √169 = 13. Now reverse: if c = 13 and b = 12, find a: a = √(169 − 144) = √25 = 5. If c = 13 and a = 5, find b: b = √(169 − 25) = √144 = 12. Each formula is just the original equation rearranged — not a separate rule to memorise.

The most common error is adding when you should subtract. Finding the hypotenuse uses addition inside the square root. Finding a missing leg uses subtraction.

Mathematical observation

Tip

A quick sanity check: the hypotenuse must always be **strictly longer** than either individual leg. If your calculated c is shorter than a or b, you have either swapped addition and subtraction or misidentified which side is the hypotenuse.

Solving for any missing side

The Pythagorean Theorem Calculator on Quasar Tools handles all three solving modes. You select which side is unknown, enter the two known values, and the calculator outputs the missing side with a full step-by-step breakdown. Here is how each mode works manually, with a second worked example for each.

1

Find the hypotenuse (find c)

Given legs a = 8 and b = 15: c = √(64 + 225) = √289 = 17. The (8, 15, 17) set is a Pythagorean triple. Verify: 64 + 225 = 289 = 17². All three steps — squaring, adding, and taking the square root — are shown in the calculator output.

2

Find a missing leg given the hypotenuse

Given c = 25 and b = 20: a = √(625 − 400) = √225 = 15. This is (15, 20, 25), a scalar multiple of the (3, 4, 5) triple scaled by 5. Note the subtraction inside the square root — you are reversing the equation to isolate the leg.

3

Verify the result by substitution

Always substitute all three values back into a² + b² = c². For the result above: 15² + 20² = 225 + 400 = 625 = 25². The equation balances, confirming the answer is correct. The Pythagorean Theorem Calculator performs this verification step automatically and displays it alongside the result.

4

Read the triangle angles

Once all three sides are known, the two non-right angles can be found using inverse trigonometry: angle A = arctan(a/b) and angle B = arctan(b/a). The calculator outputs both angles in degrees, allowing you to fully characterise the right triangle without a separate trigonometry calculator.

5

Check the nearby Pythagorean triples

If your inputs are close to a Pythagorean triple, the calculator lists the nearest triples — useful in construction and design where integer side lengths are preferred for dimensional coordination. Common triples to memorise: (3, 4, 5), (5, 12, 13), (8, 15, 17), (7, 24, 25), and (20, 21, 29).

Pythagorean Theorem Calculator

Solve for any missing side of a right triangle with step-by-step solution, triangle diagram, angle output, and nearby Pythagorean triples — free in your browser.

Open tool

Pythagorean triples

A Pythagorean triple is a set of three positive integers (a, b, c) that exactly satisfy a² + b² = c². These are not just convenient for calculation — they represent right triangles with all whole-number side lengths, which makes them uniquely useful for construction, tile design, and coordinate geometry.

Primitive vs derived triples

A primitive triple shares no common factor between all three sides. Every other triple is a scalar multiple of a primitive triple. The first five primitive triples are: (3, 4, 5), (5, 12, 13), (8, 15, 17), (7, 24, 25), and (20, 21, 29). Multiplying any primitive triple by an integer k produces a derived triple — for example, (3, 4, 5) × 2 = (6, 8, 10), × 3 = (9, 12, 15), × 5 = (15, 20, 25).

TriplePrimitive?Verify (a² + b²)
(3, 4, 5)✓ Yes9 + 16 = 2525
(5, 12, 13)✓ Yes25 + 144 = 169169
(8, 15, 17)✓ Yes64 + 225 = 289289
(7, 24, 25)✓ Yes49 + 576 = 625625
(6, 8, 10)✗ No36 + 64 = 100100 (= (3,4,5)×2)
(20, 21, 29)✓ Yes400 + 441 = 841841

Generating Pythagorean triples with Euclid's formula

Every primitive Pythagorean triple can be generated with Euclid's parametric formula: choose two positive integers m > n > 0 with no common factor and not both odd. Then a = m² − n², b = 2mn, c = m² + n². For m = 2, n = 1: a = 4 − 1 = 3, b = 2(2)(1) = 4, c = 4 + 1 = 5 → (3, 4, 5). For m = 3, n = 2: a = 9 − 4 = 5, b = 12, c = 13 → (5, 12, 13). This formula proves there are infinitely many Pythagorean triples.

Note

In construction, the (3, 4, 5) triple is called the **3-4-5 rule** and is used to verify right angles without a protractor. Measure 3 units along one wall from a corner, 4 units along the adjacent wall, and confirm the diagonal is exactly 5 units. Any multiple — 6-8-10, 9-12-15, 30-40-50 — works identically.

Real-world applications

The Pythagorean theorem is not a classroom abstraction. It appears in architecture, engineering, navigation, game development, and data science — anywhere a diagonal distance, a slope, or a missing side needs to be calculated precisely.

Construction and architecture

Builders use the theorem to square foundations, cut roof rafters, and calculate staircase stringers. A roof rafter problem is a classic application: if the horizontal run is 12 feet and the vertical rise is 5 feet, the rafter length (hypotenuse) is √(144 + 25) = √169 = 13 feet. The Area Calculator on Quasar Tools pairs with this calculation when you need the triangular surface area of a roof section alongside the rafter length.

Coordinate geometry and software

The distance formula in coordinate geometry — d = √((x₂ − x₁)² + (y₂ − y₁)²) — is a direct application of the Pythagorean theorem. The horizontal and vertical separations between two points are the legs; the straight-line distance is the hypotenuse. This formula underpins collision detection in game engines, nearest-neighbour search in machine learning, GPS routing algorithms, and any software system that calculates Euclidean distance. The Coordinate Distance Calculator automates this for arbitrary 2D and 3D point pairs.

Ships and aircraft use right-triangle decomposition to calculate direct distances from bearing and range data. A surveyor measuring the width of a river by triangulation applies the theorem to the measured baseline and angle. In GPS systems, the theorem extends to three dimensions — d = √(Δx² + Δy² + Δz²) — to calculate the precise distance from a receiver to each satellite in the constellation.

Physics and engineering

  • Vector magnitude: The length of a 2D vector (vx, vy) is |v| = √(vx² + vy²) — direct theorem application.
  • Structural engineering: Diagonal bracing length in a rectangular frame is calculated from height and width.
  • Electrical engineering: Impedance in AC circuits: Z = √(R² + X²), where R is resistance and X is reactance.
  • Computer graphics: Screen-space distance between pixels, ray-casting hit distances, and shadow length calculations.

Tip

For problems involving non-right triangles — for example, finding a side when you know two sides and the included angle — the [Triangle Calculator](/tools/math/calculators/triangle-calculator) uses the Law of Sines and Cosines to solve all triangle types from any combination of known sides and angles.

Triangle Calculator

Solve any triangle — right, acute, or obtuse — from SSS, SAS, ASA, AAS, or SSA inputs, with area, inradius, and circumradius output.

Open tool

Common mistakes and edge cases

The Pythagorean theorem is simple enough that the mistakes are predictable. Knowing them in advance prevents the frustrating experience of getting a wrong answer and not being able to see why.

Applying the formula to a non-right triangle

This is the most common error. If the triangle does not contain a 90-degree angle, a² + b² ≠ c² and the formula gives a wrong answer without any obvious warning. Always confirm the triangle has a right angle — either from the problem statement, a square corner mark in a diagram, or by verifying all three angles sum to 180° with one being 90°. If the triangle is not a right triangle, use the Triangle Calculator with the Law of Cosines instead.

Misidentifying the hypotenuse

The hypotenuse is always the longest side and always the side opposite the right angle. It is never one of the legs. A common mistake in geometry problems is treating the largest number given as a leg rather than the hypotenuse when solving for a missing leg. If you are given sides 5, 13, and need to find the third side, check whether 13 is the hypotenuse (c = 13, find leg a or b) or whether it is a leg (which would require a hypotenuse larger than 13).

Adding instead of subtracting when finding a leg

Finding the hypotenuse requires adding the squared legs: c² = a² + b². Finding a missing leg requires subtracting the known squared leg from the squared hypotenuse: a² = c² − b². A surprisingly common error is writing a = √(c² + b²) instead of a = √(c² − b²). If you accidentally add, your result will be larger than c — an immediate sign that something is wrong, since no leg can be longer than the hypotenuse.

MistakeSymptomCorrect approach
Using on a non-right triangleResult does not satisfy a² + b² = c²Verify right angle exists first
Misidentifying the hypotenuseAnswer is larger than the given longest sideHypotenuse is always opposite the 90° angle
Adding when finding a legLeg result > hypotenuseUse subtraction: a = √(c² − b²)
Rounding legs before squaringAccumulated rounding error in final answerSquare first, then round the final result
Using for non-Euclidean geometrySphere / curved surface distances are wrongUse spherical or geodesic distance formulas

Rounding intermediate values

Rounding a or b before squaring amplifies the error. If a = 4.123 and you round to 4.1 before squaring, your squared value is 16.81 instead of 17.0. That 0.19 error compounds when added to b². Always carry the full precision through squaring and addition, then round only the final square-root result to the required number of decimal places. The Pythagorean Theorem Calculator maintains full floating-point precision throughout and rounds only the displayed output.

Warning

The Pythagorean theorem assumes flat (Euclidean) geometry. On curved surfaces — like the Earth — straight-line distances do not follow a² + b² = c². GPS systems use spherical trigonometry and the Haversine formula for surface distances. Only use the theorem for flat 2D planes or 3D Cartesian coordinate spaces.

Key takeaways

  • The Pythagorean theorem states a² + b² = c² for any right triangle, where c is the hypotenuse (longest side, opposite the right angle) and a and b are the two legs.
  • Three solving modes: find hypotenuse with c = √(a² + b²), find a missing leg with a = √(c² − b²) or b = √(c² − a²) — finding a leg uses subtraction, not addition.
  • Always verify your result by substituting all three values back into a² + b² = c² — the equation must balance for the answer to be correct.
  • Pythagorean triples are integer solutions: (3, 4, 5), (5, 12, 13), (8, 15, 17). The 3-4-5 rule lets builders verify right angles by measuring sides instead of angles.
  • The distance formula d = √((x₂−x₁)² + (y₂−y₁)²) is a direct application — used in coordinate geometry, game engines, GPS, and the Coordinate Distance Calculator.
  • The theorem only applies to right triangles on flat surfaces — for non-right triangles, use the Triangle Calculator with the Law of Cosines.
  • Use the free Pythagorean Theorem Calculator for step-by-step solutions, angle output, and automatic Pythagorean triple identification.

Frequently Asked Questions

The Pythagorean theorem states that in any right triangle, the square of the hypotenuse equals the sum of the squares of the two legs: a² + b² = c². The hypotenuse c is always the longest side, sitting opposite the 90-degree angle. The two shorter sides are the legs, labelled a and b. The theorem applies exclusively to right triangles — it does not hold for any other triangle type. For non-right triangles, the Law of Cosines (c² = a² + b² − 2ab·cos(C)) is the generalisation.

Square both legs, add the results, then take the square root: c = √(a² + b²). For a triangle with legs a = 6 and b = 8: c = √(36 + 64) = √100 = 10. The hypotenuse is always the result of this formula and is always longer than either leg. Use the Pythagorean Theorem Calculator at /tools/math/calculators/pythagorean-theorem-calculator to get a step-by-step breakdown including the squared values, addition, and final square root.

Rearrange the formula to isolate the unknown leg. To find leg a given b and c: a = √(c² − b²). To find leg b given a and c: b = √(c² − a²). The hypotenuse must be larger than either leg for the subtraction to produce a positive result. Example: if c = 13 and b = 5: a = √(169 − 25) = √144 = 12. Finding a leg uses subtraction; finding the hypotenuse uses addition — the direction of the formula flips depending on which side you are solving for.

A Pythagorean triple is a set of three positive integers (a, b, c) satisfying a² + b² = c² exactly. The most well-known is (3, 4, 5): 9 + 16 = 25. A primitive triple has no common factor — (3, 4, 5) is primitive, while (6, 8, 10) is not because it is (3, 4, 5) scaled by 2. Other common primitive triples are (5, 12, 13), (8, 15, 17), (7, 24, 25), and (20, 21, 29). The Pythagorean Theorem Calculator on Quasar Tools lists nearby triples automatically for every result.

Yes. The 3D extension gives the space diagonal of a rectangular box: d = √(a² + b² + c²). This is derived by applying the theorem twice — once to find the base diagonal, then again using that diagonal and the third dimension as the two legs. This formula appears in engineering when calculating the longest diagonal of a room, the 3D distance between two coordinate points, or the clearance diagonal of a shipping container. Use the Coordinate Distance Calculator at /tools/math/calculators/coordinate-distance-calculator for 3D point-to-point distances.

The converse states that if a triangle has sides a, b, and c where a² + b² = c², then the triangle must contain a right angle. This lets you verify right angles by measuring sides rather than angles — which is invaluable in construction. The 3-4-5 rule applies this directly: measure 3 units along one wall from a corner and 4 units along the adjacent wall; if the diagonal is exactly 5 units, the corner is a perfect right angle. Any whole-number multiple works — 6-8-10, 9-12-15, 15-20-25 all verify a right angle by the same principle.

Not directly — a² + b² = c² holds only when one angle is exactly 90°. For non-right triangles, use the Law of Cosines: c² = a² + b² − 2ab·cos(C), where C is the angle opposite side c. The Pythagorean theorem is a special case of this formula when C = 90°, because cos(90°) = 0 and the correction term disappears. Use the Triangle Calculator at /tools/math/calculators/triangle-calculator to solve any triangle type from any combination of known sides and angles.

Three errors come up repeatedly. First, applying the formula to a non-right triangle — the theorem only holds when one angle is exactly 90 degrees, so always verify you have a right triangle before using it. Second, misidentifying the hypotenuse — it is always the longest side and always sits opposite the right angle. Third, adding instead of subtracting when solving for a missing leg — finding a leg requires c² − b² (subtraction), not c² + b² (addition). Always verify by substituting all three values back into a² + b² = c².

ShareXLinkedIn

Related articles