The Pythagorean Theorem
The Pythagorean theorem says that in any right triangle, the square of the hypotenuse equals the sum of the squares of the other two sides. Algebraically: \(a^2 + b^2 = c^2\). It’s one of the oldest, most-proved, and most-used results in mathematics — over 350 distinct proofs have been published, and the theorem appears in every culture’s mathematical history independently.
Despite being 2,500+ years old and provable from elementary geometry, the Pythagorean theorem still earns its place in modern math. Distance formulas in any number of dimensions are direct generalizations. Trigonometry is built on it. Norms in linear algebra inherit the same structure. Anywhere distance, length, or hypotenuse-style relationships matter, the Pythagorean theorem is doing the work in the background.
This study note covers the statement, the geometric and algebraic proofs, Pythagorean triples, the converse, multidimensional generalizations, applications, common pitfalls, and the historical context.

The Statement
For a right triangle with legs of lengths \(a\) and \(b\) and hypotenuse \(c\):
$$a^2 + b^2 = c^2$$The hypotenuse is the side opposite the right angle, always the longest of the three sides. The other two sides (the legs) are the ones that form the right angle.
The theorem is reversible: any triangle satisfying \(a^2 + b^2 = c^2\) is a right triangle. This is the converse, and it’s just as useful as the forward direction — it lets you test whether three given side lengths form a right triangle without measuring angles.
Worked Examples
Find the hypotenuse: A right triangle has legs 3 and 4. Then \(c^2 = 9 + 16 = 25\), so \(c = 5\). This is the famous 3-4-5 triangle, used since antiquity for laying out right angles in construction.
Find a missing leg: A right triangle has hypotenuse 13 and one leg 5. Then \(b^2 = 13^2 – 5^2 = 169 – 25 = 144\), so \(b = 12\). Another classic Pythagorean triple.
Distance between two points: The distance between \((1, 2)\) and \((4, 6)\) is \(\sqrt{(4-1)^2 + (6-2)^2} = \sqrt{9 + 16} = 5\). The distance formula in 2D is just the Pythagorean theorem applied to the horizontal and vertical separations.
Geometric Proof: Square Rearrangement
One of the most elegant proofs uses a square of side \(a + b\). Inside the square, arrange four copies of the right triangle (with legs \(a, b\), hypotenuse \(c\)) so that they leave a smaller square of side \(c\) in the middle.
The total area of the big square is \((a + b)^2 = a^2 + 2ab + b^2\). The same area equals the four triangles plus the inner square: \(4 \cdot \frac{1}{2}ab + c^2 = 2ab + c^2\). Setting them equal: \(a^2 + 2ab + b^2 = 2ab + c^2\), so \(a^2 + b^2 = c^2\).
This proof is purely visual and works without any algebraic manipulation. There are dozens of variations using different rearrangements, all leading to the same conclusion.
Algebraic Proof: Similar Triangles
Drop a perpendicular from the right angle to the hypotenuse. This divides the original right triangle into two smaller triangles, both similar to the original.
Let the foot of the perpendicular split the hypotenuse into segments of length \(p\) (adjacent to leg \(a\)) and \(q\) (adjacent to leg \(b\)). By similar triangles: \(a/c = p/a\), so \(a^2 = pc\). Similarly \(b^2 = qc\).
Adding: \(a^2 + b^2 = pc + qc = c(p + q) = c \cdot c = c^2\). The proof is short, uses only similarity arguments, and reveals the deep structural reason behind the Pythagorean relationship.
Pythagorean Triples
A Pythagorean triple is three positive integers \((a, b, c)\) with \(a^2 + b^2 = c^2\). The classic example is \((3, 4, 5)\). Other primitive triples include \((5, 12, 13)\), \((8, 15, 17)\), \((7, 24, 25)\), and \((20, 21, 29)\).
Euclid’s formula generates every primitive Pythagorean triple from coprime integers \(m > n\) of opposite parity:
$$a = m^2 – n^2, \quad b = 2mn, \quad c = m^2 + n^2$$Triples appear in surveying, construction, and any context where you need to lay out right angles using only a measuring tape. The 3-4-5 carpenter’s triangle is the practical workhorse — knot a string at intervals of 3, 4, and 5 units, pull tight, and you have a guaranteed right angle.
Historical Reference Card for Triples
A handful of triples are worth memorizing because they appear so often in textbook problems and in real-world layout: \((3, 4, 5)\), \((5, 12, 13)\), \((8, 15, 17)\), \((7, 24, 25)\), \((9, 40, 41)\), and their multiples.
Once you can recognize a Pythagorean triple by sight, many problems collapse to inspection rather than computation. Geometry exam questions often use these specifically because they avoid messy square roots in the answer.

