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.
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 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.
| Goal | Formula | When to use it |
|---|---|---|
| Find hypotenuse c | c = √(a² + b²) | Both legs a and b are known |
| Find leg a | a = √(c² − b²) | Hypotenuse c and leg b are known |
| Find leg b | b = √(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.
Tip
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.
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.
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.
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.
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.
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.
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).
| Triple | Primitive? | Verify (a² + b²) | c² |
|---|---|---|---|
| (3, 4, 5) | ✓ Yes | 9 + 16 = 25 | 25 |
| (5, 12, 13) | ✓ Yes | 25 + 144 = 169 | 169 |
| (8, 15, 17) | ✓ Yes | 64 + 225 = 289 | 289 |
| (7, 24, 25) | ✓ Yes | 49 + 576 = 625 | 625 |
| (6, 8, 10) | ✗ No | 36 + 64 = 100 | 100 (= (3,4,5)×2) |
| (20, 21, 29) | ✓ Yes | 400 + 441 = 841 | 841 |
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
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.
Navigation and surveying
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
Triangle Calculator
Solve any triangle — right, acute, or obtuse — from SSS, SAS, ASA, AAS, or SSA inputs, with area, inradius, and circumradius output.
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.
| Mistake | Symptom | Correct approach |
|---|---|---|
| Using on a non-right triangle | Result does not satisfy a² + b² = c² | Verify right angle exists first |
| Misidentifying the hypotenuse | Answer is larger than the given longest side | Hypotenuse is always opposite the 90° angle |
| Adding when finding a leg | Leg result > hypotenuse | Use subtraction: a = √(c² − b²) |
| Rounding legs before squaring | Accumulated rounding error in final answer | Square first, then round the final result |
| Using for non-Euclidean geometry | Sphere / curved surface distances are wrong | Use 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
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.