Pythagorean Theorem Calculator
Calculate any side of a right triangle using the Pythagorean theorem (a² + b² = c²). Find hypotenuse or a leg. Instant math results, no signup needed.
The Pythagorean Theorem Explained
The Pythagorean theorem states that in any right triangle, the square of the length of the hypotenuse (the side opposite the right angle) equals the sum of the squares of the other two sides: a² + b² = c². Here, c is always the hypotenuse — the longest side of the right triangle — while a and b are the two legs.
To find the hypotenuse given both legs: c = √(a² + b²). To find a missing leg given the hypotenuse and the other leg: a = √(c² − b²). Example: a ladder leans against a wall, reaching 12 feet high, with its base 5 feet from the wall. The ladder's length is c = √(5² + 12²) = √(25 + 144) = √169 = 13 feet.
This theorem, known for over 4,000 years, is one of the most universally applicable results in all of mathematics. It connects algebra and geometry, enables distance calculation in any number of dimensions, and appears in physics, engineering, computer graphics, and navigation. Despite its age, it continues to surprise with its wide-ranging connections to modern mathematics.
Pythagorean Triples: Whole-Number Solutions
A Pythagorean triple is a set of three positive integers (a, b, c) satisfying a² + b² = c². The most famous is (3, 4, 5): 9 + 16 = 25. ✓ Any multiple of a triple is also a triple: (6, 8, 10), (9, 12, 15), etc.
| Triple (a, b, c) | Verification | Notes |
|---|---|---|
| (3, 4, 5) | 9 + 16 = 25 ✓ | Most fundamental triple |
| (5, 12, 13) | 25 + 144 = 169 ✓ | Primitive triple |
| (8, 15, 17) | 64 + 225 = 289 ✓ | Primitive triple |
| (7, 24, 25) | 49 + 576 = 625 ✓ | Primitive triple |
| (20, 21, 29) | 400 + 441 = 841 ✓ | Primitive triple |
| (9, 40, 41) | 81 + 1600 = 1681 ✓ | Primitive triple |
| (6, 8, 10) | 36 + 64 = 100 ✓ | 2 × (3,4,5) |
| (10, 24, 26) | 100 + 576 = 676 ✓ | 2 × (5,12,13) |
Euclid's formula generates all primitive Pythagorean triples: for integers m > n > 0 where m and n are coprime and not both odd: a = m² − n², b = 2mn, c = m² + n². For m=2, n=1: a=3, b=4, c=5. For m=3, n=2: a=5, b=12, c=13. This formula proves there are infinitely many Pythagorean triples.
Proofs of the Pythagorean Theorem
The Pythagorean theorem has over 370 documented proofs — more than any other theorem in mathematics. Here are the most elegant:
The Rearrangement Proof: Draw a square with side (a+b). Inside, arrange four congruent right triangles (each with legs a and b and hypotenuse c) to form a smaller tilted square. The area of the large square is (a+b)². The four triangles have total area 4 × (ab/2) = 2ab. The inner square has area c². So (a+b)² = 2ab + c² → a² + 2ab + b² = 2ab + c² → a² + b² = c².
The Similar Triangles Proof: In a right triangle ABC with right angle at C, draw the altitude from C to the hypotenuse AB, creating two smaller triangles. Each smaller triangle is similar to the original. From the similar ratios, AC² = AB × AD and BC² = AB × DB. Adding: AC² + BC² = AB(AD + DB) = AB × AB = AB². Therefore a² + b² = c².
President Garfield's Trapezoid Proof (1876): Arrange two congruent right triangles (legs a, b) to form a trapezoid with a third triangle on top. Area of trapezoid = ½(a+b)(a+b) = ½(a+b)². Sum of three triangle areas = ½ab + ½ab + ½c² = ab + ½c². Setting equal: ½(a+b)² = ab + ½c² → a² + b² = c².
Einstein's Boyhood Proof: Young Einstein used the similarity proof above, reportedly discovering it independently around age 12. He later cited this experience as pivotal in developing his mathematical intuition.
Practical Applications in Construction and Engineering
The 3-4-5 Square Check: Construction workers use the 3-4-5 rule constantly to verify right angles. Measure 3 feet along one wall from a corner, 4 feet along the adjacent wall, and the diagonal should be exactly 5 feet. If not, the corner is not square. This works with any multiple: 6-8-10, 9-12-15, etc. Carpenters use this rule when laying foundations, installing decks, and framing walls.
Stair Calculations: To find the length of a stair stringer (the diagonal support), use the theorem. If the total rise (vertical height) is 8 feet and the total run (horizontal distance) is 12 feet, the stringer length is √(8² + 12²) = √(64 + 144) = √208 ≈ 14.4 feet.
Diagonal Bracing: Structural engineers use the theorem to calculate the length of diagonal braces in frames and trusses. A rectangular frame 8m wide by 6m tall needs diagonal braces of length √(8² + 6²) = √(64 + 36) = √100 = 10m — a classic 3-4-5 triple scaled by 2.
GPS and Navigation: Your GPS calculates straight-line distances using an extended form of the theorem. Distance in 3D space: d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²). For nearby locations on Earth's surface, the 2D formula suffices; for long distances, the spherical geometry version (haversine formula) is used instead.
The Pythagorean Theorem in Physics and Science
Vector Addition: When two perpendicular forces act on an object, the resultant magnitude is found using the theorem. A boat traveling east at 8 m/s in a current flowing north at 6 m/s has a resultant speed of √(8² + 6²) = √100 = 10 m/s at an angle of arctan(6/8) ≈ 36.9° north of east.
Special Relativity: Einstein's spacetime interval uses a modified Pythagorean-like formula: Δs² = (cΔt)² − Δx² − Δy² − Δz² (with a minus sign instead of plus for time). This spacetime distance is invariant — all observers agree on it despite disagreeing on the individual space and time measurements.
Trigonometry Foundation: The unit circle definition of sine and cosine is directly based on the Pythagorean theorem. For any angle θ: sin²(θ) + cos²(θ) = 1. This fundamental identity — often called the Pythagorean identity — is the basis for all of trigonometry and countless physics formulas involving oscillations, waves, and rotations.
Quantum Mechanics: The Pythagorean theorem extends to complex vector spaces in quantum mechanics. The probability amplitudes of quantum states satisfy a generalized norm condition equivalent to a² + b² = c² in Hilbert space. The theorem's essence — that "length squared" decomposes into component squares — pervades the entire mathematical structure of quantum theory.
Distance Formula and Coordinate Geometry
The distance formula in 2D coordinate geometry is a direct application of the Pythagorean theorem. The distance between points (x₁, y₁) and (x₂, y₂) is d = √((x₂−x₁)² + (y₂−y₁)²). This follows because the horizontal and vertical differences (x₂−x₁) and (y₂−y₁) form the legs of a right triangle whose hypotenuse is d.
This extends naturally to three dimensions: d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²), and to n dimensions: d = √(Σᵢ(xᵢ−yᵢ)²). This Euclidean distance formula underlies algorithms throughout computer science and machine learning:
- K-nearest neighbors: Finds the k closest data points by Euclidean distance.
- K-means clustering: Assigns each data point to the nearest cluster center.
- Computer vision: Pixel-level distance metrics for image comparison.
- GPS routing: Approximates straight-line distances between waypoints.
| Dimension | Distance Formula | Application |
|---|---|---|
| 1D | d = |x₂ − x₁| | Number line distance |
| 2D | d = √((Δx)² + (Δy)²) | Map/coordinate distance |
| 3D | d = √((Δx)² + (Δy)² + (Δz)²) | 3D modeling, GPS altitude |
| nD | d = √(Σ(Δxᵢ)²) | Machine learning, data science |
Historical Background and Babylonian Origins
The Pythagorean theorem predates Pythagoras of Samos (c. 570–495 BCE) by over a millennium. The Babylonian clay tablet Plimpton 322 (circa 1800 BCE) lists 15 Pythagorean triples with remarkable numerical precision, including large triples like (119, 120, 169) and (4601, 4800, 6649). This indicates the Babylonians not only knew the theorem but used systematic methods to generate triples.
Ancient Egyptian "rope stretchers" (harpedonaptai) used ropes with knots at the 3-4-5 positions to create right angles for construction. This technique may have been used in building the pyramids, though direct evidence is limited. The Rhind Mathematical Papyrus (c. 1650 BCE) contains problems that implicitly use right triangle relationships.
In ancient India, the Sulbasutras (c. 800–200 BCE) contain explicit statements of the theorem along with methods for constructing right angles for ritual altar building. The statement "the diagonal of a rectangle produces as much as is produced by its side and the other side together" directly expresses a² + b² = c².
Despite this history, Pythagoras (or his school) is credited with the first rigorous proof of the theorem, moving it from empirical knowledge to demonstrated mathematical truth. This distinction between knowing a result and proving it is the defining characteristic of mathematics.
Frequently Asked Questions
What is a Pythagorean triple?
A set of three positive integers (a, b, c) where a² + b² = c². Examples: (3,4,5), (5,12,13), (8,15,17). A "primitive" triple has no common factor. Euclid's formula a = m²−n², b = 2mn, c = m²+n² generates all primitive triples for coprime m > n > 0.
Does the Pythagorean theorem work for non-right triangles?
No. a² + b² = c² applies only to right triangles. For other triangles, the Law of Cosines generalizes it: c² = a² + b² − 2ab·cos(C). When C = 90°, cos(90°) = 0 and we recover a² + b² = c².
How do I know if three sides form a right triangle?
Test whether a² + b² = c² where c is the longest side. For sides 5, 12, 13: 5² + 12² = 25 + 144 = 169 = 13². Yes, it's a right triangle. ✓ For sides 4, 5, 6: 4² + 5² = 16 + 25 = 41 ≠ 36 = 6². Not a right triangle. ✗
How many proofs of the theorem exist?
Over 370 documented proofs, making it the most-proved theorem in mathematics. Proofs come from diverse methods: algebraic, geometric, trigonometric, and even from the US President James Garfield in 1876. The sheer variety of proofs reflects the theorem's deep connections throughout mathematics.
What is the hypotenuse of a right triangle with both legs equal to 1?
c = √(1² + 1²) = √2 ≈ 1.4142. This is the diagonal of a unit square. The Pythagorean school famously discovered that √2 is irrational — it cannot be expressed as a fraction of integers — a result that reportedly shocked and disturbed them philosophically.
Is the Pythagorean theorem true in non-Euclidean geometry?
Not exactly. On a sphere (positive curvature) or hyperbolic plane (negative curvature), the theorem is modified. On a sphere, for a right triangle with legs a and b and hypotenuse c (all measured as angles): cos(c) = cos(a)·cos(b). For small triangles, this approximates the flat Euclidean theorem.
How is the theorem used in computer graphics?
For collision detection, distance calculations, normalization of vectors (dividing by their magnitude, which uses √(x²+y²+z²)), raycasting, and rendering. Every 3D game uses Pythagorean distance calculations millions of times per second to position objects, check collisions, and compute lighting angles.
What is the 3-4-5 rule in construction?
The 3-4-5 rule verifies right angles in construction. From a corner, measure 3 units along one wall and 4 units along the other. If the diagonal between these two points is exactly 5 units, the angle is 90°. Any multiple works: 6-8-10, 9-12-15, etc. Carpenters use tape measures and this rule to square foundations and frames.
Who discovered the Pythagorean theorem?
The result was known long before Pythagoras — Babylonian tablets from 1800 BCE list dozens of Pythagorean triples. Ancient Indian and Egyptian mathematicians also used it. Pythagoras (or his school, c. 570–495 BCE) is traditionally credited with the first rigorous mathematical proof.
Does the Pythagorean theorem work in 3D?
Yes, extended to 3D: the space diagonal of a rectangular box with dimensions a, b, c is d = √(a² + b² + c²). This follows from applying the theorem twice: first find the base diagonal √(a²+b²), then apply again using that as a leg and c as the other leg.
Trigonometry and the Unit Circle
The Pythagorean theorem is the direct foundation of trigonometry. On the unit circle (radius = 1), any point on the circle has coordinates (cos θ, sin θ) where θ is the angle from the positive x-axis. Since this point is at distance 1 from the origin: cos²θ + sin²θ = 1². This is the fundamental Pythagorean identity.
From sin²θ + cos²θ = 1, dividing by cos²θ gives tan²θ + 1 = sec²θ, and dividing by sin²θ gives 1 + cot²θ = csc²θ. These three identities (together called the Pythagorean trigonometric identities) are used constantly in calculus, physics, and engineering to simplify expressions and solve equations.
The inverse trigonometric functions (arcsin, arccos, arctan) let us find angles from side ratios. In a right triangle with legs 3 and 4: tan θ = 3/4, so θ = arctan(3/4) ≈ 36.87°. The angle at the other leg: 90° − 36.87° = 53.13°. These calculations are essential for determining slopes, ramp angles, bearing headings in navigation, and joint angles in robotics.
Special Right Triangles: 45-45-90 and 30-60-90
Two special right triangles appear constantly in geometry, trigonometry, and architecture. Their side ratios are fixed and should be memorized for speed on exams and in practical applications.
45-45-90 triangle (isosceles right triangle): legs are equal, hypotenuse = leg × √2. If leg = 1: hypotenuse = √2 ≈ 1.414. This triangle appears when you cut a square diagonally. A square room 4m × 4m has a diagonal of 4√2 ≈ 5.657m. The 45° angle is the most common "diagonal cut" angle in carpentry and design.
30-60-90 triangle: sides are in ratio 1 : √3 : 2. The short leg is opposite the 30° angle, long leg is opposite 60°, hypotenuse is opposite 90°. If the short leg = 1: long leg = √3 ≈ 1.732, hypotenuse = 2. This triangle appears in equilateral triangles cut in half, and in hexagonal structures (beehives, carbon nanotubes, urban grid planning).
| Triangle Type | Angles | Side Ratios | Example (leg=5) |
|---|---|---|---|
| 45-45-90 | 45°, 45°, 90° | 1 : 1 : √2 | 5, 5, 5√2 ≈ 7.07 |
| 30-60-90 | 30°, 60°, 90° | 1 : √3 : 2 | 5, 5√3 ≈ 8.66, 10 |
| 3-4-5 | ~36.87°, ~53.13°, 90° | 3 : 4 : 5 | 3, 4, 5 |
| 5-12-13 | ~22.62°, ~67.38°, 90° | 5 : 12 : 13 | 5, 12, 13 |
Recognizing these special triangles instantly saves enormous calculation time. When you see a 45° angle in a right triangle, you know the legs are equal and hypotenuse = leg√2. When you see a 60° angle, you know the sides follow the 1:√3:2 ratio. These shortcuts are used constantly in geometry proofs, trigonometry problems, and practical construction.
Using This Pythagorean Theorem Calculator
Enter the two known side lengths of a right triangle. If you enter both legs (a and b), the calculator computes the hypotenuse c = √(a²+b²). Sides must be positive numbers. The result includes the exact value and decimal approximation. For educational use, verify manually: square both inputs, add, take the square root. Common errors include entering the hypotenuse as a leg — remember c is always the longest side (opposite the right angle). This calculator also accepts decimal and fractional inputs, making it suitable for precision engineering calculations as well as classroom exercises and homework problems across geometry and trigonometry courses.