The Converse
The converse of the Pythagorean theorem says: if a triangle has sides \(a, b, c\) with \(a^2 + b^2 = c^2\), then it’s a right triangle (with the right angle opposite the side \(c\)).
This converse is what makes the theorem usable as a test. You don’t need to measure angles directly — measure side lengths and check the Pythagorean equality. Builders, surveyors, and machinists use the converse routinely.
The converse extends to a trichotomy. If \(a^2 + b^2 > c^2\), the triangle is acute (all angles less than 90°). If \(a^2 + b^2 < c^2\), the triangle is obtuse (one angle greater than 90°). If equal, it's a right triangle. This trichotomy generalizes to the law of cosines.
Generalization: The Law of Cosines
For any triangle (not just right triangles) with sides \(a, b, c\) and the angle \(C\) opposite side \(c\):
$$c^2 = a^2 + b^2 – 2ab\cos C$$This is the law of cosines. It reduces to the Pythagorean theorem when \(C = 90°\) (since \(\cos 90° = 0\)). The law of cosines lets you analyze any triangle, not just right ones, and it’s the standard tool in trigonometry for solving general triangles.
Generalization: Higher Dimensions
The distance between two points in 3D space follows directly from the Pythagorean theorem applied twice:
$$d = \sqrt{(x_2 – x_1)^2 + (y_2 – y_1)^2 + (z_2 – z_1)^2}$$The same pattern extends to \(n\)-dimensional space. The Euclidean norm of a vector \((v_1, v_2, \ldots, v_n)\) is \(\sqrt{v_1^2 + v_2^2 + \ldots + v_n^2}\). This generalization is the basis for distance, length, and norm in linear algebra and machine learning. Whenever you compute a Euclidean distance in any dimension, you’re applying the Pythagorean theorem.
Pythagorean Identity in Trigonometry
For any angle \(\theta\):
$$\sin^2\theta + \cos^2\theta = 1$$This is the Pythagorean identity, and it’s the Pythagorean theorem applied to the unit circle. The point \((\cos\theta, \sin\theta)\) lies on the unit circle (radius 1), so the sum of the squares of its coordinates equals 1.
The Pythagorean identity is the foundation for nearly every other trig identity. Other useful forms (dividing through by \(\sin^2\theta\) or \(\cos^2\theta\)) give \(1 + \tan^2\theta = \sec^2\theta\) and \(\cot^2\theta + 1 = \csc^2\theta\). Read more in the related trigonometric identities note.
Where the Pythagorean Theorem Shows Up
- Geometry and trigonometry: distance formulas, the Pythagorean identity, the law of cosines, vector norms.
- Construction and surveying: right-angle layout using string knotted at 3-4-5 intervals.
- Computer graphics: distance calculations between points, collision detection, ray length computations.
- Physics: magnitude of vector quantities (force, velocity, momentum, electric field) computed from components.
- Navigation: straight-line distance from horizontal and vertical (or east-west and north-south) separations.
- Machine learning: Euclidean distance in feature space, L2 norm regularization, k-nearest-neighbor algorithms.
- Engineering: stress and strain analysis, beam deflection, vibration mode amplitudes.
Common Mistakes With the Pythagorean Theorem
- Applying it to non-right triangles. The theorem only works for right triangles. For other triangles, use the law of cosines.
- Confusing legs and hypotenuse. The hypotenuse is opposite the right angle and is always the longest side. \(c\) in the formula must be the hypotenuse; \(a\) and \(b\) are the legs.
- Forgetting to take the square root. \(c^2 = a^2 + b^2\) gives you \(c^2\), not \(c\). Don’t stop at the squared value when the problem asks for the length.
- Negative answers. Distances are positive. If your algebra produces a negative root, take the positive value (or recheck the problem setup).
- Mixing units. All three sides must be in the same unit. Mixing meters and feet (or inches and centimeters) produces nonsense.
- Misidentifying the right angle. Without a right angle, the theorem doesn’t apply. Verify the angle is 90° before using the formula.
A Brief History of the Pythagorean Theorem
The relationship was known to Babylonian mathematicians by 1900 BCE, who used 3-4-5 and other Pythagorean triples in surveying problems. Ancient Indian mathematicians (Sulba Sutras, ~800 BCE) and Chinese mathematicians (Zhou Bi Suan Jing, ~500 BCE) also knew the theorem.
Pythagoras (~570–495 BCE) and his school in ancient Greece are traditionally credited with the first formal proof. Whether Pythagoras himself proved it or whether the proof came from his school is unclear historically, but the name stuck. Euclid’s Elements (~300 BCE) gave the canonical Western proof.
The theorem has been proved more times than any other result in mathematics — at least 367 distinct proofs collected, including one by US President James A. Garfield. It’s the textbook example of a result so fundamental that it appears independently in every mathematical culture and admits proofs from every branch of mathematics.
Generalization: Pythagorean Theorem in Inner Product Spaces
The Pythagorean theorem extends to any inner product space. For orthogonal vectors \(u\) and \(v\):
$$\|u + v\|^2 = \|u\|^2 + \|v\|^2$$where \(\|\cdot\|\) is the norm derived from the inner product. This generalizes to function spaces, signal spaces, and abstract Hilbert spaces — the foundation of Fourier analysis, signal processing, and quantum mechanics. The familiar 2D version is the simplest example of a result that holds across the entire mathematical universe of inner product spaces.
Pythagorean Theorem in Machine Learning
Euclidean distance in feature space — used by k-nearest-neighbors, k-means clustering, t-SNE, UMAP, and many other algorithms — is the Pythagorean theorem applied to high-dimensional vectors. The L2 norm in regularization (ridge regression) is the same calculation.
Cosine similarity, the standard alternative for high-dimensional embedding spaces, doesn’t use Pythagorean distance directly but is closely related — it normalizes vectors first, then dots them. Read more in the related notes on dot and cross products and vectors.
Worked Example: 3D Distance
Find the distance between points \((1, 2, 3)\) and \((4, 6, 11)\) in 3D space. Apply the 3D distance formula:
$$d = \sqrt{(4-1)^2 + (6-2)^2 + (11-3)^2} = \sqrt{9 + 16 + 64} = \sqrt{89} \approx 9.43$$The 3D version is the Pythagorean theorem applied twice — once for the horizontal projection (giving \(\sqrt{9 + 16} = 5\)), then once more combining that with the vertical separation (\(\sqrt{5^2 + 8^2} = \sqrt{89}\)). This decomposition extends to any number of dimensions.
Geometric Proofs Beyond the Standard
Three of the most elegant proofs of the Pythagorean theorem:
- Garfield’s proof: President James A. Garfield published an original proof in 1876 using a trapezoid built from two copies of the triangle. The trapezoid area computed two different ways gives the theorem.
- Euclid’s proof (Elements I.47): uses similar triangles and area arguments. The original Western standard.
- Bhaskara’s proof: rearranges four triangles inside a square, leaving a smaller square in the middle. One word: “Behold!” — meaning the picture is the proof.
Over 350 distinct proofs of the Pythagorean theorem exist, more than any other theorem in mathematics. Each illuminates a different aspect of why the relationship holds.
Pythagorean Theorem and the Distance Formula
The 2D distance formula \(d = \sqrt{(x_2 – x_1)^2 + (y_2 – y_1)^2}\) is exactly the Pythagorean theorem applied to the horizontal and vertical separations between two points. Form a right triangle with the line segment between the points as the hypotenuse and axis-aligned legs as the other two sides; the distance follows directly. Most coordinate-geometry problems collapse to this single formula plus its 3D extension. Understanding that the distance formula is the Pythagorean theorem (not a separate result) makes everything from simple geometry homework to vector norms in machine learning instantly more intuitive.
Pythagorean Theorem in Computer Graphics
3D graphics engines compute distances between points constantly — for collision detection, lighting calculations, level-of-detail decisions, and culling objects too far from the camera. Each distance computation is the Pythagorean theorem applied in 3D: \(d = \sqrt{(\Delta x)^2 + (\Delta y)^2 + (\Delta z)^2}\).
Performance-critical code often skips the square root and compares squared distances directly: if you only need to know which of two points is closer, comparing \(d_1^2\) and \(d_2^2\) gives the same answer as comparing \(d_1\) and \(d_2\), and avoids the costly sqrt operation. This shortcut is everywhere in game engines, physics simulations, and ray tracing — a small optimization that adds up across millions of distance comparisons per frame.
Reverse Engineering: Finding Sides From Legs
Given a right triangle’s hypotenuse and one leg, the other leg is \(\sqrt{c^2 – a^2}\). For \(c = 25\), \(a = 7\): \(b = \sqrt{625 – 49} = \sqrt{576} = 24\). The triangle is 7-24-25 — a primitive Pythagorean triple.
This kind of reverse computation appears in surveying (computing perpendicular distances from observed angles and slopes), construction (verifying square corners by measuring diagonals), and computer graphics (computing missing components of vectors).
The general lesson: if any two sides of a right triangle are known, the third follows from the Pythagorean theorem. Memorizing the common triples lets you skip the arithmetic when the numbers fit a known pattern.
Three Common Misconceptions
First: the Pythagorean theorem doesn’t apply to all triangles. It requires a right angle (exactly 90°). For other triangles, use the law of cosines.
Second: \(c\) in the formula is always the hypotenuse, never a leg. The hypotenuse is the side opposite the right angle and is always the longest side. Mixing up which side is which gives wrong answers.
Third: the formula gives \(c^2\), not \(c\). Forgetting to take the square root at the end is the most common arithmetic mistake on Pythagorean problems.
FAQs
What is the Pythagorean theorem?
For any right triangle with legs of lengths a and b and hypotenuse of length c, the relationship a² + b² = c² holds. The square of the longest side (hypotenuse) equals the sum of the squares of the other two sides.
What is a Pythagorean triple?
Three positive integers (a, b, c) satisfying a² + b² = c². The simplest is (3, 4, 5). Other primitive triples include (5, 12, 13), (8, 15, 17), (7, 24, 25), and (20, 21, 29). Euclid’s formula generates all primitive triples from pairs of coprime integers of opposite parity.
Does the Pythagorean theorem only work for right triangles?
Yes. The theorem requires one angle to be exactly 90°. For other triangles, use the law of cosines: c² = a² + b² − 2ab cos(C), where C is the angle opposite side c. The Pythagorean theorem is the special case where cos(C) = 0.
What is the converse of the Pythagorean theorem?
If a triangle has sides a, b, c with a² + b² = c², then it’s a right triangle (with the right angle opposite the longest side c). The converse lets you test for right angles using only side measurements — useful in construction and surveying.
How do I find the distance between two points?
Distance = √((x₂ − x₁)² + (y₂ − y₁)²) in 2D. In 3D, add the (z₂ − z₁)² term inside the square root. The distance formula is just the Pythagorean theorem applied to the horizontal, vertical, and depth separations.
Who discovered the Pythagorean theorem?
Pythagoras (~570–495 BCE) and his school are traditionally credited with the first proof, but the relationship was known to Babylonian (1900 BCE), Indian (~800 BCE), and Chinese (~500 BCE) mathematicians independently. The proof tradition in Western mathematics begins with Euclid’s Elements (~300 BCE).
How many proofs of the Pythagorean theorem exist?
At least 367 distinct proofs have been collected, more than any other theorem in mathematics. They span geometric rearrangements, algebraic manipulations, similar triangles, calculus, complex numbers, and even one proof by US President James A. Garfield.
What is the law of cosines?
c² = a² + b² − 2ab cos(C). It generalizes the Pythagorean theorem to any triangle, not just right triangles. When the angle C is 90°, cos(C) = 0 and the formula reduces to the Pythagorean theorem.
How is the Pythagorean theorem used in construction?
To verify or construct right angles. The 3-4-5 method: knot a string at intervals of 3, 4, and 5 units, pull tight to form a triangle, and the angle opposite the 5-unit side is exactly 90°. Used since antiquity for foundation layout, framing squares, and surveying.
Does the Pythagorean theorem work in higher dimensions?
Yes. The distance formula in n-dimensional Euclidean space follows the same pattern: d = √((x₁)² + (x₂)² + … + (xₙ)²) for the magnitude of a vector. This is the basis for L2 norms in linear algebra and machine learning.
What’s the Pythagorean identity in trigonometry?
sin²(θ) + cos²(θ) = 1. It’s the Pythagorean theorem applied to the unit circle: the point (cos θ, sin θ) sits on a circle of radius 1, so the sum of squares of its coordinates equals 1. Underlies most trig identity manipulations.
Can the Pythagorean theorem give negative answers?
No. All side lengths are positive distances. If your algebra produces a negative value for a side, you’ve made an error or set the problem up wrong. Always take the positive square root for length calculations.
Does the Pythagorean theorem work for vectors in high dimensions?
Yes. The squared length of a vector in n dimensions is the sum of squares of its components. Distance between two points in n-dimensional space follows the same formula. This is why Euclidean distance scales naturally to feature spaces with hundreds or thousands of dimensions in machine learning.