Three, four, five
A builder in Accra wants the corner of a new wall to be exactly square. She has no protractor, only a tape measure. So she marks a point 3 metres along one wall and a point 4 metres along the other, and measures the distance between the marks. If it is exactly 5 metres, the corner is a right angle. If it is more, the corner is too wide; if less, too narrow.
Why should the numbers 3, 4 and 5 know anything about right angles? And why does the same trick work with 5, 12 and 13, or with 6, 8 and 10 — but not with 4, 5 and 6? The answer is one of the oldest and most famous theorems in mathematics. It was known, in some form, to scribes in ancient Mesopotamia, to the authors of the Indian Śulbasūtras, and to Chinese astronomers, long before it became attached to the name of Pythagoras. It is also the reason a computer can measure the distance between two points on a map.
Squares on the sides
Draw a right triangle with sides 3, 4 and 5 on squared paper, and build a square outward on each side. The square on the side 3 contains unit squares, the square on the side 4 contains , and the square on the side 5 contains . And .
So the theorem is really about areas: the two smaller squares together have exactly the same area as the big one. You can try other right triangles in the explorer further down — for legs 1 and 1, the tilted square has area — and the areas always balance.
Now try a triangle without a right angle, such as an equilateral triangle with all sides 1. The squares on its sides have areas , and , and . The right angle is essential.
Definitions
Definition— right triangle
A right triangle (or right-angled triangle) is a triangle with one angle of . The two sides that form the right angle are the legs; the side opposite the right angle is the hypotenuse. The hypotenuse is always the longest side.
Definition— square root
For a number , the square root is the number with . For example and . Some square roots, such as , are not whole numbers or even fractions; we can still approximate them as closely as we like.
We will use two facts from earlier lessons: the angles of a triangle add up to , and the area of a right triangle with legs and is (half of an rectangle).
The theorem and two proofs
Theorem— Pythagorean theorem
In a right triangle with legs , and hypotenuse :
Proof
First proof: rearrangement. Take four copies of the right triangle, with legs , , hypotenuse , and acute angles and . Since the angles of a triangle add up to and one of them is , we have .
Left picture. Place the four triangles in the corners of a square of side , as shown, so that along each side of the big square a leg is followed by a leg . The shape left in the middle has four sides, each a hypotenuse, so each of length . At each of its corners, the angle of the middle shape sits on a straight side of the big square between an angle of one triangle and an angle of the next, so it measures . A shape with four equal sides and four right angles is a square: its area is .
Right picture. Rearrange the same four triangles into two rectangles, placed in opposite corners of a second square of side . What is left is a square of side and a square of side : total area .
Both big squares have the same area, , and both contain four triangles of the same total area. So the uncovered areas are equal:
∎
The left picture also gives an algebraic proof. Its total area is
and subtracting from both sides leaves .
Proof
Second proof: the square in the middle. Suppose . Arrange the four triangles inside the square on the hypotenuse, each with its hypotenuse along one side, turning a quarter turn from one to the next. Along each side of the middle shape, a long leg overlaps a short leg , so the middle is a square of side (if it disappears). Adding up areas:
∎
Worked examples
Example— Finding the hypotenuse
A right triangle has legs 5 cm and 12 cm. Then , so cm.
Example— Finding a leg: the ladder
A ladder 2.5 m long leans against a wall with its foot 0.7 m from the wall. How high does it reach? The ladder is the hypotenuse: , so and m.
Example— A length that is not a whole number
A square tile has side 1. Its diagonal splits it into two right triangles with legs 1 and 1, so the diagonal has and . No whole number squares to 2 (, ), and in fact is not a fraction either — a discovery explored in real numbers.
Example— Is it a right triangle?
Sides 6, 8, 10: . By the converse (below), the triangle has a right angle, opposite the side 10. Sides 5, 6, 8: but . No right angle — in fact the angle opposite 8 is slightly more than .
Example— Screen sizes
A screen is advertised by its diagonal. A screen 48 cm wide and 27 cm high has a diagonal of cm, about 21.7 inches.
The converse: a test for right angles
The builder's 3-4-5 trick uses the theorem backwards: from the side lengths she concludes there is a right angle.
Theorem— Converse of the Pythagorean theorem
If the sides of a triangle satisfy , then the triangle has a right angle, opposite the side .
Proof
Let the triangle be , with sides , , and . Build a second triangle with a right angle between two legs of lengths and . By the Pythagorean theorem, its hypotenuse satisfies . Since and are both positive, . Now and have the same three side lengths, so they are congruent: one can be moved exactly onto the other (a triangle is fixed by its three sides — the SSS rule). Congruent triangles have equal angles, so the angle of opposite equals the angle of opposite , which is .
∎
The same comparison tells more. If , the angle opposite is acute (less than ); if , it is obtuse (more than ). The computation section checks this on hundreds of triangles; a proof comes later with the law of cosines in trigonometry.
Distance in the coordinate plane
In the coordinate plane we could measure distances along horizontal and vertical lines. Now we can measure them in any direction.
Theorem— Distance formula
The distance between and is
Proof
If and lie on a horizontal or vertical line, this is the distance or from before (note that ). Otherwise let . The segment is horizontal with length , the segment is vertical with length , and they meet at a right angle at . So is the hypotenuse of a right triangle, and .
∎
Example— Two distances between the same points
From to : legs and , distance . From to : legs and , distance — shorter than the grid distance , as a bird is faster than a taxi.
Pythagorean triples
A Pythagorean triple is a set of three positive whole numbers with , such as , and . Multiplying a triple by any whole number gives another, because . So , , , … are triples too, and there are infinitely many triples.
A triple whose three numbers have no common factor, like , is primitive. Here is a recipe that produces them, recorded in Euclid's Elements (Book X).
Theorem— Euclid's formula
For any whole numbers , the numbers , , form a Pythagorean triple.
Proof
Expand both sides:
∎
gives ; gives ; gives . In fact, when and have no common factor and are not both odd, the formula gives a primitive triple, and every primitive triple arises this way (with the two legs possibly swapped). That second statement is a theorem of number theory whose proof we postpone to elementary number theory; the computation below checks it for all triples up to 100.
What about cubes? Are there positive whole numbers with , or for some ? Pierre de Fermat claimed around 1637 that there are none. His claim, Fermat's Last Theorem, was proved only in 1995, by Andrew Wiles (with a final step completed together with Richard Taylor), using some of the deepest mathematics of the twentieth century.
Pythagoras in Lean
First, the algebraic step of each dissection proof. What Lean checks here is the area bookkeeping: if the big square is made of the pieces, then . That the pieces really fit together — the geometric half of the proof — is argued in words above, not formalised.
/-- **The first rearrangement proof, algebraic step.** If a square of side `a + b` is made up
of a tilted square of side `c` and four right triangles with legs `a`, `b` (area `ab/2` each),
then `a² + b² = c²`.
`(a + b)² = a² + 2ab + b²`, and the four triangles account for `4 · ab/2 = 2ab`. -/
theorem rearrangement_algebra (a b c : Rat) (h : (a + b) ^ 2 = c ^ 2 + 4 * (a * b / 2)) :
a ^ 2 + b ^ 2 = c ^ 2 := by
have expand : (a + b) ^ 2 = a ^ 2 + b ^ 2 + 2 * (a * b) := by grind
have four : 4 * (a * b / 2) = 2 * (a * b) := by grind
calc a ^ 2 + b ^ 2 = (a + b) ^ 2 - 2 * (a * b) := by rw [expand]; grind
_ = c ^ 2 + 4 * (a * b / 2) - 2 * (a * b) := by rw [h]
_ = c ^ 2 := by rw [four]; grind/-- **The second dissection proof, algebraic step** (the “hypotenuse diagram”). If a square of
side `c` is made up of four right triangles with legs `a`, `b` and a small square of side
`b - a` in the middle, then `a² + b² = c²`, because `(b - a)² + 2ab = a² + b²`. -/
theorem rearrangement_square_in_middle (a b c : Rat)
(h : c ^ 2 = (b - a) ^ 2 + 4 * (a * b / 2)) : a ^ 2 + b ^ 2 = c ^ 2 := by
rw [h]
grindNext, the theorem and its converse in coordinates. To stay with exact fractions we never take square roots: sqDist is the square of the distance. And “the angle at is a right angle” is expressed without measuring angles: the step from to is the step from to turned through a quarter turn, , and then stretched by some factor .
/-- A point of the coordinate plane with rational coordinates. -/
structure Point where
x : Rat
y : Rat
deriving DecidableEq/-- The **square** of the distance from `P` to `Q`: `(x₂ - x₁)² + (y₂ - y₁)²`. Comparing
squares of lengths lets us avoid square roots entirely. -/
def sqDist (P Q : Point) : Rat := (Q.x - P.x) ^ 2 + (Q.y - P.y) ^ 2/-- The distance from `(1, 2)` to `(4, 6)` is `5`: the legs are `3` and `4`, and
`3² + 4² = 25 = 5²`. -/
theorem distance_example : sqDist ⟨1, 2⟩ ⟨4, 6⟩ = 5 ^ 2 := by decide +kernel/-- The angle `ACB` is a right angle: the step from `C` to `B` is the step from `C` to `A`
turned through a quarter turn (`(p, q) ↦ (-q, p)`) and scaled by some factor `t`. -/
def IsRightAngleAt (A B C : Point) : Prop :=
∃ t : Rat, B.x - C.x = -t * (A.y - C.y) ∧ B.y - C.y = t * (A.x - C.x)/-- **The Pythagorean theorem in coordinates.** If the angle at `C` is a right angle, then
`AB² = CA² + CB²`.
Write `A - C = (p, q)`, so `B - C = (-tq, tp)`. Then `CA² = p² + q²`, `CB² = t²(p² + q²)` and
`AB² = (-tq - p)² + (tp - q)² = (1 + t²)(p² + q²)`: the cross terms `±2tpq` cancel. -/
theorem pythagoras_coordinates (A B C : Point) (h : IsRightAngleAt A B C) :
sqDist A B = sqDist C A + sqDist C B := by
obtain ⟨t, h1, h2⟩ := h
unfold sqDist
have e1 : B.x - A.x = (B.x - C.x) - (A.x - C.x) := by grind
have e2 : B.y - A.y = (B.y - C.y) - (A.y - C.y) := by grind
rw [e1, e2, h1, h2]
grind/-- A tilted right triangle: `C = (1, 1)`, `A = (4, 2)`, `B = (0, 4)`. The step `C → A` is
`(3, 1)` and the step `C → B` is `(-1, 3)`, its quarter turn. So `AB² = 10 + 10 = 20`. -/
theorem right_triangle_example :
IsRightAngleAt ⟨4, 2⟩ ⟨0, 4⟩ ⟨1, 1⟩ ∧ sqDist ⟨4, 2⟩ ⟨0, 4⟩ = 20 := by
refine ⟨⟨1, by decide +kernel, by decide +kernel⟩, by decide +kernel⟩For the converse, the key step is that forces to be a multiple of :
/-- If `(r, s)` is perpendicular to a non-zero `(p, q)` in the sense `p·r + q·s = 0`, then
`(r, s)` is a multiple of the quarter turn `(-q, p)`. The factor is
`t = (p·s - q·r) / (p² + q²)`. -/
theorem quarter_turn_of_dot_zero (p q r s : Rat) (hpq : p ≠ 0 ∨ q ≠ 0)
(h : p * r + q * s = 0) : ∃ t : Rat, r = -t * q ∧ s = t * p := by
have hne : p * p + q * q ≠ 0 := Rat.ne_of_gt (sum_sq_pos p q hpq)
have ht : (p * s - q * r) / (p * p + q * q) * (p * p + q * q) = p * s - q * r :=
Rat.div_mul_cancel hne
generalize (p * s - q * r) / (p * p + q * q) = t at ht
refine ⟨t, ?_, ?_⟩
· have hr : r * (p * p + q * q) = (-t * q) * (p * p + q * q) := by grind
calc r = r * (p * p + q * q) / (p * p + q * q) := (Rat.mul_div_cancel hne).symm
_ = (-t * q) * (p * p + q * q) / (p * p + q * q) := by rw [hr]
_ = -t * q := Rat.mul_div_cancel hne
· have hs : s * (p * p + q * q) = (t * p) * (p * p + q * q) := by grind
calc s = s * (p * p + q * q) / (p * p + q * q) := (Rat.mul_div_cancel hne).symm
_ = (t * p) * (p * p + q * q) / (p * p + q * q) := by rw [hs]
_ = t * p := Rat.mul_div_cancel hne/-- **The converse in coordinates.** If `A ≠ C` and `AB² = CA² + CB²`, then the angle at `C`
is a right angle.
Expanding, `AB² = CA² + CB² - 2(p·r + q·s)` where `(p, q) = A - C` and `(r, s) = B - C`; so the
hypothesis says exactly `p·r + q·s = 0`, and `quarter_turn_of_dot_zero` finishes. -/
theorem converse_coordinates (A B C : Point) (hAC : A ≠ C)
(h : sqDist A B = sqDist C A + sqDist C B) : IsRightAngleAt A B C := by
have hpq : A.x - C.x ≠ 0 ∨ A.y - C.y ≠ 0 := by
by_cases hx : A.x - C.x = 0
· right
intro hy
apply hAC
cases A
cases C
simp only at hx hy
grind
· left
exact hx
have hdot : (A.x - C.x) * (B.x - C.x) + (A.y - C.y) * (B.y - C.y) = 0 := by
unfold sqDist at h
grind
exact quarter_turn_of_dot_zero _ _ _ _ hpq hdotFinally, whole-number facts: triples, the non-example , scaling, Euclid's formula (for all integers ), infinitely many triples, and two warnings.
/-- Three Pythagorean triples: `3² + 4² = 5²`, `5² + 12² = 13²`, `8² + 15² = 17²`. -/
theorem triple_examples : 3 ^ 2 + 4 ^ 2 = 5 ^ 2 ∧ 5 ^ 2 + 12 ^ 2 = 13 ^ 2 ∧
8 ^ 2 + 15 ^ 2 = 17 ^ 2 := by decide/-- A triangle with sides `5, 6, 8` has **no** right angle: `5² + 6² = 61`, but `8² = 64`.
(By the converse, a right angle would force `61 = 64`; and the right angle could only be
opposite the longest side.) -/
theorem not_right_example : 5 ^ 2 + 6 ^ 2 ≠ 8 ^ 2 := by decide/-- Scaling a triple gives a triple: if `a² + b² = c²` then `(ka)² + (kb)² = (kc)²`. -/
theorem triple_scale (a b c k : Nat) (h : a ^ 2 + b ^ 2 = c ^ 2) :
(k * a) ^ 2 + (k * b) ^ 2 = (k * c) ^ 2 := by
calc (k * a) ^ 2 + (k * b) ^ 2 = k ^ 2 * (a ^ 2 + b ^ 2) := by grind
_ = k ^ 2 * c ^ 2 := by rw [h]
_ = (k * c) ^ 2 := by grind/-- **Euclid's formula.** For all integers `m, n`, the numbers `m² - n²`, `2mn`, `m² + n²`
satisfy `(m² - n²)² + (2mn)² = (m² + n²)²`. With `m = 2, n = 1` this is `3, 4, 5`. -/
theorem euclid_formula (m n : Int) :
(m ^ 2 - n ^ 2) ^ 2 + (2 * m * n) ^ 2 = (m ^ 2 + n ^ 2) ^ 2 := by
grind/-- **There are infinitely many Pythagorean triples**: beyond any number `N` there is a triple
with all sides positive and the first side bigger than `N`. Take `3k, 4k, 5k` with
`k = N + 1`. -/
theorem infinitely_many_triples (N : Nat) :
∃ a b c : Nat, N < a ∧ 0 < b ∧ a ^ 2 + b ^ 2 = c ^ 2 := by
refine ⟨3 * (N + 1), 4 * (N + 1), 5 * (N + 1), by omega, by omega, ?_⟩
have h := triple_scale 3 4 5 (N + 1) (by decide)
rw [Nat.mul_comm 3, Nat.mul_comm 4, Nat.mul_comm 5]
exact h/-- **`√(a² + b²)` is not `a + b`.** For positive `a, b`, `a² + b² < (a + b)²`: the square of
the sum has the extra `2ab`. So the hypotenuse is always shorter than the two legs together. -/
theorem sum_sq_lt_sq_sum (a b : Nat) (ha : 0 < a) (hb : 0 < b) :
a ^ 2 + b ^ 2 < (a + b) ^ 2 := by
have hab : 0 < a * b := Nat.mul_pos ha hb
have expand : (a + b) ^ 2 = a ^ 2 + b ^ 2 + 2 * (a * b) := by grind
omega/-- The diagonal of a unit square has length `√2`, and `√2` is not a whole number: no whole
number `n` has `n² = 2` (`1² = 1` is too small and `2² = 4` already too big). In fact `√2` is not
even a fraction — see the lesson on real numbers. -/
theorem no_whole_sqrt_two : ¬ ∃ n : Nat, n ^ 2 = 2 := by
intro ⟨n, h⟩
match n, h with
| 0, h => exact absurd h (by decide)
| 1, h => exact absurd h (by decide)
| k + 2, h =>
have : 4 ≤ (k + 2) ^ 2 := by
have := Nat.mul_le_mul (Nat.le_add_left 2 k) (Nat.le_add_left 2 k)
rw [Nat.pow_two]
exact this
omegaAll of these are proved here, using core Lean only. Mathlib proves the theorem and its converse for real inner product spaces (any dimension), and classifies all integer triples — the statement we postponed above.
Triples and triangles by computer
"""Pythagorean triples up to 100: search, count and Euclid's formula.
The experiment finds every triple of whole numbers a < b < c <= 100 with
a^2 + b^2 = c^2 by trying all pairs, picks out the primitive ones (no common
factor), and compares them with the triples produced by Euclid's formula
(m^2 - n^2, 2mn, m^2 + n^2) for m > n > 0 with no common factor and not both
odd. It also checks that every triple is a multiple of a primitive one and
tests a curious pattern: the product abc is always a multiple of 60. All of
this is exact and exhaustive for c <= 100 only.
"""
import math
def triples(limit):
"""All (a, b, c) with a < b < c <= limit and a^2 + b^2 = c^2."""
found = []
for c in range(1, limit + 1):
for b in range(1, c):
a_sq = c * c - b * b
a = math.isqrt(a_sq)
if a < b and a > 0 and a * a == a_sq:
found.append((a, b, c))
return sorted(found, key=lambda t: (t[2], t[0]))
def is_primitive(t):
"""No whole number greater than 1 divides all three sides."""
return math.gcd(math.gcd(t[0], t[1]), t[2]) == 1
def euclid(m, n):
"""Euclid's triple for m > n > 0, with the two legs in increasing order."""
a, b, c = m * m - n * n, 2 * m * n, m * m + n * n
return (min(a, b), max(a, b), c)
def euclid_primitives(limit):
"""Triples from Euclid's formula with m > n > 0 coprime, not both odd."""
out = set()
m = 2
while m * m + 1 <= limit:
for n in range(1, m):
if math.gcd(m, n) == 1 and (m - n) % 2 == 1:
t = euclid(m, n)
if t[2] <= limit:
out.add(t)
m += 1
return sorted(out, key=lambda t: (t[2], t[0]))
def primitive_root(t):
"""Divide a triple by the common factor of its sides."""
g = math.gcd(math.gcd(t[0], t[1]), t[2])
return (t[0] // g, t[1] // g, t[2] // g)
def hypotenuse_counts(found):
"""How many of the triples in ``found`` have each hypotenuse c."""
counts = {}
for _, _, c in found:
counts[c] = counts.get(c, 0) + 1
return counts
def main():
all_t = triples(100)
prim = [t for t in all_t if is_primitive(t)]
print(f"Triples with c <= 100: {len(all_t)}; primitive: {len(prim)}")
print("Primitive triples:")
for i in range(0, len(prim), 4):
print(" " + " ".join(f"{t}" for t in prim[i:i + 4]))
eu = euclid_primitives(100)
print(f"Euclid's formula (m > n coprime, not both odd): {len(eu)} triples;"
f" same list: {eu == prim}")
roots_ok = all(primitive_root(t) in prim for t in all_t)
print(f"Every triple is k times a primitive triple: {roots_ok}")
print(f"abc is a multiple of 60 for every triple found: "
f"{all(a * b * c % 60 == 0 for a, b, c in all_t)}")
counts = hypotenuse_counts(all_t)
best = max(counts.values())
tops = [c for c, k in sorted(counts.items()) if k == best]
print(f"Hypotenuses in the most triples ({best} each): {tops}")
print()
print("Epistemic status: exact, exhaustive search for c <= 100. It is evidence")
print("for, not proof of, the facts that Euclid's formula gives every primitive")
print("triple and that 60 always divides abc; both are theorems of number")
print("theory, proved with divisibility arguments.")
if __name__ == "__main__":
main()The search is exhaustive for : there are exactly 52 triples, 16 of them primitive, and Euclid's formula produces exactly those 16. It also finds a pattern we did not expect: is always a multiple of 60. A search can find patterns and refute guesses, but it cannot prove a pattern continues for ever; both patterns are in fact theorems of number theory.
"""Testing the converse: build every whole-number triangle and measure it.
For every triangle with whole-number sides a <= b <= c <= 20, the experiment
builds it in the coordinate plane: C = (0, 0), B = (a, 0), and A = (x, y)
with CA = b and BA = c. Subtracting the two distance equations gives the exact
value x = (a^2 + b^2 - c^2) / (2a), computed with fractions. The angle at C is
then measured numerically (like a protractor) and compared with the test
"compare a^2 + b^2 with c^2". The sign of x is the whole story: x = 0 means a
right angle at C, x > 0 an acute one, x < 0 an obtuse one.
"""
import math
from fractions import Fraction
def triangles(limit):
"""All (a, b, c) with a <= b <= c <= limit satisfying a + b > c."""
return [(a, b, c) for c in range(1, limit + 1) for b in range(1, c + 1)
for a in range(1, b + 1) if a + b > c]
def apex(a, b, c):
"""Exact x and approximate y of A, where C = (0, 0) and B = (a, 0)."""
x = Fraction(a * a + b * b - c * c, 2 * a)
y = math.sqrt(b * b - x * x)
return x, y
def angle_at_c(a, b, c):
"""The angle ACB in degrees, measured from the coordinates."""
x, y = apex(a, b, c)
return math.degrees(math.atan2(y, float(x)))
def pythagoras_test(a, b, c):
"""'right', 'acute' or 'obtuse' by comparing a^2 + b^2 with c^2."""
s, t = a * a + b * b, c * c
return "right" if s == t else ("acute" if s > t else "obtuse")
def measured_type(a, b, c, tol=1e-9):
"""'right', 'acute' or 'obtuse' from the measured angle at C."""
ang = angle_at_c(a, b, c)
if abs(ang - 90) < tol:
return "right"
return "acute" if ang < 90 else "obtuse"
def main():
tris = triangles(20)
counts = {"right": 0, "acute": 0, "obtuse": 0}
agree = 0
for t in tris:
kind = pythagoras_test(*t)
counts[kind] += 1
agree += kind == measured_type(*t)
print(f"Triangles with whole-number sides a <= b <= c <= 20: {len(tris)}")
print(f" by the test a^2 + b^2 vs c^2: {counts['right']} right, "
f"{counts['acute']} acute, {counts['obtuse']} obtuse")
print(f" measured angle at C agrees with the test: {agree} of {len(tris)}")
rights = [t for t in tris if pythagoras_test(*t) == "right"]
print(" the right ones:")
print(" " + ", ".join(str(t) for t in rights))
print()
print("Three examples (x is exact, the angle is measured):")
for t in [(3, 4, 5), (5, 6, 8), (4, 5, 6)]:
x, _ = apex(*t)
print(f" sides {t}: x = {str(x):>6}, angle at C = "
f"{angle_at_c(*t):7.3f} degrees ({pythagoras_test(*t)})")
smallest = min((abs(angle_at_c(*t) - 90), t) for t in tris
if pythagoras_test(*t) != "right")
print(f"Closest to 90 degrees without being right: {smallest[1]}, off by "
f"{smallest[0]:.3f} degrees")
print()
print("Epistemic status: exhaustive over these 825 triangles. The x-coordinate")
print("is exact (x = 0 exactly for the right triangles); the angles are")
print("floating-point measurements, and an angle within 1e-9 degrees of 90")
print("counts as right. Evidence for these triangles only: the converse is")
print("proved in the lesson for every triangle.")
if __name__ == "__main__":
main()All 825 triangles agree with the test: right exactly when , acute when it is bigger, obtuse when it is smaller. Look at the exact -coordinate of the top vertex: its sign is the sign of . That observation, turned into an argument, is a second proof of the converse.
Explore: the squares on the sides
Change the legs and of the right triangle with corner at the origin. The picture shows the squares on the two legs, the square on the hypotenuse, and the big square of side from the first proof. Choose whole numbers and count unit squares: for , , the big square has area , the four corner triangles , and the tilted square . Try to see .
Squares on the sides of a right triangle
A point moves along the curve as t changes: x and y are both functions of t.
- right triangle, legs a and b
- square on a: area a²
- square on b: area b²
- square on the hypotenuse: area c²
- big square, side a + b
- (1.5, 0)
- (1.5, 0)
- (0, 2)
- (5, 1.5)
- (3.5, 0)
Exercises
1. The Pythagorean theorem
Warm-upHumanA right triangle has legs cm and cm. How long is the hypotenuse, in cm?
2. The Pythagorean theorem
Warm-upHumanA right triangle has hypotenuse and one leg . How long is the other leg?
3. The Pythagorean theorem
CoreHumanWhat is the straight-line distance between the points and ?
4. The Pythagorean theorem
CoreHumanWhich of these triangles has a right angle?
5. The Pythagorean theorem
CoreHumanA right triangle has one leg and hypotenuse . Rahul writes and says the third side is . What went wrong?
6. The Pythagorean theorem
CoreHumanIn the first rearrangement proof, why is the shape in the middle of the left picture a square?
7. The Pythagorean theorem
StretchHumanUse Euclid's formula with and . What is the hypotenuse of the triple you get?
8. The Pythagorean theorem
StretchHumanA triangle has sides , and . What kind of angle is opposite the side ?
9. The Pythagorean theorem
CoreFormalIn the Lean file, sqDist A B is the square of the distance and IsRightAngleAt A B C says the angle at is a right angle. Which statement is the converse of the Pythagorean theorem?
10. The Pythagorean theorem
StretchComputationalWrite a function is_right(a, b, c) that returns True if a triangle with sides a, b, c (given in any order) has a right angle, and False otherwise. Use whole numbers, so the test is exact.
Common misconceptions
Misconception
Using for triangles without a right angle. The proof used the right angle to show that the middle shape is a square. For an equilateral triangle with sides 1, . Before using the theorem, check that there is a right angle — or, if you only know the sides, use the converse.
Misconception
Taking to be any side. must be the hypotenuse, the side opposite the right angle, which is always the longest side. In the 3-4-5 triangle, . When finding a missing leg, subtract: .
Misconception
Thinking . For legs 3 and 4, , not . Squaring a sum gives an extra term: , which is bigger than whenever . Geometrically: the hypotenuse is a short cut, shorter than walking along both legs.
Misconception
“Pythagoras discovered it.” The relation was known and used in Mesopotamia, India and China, in some cases more than a thousand years before Pythagoras (6th century BCE). No writing by Pythagoras survives, and we do not know whether he proved it. The oldest surviving complete proof is in Euclid's Elements (about 300 BCE).
Other ways of seeing
Geometry— On a sphere, Pythagoras fails
The proof used the fact that the angles of a triangle add up to — true on a flat plane, false on a curved surface. On a globe, walk from the North Pole down to the equator, turn , walk a quarter of the way round the equator, turn and walk back to the pole. Your path is a triangle with three right angles and three equal sides, so . For small triangles on a large sphere, holds approximately, and the size of the error measures how curved the surface is. Try it below. See non-Euclidean geometry.
A triangle with three right angles
Drag the corners. On a flat plane the angles add up to 180°; on a sphere they add up to more, and in the hyperbolic plane to less.
Drag a corner to move it; drag anywhere else to turn the sphere. The sides are arcs of great circles — the shortest paths on a sphere.
- ∠A90.0°
- ∠B90.0°
- ∠C90.0°
∠A + ∠B + ∠C = 270.0°
- Angle excess (sum − 180°)
- 90.0° = 1.571 rad
- Area, measured numerically
- 1.571 R²
- Share of the whole sphere (area ÷ 4πR²)
- 12.50 %
∠A + ∠B + ∠C − π = Area / R²On a sphere of radius R, the excess in radians equals the area divided by R². The area is computed separately, by numerical integration, so the match is a check rather than an assumption.
∠A + ∠B + ∠C − π = K · Area
| Flat plane | K = 0 | ∠A+∠B+∠C = 180° |
|---|---|---|
| Sphere | K = 1/R² | ∠A+∠B+∠C > 180° |
| Hyperbolic plane | K = −1 | ∠A+∠B+∠C < 180° |
This is a first glimpse of the Gauss–Bonnet theorem: for a triangle whose sides are geodesics (shortest paths), the angle sum minus π equals the total curvature inside it. Here the curvature K is the same everywhere; on other surfaces you add up (integrate) K over the area.
Number theory— Whole-number solutions
Asking for whole-number solutions of turns a geometry theorem into a problem about integers. Euclid's formula answers it completely. Dividing by gives : each triple is a point with fraction coordinates on the circle of radius 1, such as . Drawing lines through with fraction slopes finds every such point — a geometric derivation of Euclid's formula. Changing the exponent from 2 to 3 or more leads to Fermat's Last Theorem. See elementary number theory.
Algebra— More dimensions
Applying the theorem twice gives distances in space: the diagonal of a box with edges , , has length (first the diagonal of the floor, then up). In coordinates, the length of a vector is in any number of dimensions, and “perpendicular” becomes the algebraic condition that appeared in our Lean proof of the converse. See vectors.
Wonder Trails
Optional, and never graded: a question that leads somewhere further.
Wonder Trail · Optional · never gradedTriangles on a ballOn flat paper the angles of every triangle add up to 180°, and a² + b² = c² in every right triangle. Draw a triangle on a ball instead. Is either rule still true?Follow the trailHistory and global context
- Mesopotamia. The Old Babylonian tablet YBC 7289 (about 1800–1600 BCE) shows a square with its diagonals and gives in base 60 as , correct to about six decimal places. The tablet Plimpton 322, from the same period, lists numbers closely related to Pythagorean triples such as ; its exact purpose is still debated.
- India. The Baudhāyana Śulbasūtra (dates uncertain, perhaps 800–500 BCE), a manual for building fire altars, states that the diagonal of a rectangle produces both areas that its length and breadth produce separately — the theorem in words — and lists triples.
- China. The Zhoubi Suanjing (compiled by about the 1st century CE) discusses the gougu rule with the 3-4-5 triangle. In the 3rd century CE, Zhao Shuang's commentary gave the “hypotenuse diagram” used in our second proof, and Liu Hui gave a dissection proof in his commentary on the Nine Chapters.
- Greece. Euclid's Elements (about 300 BCE) proves the theorem as Book I, Proposition 47, and its converse as Proposition 48. The traditional link with Pythagoras comes from much later writers.
- The Islamic world and beyond. Thābit ibn Qurra in 9th-century Baghdad generalised the theorem to all triangles. In 12th-century India, Bhāskara II gave a dissection proof with the square-in-the-middle figure. In 1876 James Garfield, later President of the United States, published a proof using a trapezium. Elisha Loomis's The Pythagorean Proposition (1927; 2nd edition 1940) collected 367 proofs.
- 1995. Andrew Wiles's proof of Fermat's Last Theorem settled the question Fermat asked about higher powers.
Further reading
- Eli Maor, The Pythagorean Theorem: A 4,000-Year History (2007).
- Euclid, Elements, Book I, Propositions 47–48 (translation by Thomas L. Heath, 1908).
- Frank J. Swetz and T. I. Kao, Was Pythagoras Chinese? An Examination of Right Triangle Theory in Ancient China (1977).
- Elisha Scott Loomis, The Pythagorean Proposition (1927; 2nd edition 1940).