Monocurl Essays
Series Download

The Pythagorean theorem: a proof you can see

Why the squares on the two short sides of a right triangle add up to the square on the long side, proved by moving four triangles inside a box.

24 min·High school·

AssumesWhy the angles of a triangle add to 180°

A right triangle with sides 3, 4 and 5 carries a square on each side. The 9 cells of the small square and the 16 cells of the middle square together fill the 25 cells of the large one.
Monocurl source
let U = 0.4
let O = [-2.05, -0.8, 0]
let pt = |x, y| [O[0] + x * U, O[1] + y * U, 0]
let TILT = arctan2(0.6, 0.8)
let CellAt = |c, th, col| {
    let h = 0.45
    let cs = cos(th)
    let sn = sin(th)
    return fill{tint(col, 0.5)} stroke{col, 2} Polygon(map(
        [[-h, -h], [h, -h], [h, h], [-h, h]],
        |d| pt(c[0] + d[0] * cs - d[1] * sn, c[1] + d[0] * sn + d[1] * cs)
    ))
}
let home = |k| {
    if (k < 16) {
        return [-mod(k, 4) - 0.5, k // 4 + 0.5]
    }
    return [mod(k - 16, 3) + 0.5, -((k - 16) // 3) - 0.5]
}
let slot = |k| {
    let p = mod(k, 5) + 0.5
    let q = k // 5 + 0.5
    return [3 - 0.6 * p + 0.8 * q, 0.8 * p + 0.6 * q]
}
let Cells = |u| block {
    for (k in range(0, 25)) {
        let prog = smooth(clamp(0, u * 1.6 - 0.6 * k / 24, 1))
        var col = EMBER
        if (k >= 16) {
            col = AZURE
        }
        . CellAt(lerp(home(k), slot(k), prog), TILT * prog, col)
    }
}
mesh ghosts = block {
    for (i in range(0, 5)) {
        . Seg(pt(-i, 0), pt(-i, 4), MIST, 1.5)
        . Seg(pt(-4, i), pt(0, i), MIST, 1.5)
    }
    for (i in range(0, 4)) {
        . Seg(pt(i, 0), pt(i, -3), MIST, 1.5)
        . Seg(pt(0, -i), pt(3, -i), MIST, 1.5)
    }
    for (i in range(0, 6)) {
        . Seg(pt(3 - 0.6 * i, 0.8 * i), pt(7 - 0.6 * i, 3 + 0.8 * i), MIST, 1.5)
        . Seg(pt(3 + 0.8 * i, 0.6 * i), pt(0.8 * i, 4 + 0.6 * i), MIST, 1.5)
    }
}
mesh frames = [
    Outline([pt(0, 0), pt(0, 4), pt(-4, 4), pt(-4, 0)], EMBER, 3),
    Outline([pt(0, 0), pt(3, 0), pt(3, -3), pt(0, -3)], AZURE, 3),
    Outline([pt(3, 0), pt(7, 3), pt(4, 7), pt(0, 4)], LEAF, 3)
]
mesh cells = Cells(u: 0)
mesh tri = [
    Shape([pt(0, 0), pt(3, 0), pt(0, 4)], INK, 0.08, 3.5),
    Name("3", pt(1.3, 0.42), 0.9),
    Name("4", pt(0.4, 1.65), 0.9),
    Name("5", pt(1.3, 1.5), 0.9)
]
let Tri3 = |parts, size|
    color{AZURE, |tags| 1 in tags}
    color{EMBER, |tags| 2 in tags}
    color{LEAF, |tags| 3 in tags}
    color{INK}
    Tex([text_tag{1} parts[0], "+", text_tag{2} parts[1], "=", text_tag{3} parts[2]], size)
mesh count = [
    center{[2.3, 1.15, 0]} Note("cells in each square", 0.9),
    center{[2.3, 0.2, 0]} Tri3([to_string(3 * 3), to_string(4 * 4), to_string(5 * 5)], 1.9),
    center{[2.3, -0.85, 0]} Tri3(["3^2", "4^2", "5^2"], 1.3)
]

slide "fill"
    play Wait(1)
    cells.u = 1
    play Lerp(5.5, [&cells], linear)
    play Wait(2)

Uses the shared definitions for this lesson's figures.

Draw a triangle with sides of 3, 4 and 5 units. It has a right angle between the two shorter sides, a fact builders use to lay out square corners. Now build a square on each side and count cells. The squares have 9, 16 and 25 cells, and $9 + 16 = 25$: the two smaller squares hold exactly as many cells as the largest one.

That could be a coincidence about the numbers 3, 4 and 5, since whole numbers often line up by accident. To find out, we have to try a right triangle that nobody picked for its nice numbers, and there we hit a practical problem straight away.

A triangle whose long side is not a whole number

Take the right triangle whose two shorter sides are 1 and 2. The squares on those sides have areas 1 and 4. If the pattern holds, the square on the long side should have area 5.

The long side of this triangle is not a whole number of units, so we cannot build its square out of unit cells and count. It sits tilted across the grid, cutting cells into odd fragments, so we need another way to measure the area of a tilted square.

One way is to put a box around the tilted square, with the sides of the box running along the grid. The box is easy to measure, and so is the part of it that is not the tilted square.

The tilted square on the long side of a 1-by-2 right triangle, inside a 3-by-3 box. The box has area 9, the four corner triangles have area 1 each, and so the tilted square has area 5.
The tilted square on the long side of a 1-by-2 right triangle, inside a 3-by-3 box. The box has area 9, the four corner triangles have area 1 each, and so the tilted square has area 5.
Monocurl source
let G = 1.15
let K = [-3.35, -1.725, 0]
let g = |x, y| [K[0] + x * G, K[1] + y * G, 0]
let P = [g(1, 0), g(3, 1), g(2, 3), g(0, 2)]
let corners = [g(0, 0), g(3, 0), g(3, 3), g(0, 3)]
mesh inner = Region(P, tint(LEAF, 0.3))
mesh tris = block {
    for (i in range(0, 4)) {
        . Region([corners[i], P[i], P[mod(i + 3, 4)]], tint(AZURE, 0.35))
    }
}
mesh grid = block {
    for (i in range(1, 3)) {
        . Seg(g(i, 0), g(i, 3), MIST, 2)
        . Seg(g(0, i), g(3, i), MIST, 2)
    }
}
mesh lines = [Outline(corners, SLATE, 3), Outline(P, LEAF, 4)]
mesh labels = [
    Name("1", g(0.3, 0.55), 0.8, AZURE),
    Name("1", g(2.45, 0.3), 0.8, AZURE),
    Name("1", g(2.7, 2.45), 0.8, AZURE),
    Name("1", g(0.55, 2.7), 0.8, AZURE),
    Name("?", g(1.5, 1.5), 1.2, LEAF),
    center{[2.2, 1.15, 0]} Note("the whole box", 0.74),
    Name(str_join(["3 \times 3 = ", to_string(3 * 3)]), [2.2, 0.7, 0], 0.9),
    center{[2.2, 0.0, 0]} Note("four corner triangles", 0.74),
    Name(str_join(["4 \times 1 = ", to_string(4 * 1)]), [2.2, -0.45, 0], 0.9, AZURE),
    center{[2.2, -1.15, 0]} Note("what is left", 0.74),
    Name(str_join([to_string(3 * 3), " - ", to_string(4), " = ", to_string(3 * 3 - 4)]), [2.2, -1.6, 0], 0.9, LEAF)
]

Uses the shared definitions for this lesson's figures.

The box is 3 units on a side, so its area is 9. Each corner of the box is cut off by a triangle that is a copy of our 1-by-2 right triangle, and a right triangle with those sides is half of a 1-by-2 rectangle, so its area is 1. There are four of them. What remains is the tilted square, and its area must be

$$ 9 - 4 \times 1 = 5. $$

That is $1 + 4$, as the pattern predicted.

Pause and try

Do the same for the right triangle whose shorter sides are 2 and 3. Sketch the tilted square on its long side, put a box around it, and find the area of the tilted square. Is it $2^2 + 3^2$?

Show answerHide answer

The box has side $2 + 3 = 5$ and area 25. Each corner triangle is half of a 2-by-3 rectangle, so it has area 3, and the four of them take up 12. The tilted square has area $25 - 12 = 13$, and $2^2 + 3^2 = 4 + 9 = 13$. The pattern holds again.

The box also re-derives the case we started with. For shorter sides 3 and 4 the box has side 7 and area 49, the four triangles have area 6 each, and $49 - 24 = 25$.

The same computation with letters

Three cases agree, and all three were handled by one method. A method that never used anything special about its numbers can be run once with letters in place of the numbers, and then it covers every case at once.

In a right triangle, meaning a triangle with a 90° angle, the two sides that meet at the right angle are called the legs, and the side opposite the right angle, which is always the longest, is the hypotenuse. Call the lengths of the legs $a$ and $b$, and the length of the hypotenuse $c$.

The box has side $a + b$. Four copies of the triangle sit in its corners, and the hypotenuses of the four copies form a tilted four-sided shape in the middle.

A box of side a + b with a copy of the right triangle in each corner. At the point P on the bottom side, the angle \beta of one triangle, a corner of the tilted shape, and the angle \alpha of the next triangle lie along a straight line.
A box of side $a + b$ with a copy of the right triangle in each corner. At the point $P$ on the bottom side, the angle $\beta$ of one triangle, a corner of the tilted shape, and the angle $\alpha$ of the next triangle lie along a straight line.
Monocurl source
let a = 1.25
let b = 2.3
let B = box([-3.4, -1.55, 0], a, b)
let alpha = arctan2(a, b)
let beta = arctan2(b, a)
mesh fills = [
    Region([B[4], B[5], B[6], B[7]], tint(LEAF, 0.22)),
    Region([B[0], B[4], B[7]], tint(SLATE, 0.2)),
    Region([B[1], B[5], B[4]], tint(SLATE, 0.2)),
    Region([B[2], B[6], B[5]], tint(SLATE, 0.2)),
    Region([B[3], B[7], B[6]], tint(SLATE, 0.2))
]
mesh angles = [
    Wedge(B[4], PI - beta, beta, AZURE, 0.55),
    Wedge(B[4], 0, alpha, EMBER, 0.8),
    Wedge(B[7], heading(B[7], B[0]), alpha, EMBER, 0.8),
    Wedge(B[5], heading(B[5], B[4]), beta, AZURE, 0.55),
    Square90(B[4], normalize(B[5] - B[4]), normalize(B[7] - B[4]), LEAF, 0.26)
]
mesh lines = [
    Outline([B[0], B[1], B[2], B[3]], SLATE, 3),
    Outline([B[4], B[5], B[6], B[7]], LEAF, 4)
]
mesh labels = [
    Name("a", 0.5 * (B[0] + B[4]) + [0, -0.25, 0], 0.8),
    Name("b", 0.5 * (B[4] + B[1]) + [0, -0.25, 0], 0.8),
    Name("a", 0.5 * (B[1] + B[5]) + [0.25, 0, 0], 0.8),
    Name("b", 0.5 * (B[5] + B[2]) + [0.25, 0, 0], 0.8),
    Name("b", 0.5 * (B[0] + B[7]) + [-0.25, 0, 0], 0.8),
    Name("a", 0.5 * (B[7] + B[3]) + [-0.25, 0, 0], 0.8),
    Name("c", 0.5 * (B[4] + B[7]) + [0.25, 0.2, 0], 0.8, LEAF),
    Name("c", 0.5 * (B[4] + B[5]) + [-0.2, 0.28, 0], 0.8, LEAF),
    Name("P", B[4] + [0.05, -0.3, 0], 0.8),
    Name("\beta", B[4] + 0.85 * dir(PI - beta / 2), 0.78, AZURE),
    Name("\alpha", B[4] + 1.1 * dir(alpha / 2), 0.78, EMBER),
    Name("\alpha", B[7] + 1.1 * dir(heading(B[7], B[0]) + alpha / 2), 0.78, EMBER),
    Name("\beta", B[5] + 0.85 * dir(heading(B[5], B[4]) + beta / 2), 0.78, AZURE),
    Name("\alpha + \beta = 90^\circ", [2.35, 0.55, 0], 0.85),
    center{[2.35, -0.05, 0]} Note("so the corner at P is", 0.74),
    Name("180^\circ - 90^\circ = 90^\circ", [2.35, -0.55, 0], 0.85, LEAF)
]

Uses the shared definitions for this lesson's figures.

Before computing its area we should check something that the grid pictures let us take for granted: that the shape in the middle is a square.

Its four sides are fine: each is the hypotenuse of a copy of the triangle, so each has length $c$. But a four-sided shape with equal sides can be a squashed diamond. We need its corners to be right angles, and that is where the previous lesson comes in. The angles of a triangle add to 180°, and one angle of our triangle is 90°, so the other two, call them $\alpha$ and $\beta$, add to 90°.

Pause and try

Look at the point $P$ on the bottom side of the box in the figure. Three angles meet there along the straight side: one from the triangle on the left, one from the triangle on the right, and a corner of the tilted shape between them. Which angles of the triangle are the two outer ones, and what does that force the middle one to be?

Show answerHide answer

The triangle on the left has its leg $a$ along the bottom, ending at $P$, so its angle at $P$ is the one opposite the leg $b$. Call that one $\beta$. The triangle on the right has its leg $b$ along the bottom, starting at $P$, so its angle at $P$ is the one opposite the leg $a$, which is $\alpha$. Along a straight line the three angles add to 180°, so the middle one is $180° - (\alpha + \beta) = 180° - 90° = 90°$.

The same happens at the other three corners, so the tilted shape has four equal sides and four right angles. It is a square of side $c$, and its area is $c^2$.

Now run the box computation. The box has area $(a + b)^2$. Each triangle is half of an $a$-by-$b$ rectangle, so it has area $\frac{1}{2}ab$, and the four together have area $2ab$. So

$$ c^2 = (a + b)^2 - 2ab = a^2 + 2ab + b^2 - 2ab = a^2 + b^2. $$

The $2ab$ that appears when $(a + b)^2$ is multiplied out is exactly the area of the four triangles, and it cancels. What is left says that the square on the hypotenuse equals the sum of the squares on the legs, for every right triangle.

Seeing the cancellation

The algebra is short, but the term $2ab$ arrives and leaves without our seeing what it is. There is a way to watch the same cancellation happen with no algebra, by moving the triangles.

  1. Four copies of the triangle sit in the corners of a box of side a + b. The space they leave is the tilted square, of area c².
  2. Slide the top right triangle down to the bottom left. It meets the triangle there and the two make an a-by-b rectangle.
  3. Slide the top left triangle down to the bottom right. Again two triangles make an a-by-b rectangle.
  4. The box and the four triangles are the same as before, so the empty space has the same area. It is now two squares, of areas a² and b².
The rearrangement proof. Four copies of the triangle sit in a box of side $a + b$. Sliding two of them changes the empty space from one square of area $c^2$ into two squares of areas $a^2$ and $b^2$.
Monocurl source
let a = 1.3
let b = 2.25
let s = a + b
let K = [-3.4, -1.6, 0]
let B = box(K, a, b)
let Tri = |p, q, r, shift| fill{tint(SLATE, 0.28)} stroke{INK, 3} Polygon([p + shift, q + shift, r + shift])
let Mover = |p, q, r, d, u| Tri(p, q, r, u * d)
mesh floor = [
    Box(K + [s / 2, s / 2, 0], [s, s], LEAF, 0.25, 3)
]
mesh fixed = [
    Tri(B[0], B[4], B[7], [0, 0, 0]),
    Tri(B[1], B[5], B[4], [0, 0, 0])
]
mesh third = Mover(B[2], B[6], B[5], [-b, -a, 0], u: 0)
mesh fourth = Mover(B[3], B[7], B[6], [a, -b, 0], u: 0)
mesh sides = [
    Name("a", 0.5 * (B[0] + B[4]) + [0, -0.25, 0]),
    Name("b", 0.5 * (B[4] + B[1]) + [0, -0.25, 0]),
    Name("b", 0.5 * (B[0] + B[7]) + [-0.25, 0, 0]),
    Name("a", 0.5 * (B[7] + B[3]) + [-0.25, 0, 0])
]
mesh area = []
mesh note = []

slide "Four copies of the triangle sit in the corners of a box of side a + b. The space they leave is the tilted square, of area c²."
    area = Name("c^2", K + [s / 2, s / 2, 0], 1.2, LEAF)
    note = [
        center{[2.35, 0.5, 0]} Note("empty space", 0.76),
        Name("c^2", [2.35, -0.1, 0], 1.2, LEAF)
    ]
    play Fade(0.6)

slide "Slide the top right triangle down to the bottom left. It meets the triangle there and the two make an a-by-b rectangle."
    area = []
    play Fade(0.3, [&area])
    third.u = 1
    play Lerp(1.8, [&third])

slide "Slide the top left triangle down to the bottom right. Again two triangles make an a-by-b rectangle."
    fourth.u = 1
    play Lerp(1.8, [&fourth])

slide "The box and the four triangles are the same as before, so the empty space has the same area. It is now two squares, of areas a² and b²."
    note = []
    play Fade(0.3, [&note])
    area = [
        Box(K + [a / 2, b + a / 2, 0], [a, a], AZURE, 0.3, 3),
        Box(K + [a + b / 2, a + b / 2, 0], [b, b], EMBER, 0.3, 3),
        Name("a^2", K + [a / 2, b + a / 2, 0], 1.0, AZURE),
        Name("b^2", K + [a + b / 2, a + b / 2, 0], 1.2, EMBER)
    ]
    note = [
        center{[2.35, 0.5, 0]} Note("empty space", 0.76),
        center{[2.35, -0.1, 0]}
            color{LEAF, |tags| 1 in tags}
            color{AZURE, |tags| 2 in tags}
            color{EMBER, |tags| 3 in tags}
            color{INK}
            Tex([text_tag{1} "c^2", "=", text_tag{2} "a^2", "+", text_tag{3} "b^2"], 1.05)
    ]
    play Fade(0.7)

Uses the shared definitions for this lesson's figures.

Between the first step and the last the box is the same box and the four triangles are the same four triangles, moved without stretching, so the space they leave uncovered has the same area in both arrangements. In the first it is the square on the hypotenuse, and in the last it is the two squares on the legs.

This is the picture behind the algebra. The two $a$-by-$b$ rectangles in the final arrangement are the $2ab$ in $(a + b)^2 = a^2 + 2ab + b^2$: the last step of the figure is a drawing of that identity.

The theorem and its proof

Here is what we have found, stated in full and proved step by step.

The proof matches the earlier pictures piece by piece. The square $KLMN$ is the box, and $P$, $Q$, $R$, $S$ are the points where the tilted square touches it. The paragraph about the angles at $P$ is the check that the tilted shape is a square, and the final comparison of areas is the box computation.

Three things were used without proof: the side-angle-side criterion for congruent triangles, the angle sum of a triangle, and the basic rules of area (a square of side $s$ has area $s^2$, a right triangle is half a rectangle, and the areas of pieces that do not overlap add up). All are standard results of plane geometry. The angle sum is the one to notice, because it holds only on a flat surface, and so the Pythagorean theorem does too. We’ll come back to that.

Using the theorem

The theorem ties the three sides together, so any two of them determine the third.

Not every answer comes out whole. A right triangle with both legs equal to 1 has $c^2 = 1 + 1 = 2$, so $c = \sqrt{2} \approx 1.414$, a number that cannot be written as a fraction of whole numbers. The 1-by-2 triangle from earlier has hypotenuse $\sqrt{5} \approx 2.236$. Triples of whole numbers such as 3, 4, 5 and 5, 12, 13 are the exceptions.

Does it work backward?

The theorem starts from a right angle and concludes $a^2 + b^2 = c^2$. Builders use it in the other direction: they mark off sides of 3, 4 and 5 on a rope, pull it tight into a triangle, and trust that the corner between the 3 and the 4 is square. That is a different claim. It starts from the equation and concludes that there is a right angle, and it needs its own argument.

To get a feeling for it, take two rods of lengths 3 and 4 joined by a hinge, and watch the square of the distance $c$ between their free ends as the hinge opens and closes.

Two rods of lengths 3 and 4 are joined by a hinge. As the angle between them changes, $c^2$ is compared with $3^2 + 4^2 = 25$. It is smaller when the angle is less than 90°, larger when the angle is more than 90°, and equal only at 90°.
Monocurl source
let C = [-2.45, -1.3, 0]
let K = 0.55
let X0 = 0.4
let S = 0.085
let Hinge = |deg| {
    let th = rad(deg)
    let B = C + [4 * K, 0, 0]
    let A = C + 3 * K * dir(th)
    let c2 = 25 - 24 * cos(th)
    var col = ROSE
    if (abs(deg - 90) < 0.6) {
        col = LEAF
    }
    let mid = 0.5 * (A + B)
    let out = normalize(mid - C)
    return [
        Wedge(C, 0, th, SLATE, 0.45),
        Path([A, C, B], INK, 4),
        Seg(C, A, AZURE, 5),
        Seg(C, B, EMBER, 5),
        Seg(A, B, col, 5),
        Pt(C, INK, 0.09),
        Name("3", 0.5 * (A + C) + 0.3 * dir(th + PI / 2), 0.8, AZURE),
        Name("c", mid + 0.3 * out, 0.8, col),
        fill{tint(col, 0.5)} stroke{col, 2.5} Polygon([
            [X0, -0.75, 0], [X0 + c2 * S, -0.75, 0], [X0 + c2 * S, -0.3, 0], [X0, -0.3, 0]
        ]),
        center{[X0 + 1.2, -1.1, 0]} scale{1.25} color{col} Number(c2, 1),
        center{[C[0] + 0.55, C[1] - 0.75, 0]} scale{1.15} color{SLATE} Number(deg, 0)
    ]
}
mesh fixed = [
    Box([X0 + 4.5 * S, 0.95, 0], [9 * S, 0.45], AZURE, 0.5, 2.5),
    Box([X0 + 17 * S, 0.95, 0], [16 * S, 0.45], EMBER, 0.5, 2.5),
    Name(str_join(["3^2 + 4^2 = ", to_string(9 + 16)]), [X0 + 1.2, 1.55, 0], 0.85),
    Seg([X0 + 25 * S, 1.35, 0], [X0 + 25 * S, -0.95, 0], SLATE, 2),
    Name("c^2 =", [X0 + 0.3, -1.12, 0], 0.85),
    Name("4", C + [2 * K, -0.3, 0], 0.8, EMBER),
    center{[C[0] + 1.75, C[1] - 0.75, 0]} Note("degrees at the hinge", 0.72)
]
mesh hinge = Hinge(deg: 90)

slide "swing"
    play Wait(1)
    hinge.deg = 55
    play Lerp(2.2, [&hinge])
    play Wait(0.5)
    hinge.deg = 125
    play Lerp(3.5, [&hinge])
    play Wait(0.5)
    hinge.deg = 90
    play Lerp(2.2, [&hinge])
    play Wait(1.5)

Uses the shared definitions for this lesson's figures.

Closing the hinge brings the free ends together and $c^2$ drops below 25. Opening it pushes them apart and $c^2$ rises above 25. Since $c$ only grows as the hinge opens, it passes through the value with $c^2 = 25$ once, and the theorem tells us that this happens at 90°. So among all triangles with sides 3 and 4, only the right-angled one has third side 5. That is an informal argument, since “only grows” was read off the animation. Here is the statement with a proof that does not depend on it.

The proof uses the original theorem as a tool: it builds the right triangle we wish we had, lets the theorem compute its third side, and then observes that the given triangle has no room to be anything else.

Pause and try

Which of these are the side lengths of a right triangle? (a) 7, 24, 25. (b) 5, 6, 8. For the one that is not, use the hinge animation to say whether the angle opposite its longest side is smaller or larger than 90°.

Show answerHide answer

(a) $7^2 + 24^2 = 49 + 576 = 625 = 25^2$, so by the converse this is a right triangle, with the right angle opposite the side 25. (b) $5^2 + 6^2 = 25 + 36 = 61$, while $8^2 = 64$. These differ, so the triangle is not right-angled: if it were, the theorem would force $61 = 64$. The longest side is too long for a right angle, since $64 > 61$, and the hinge shows that this happens when the angle is opened past 90°. The angle opposite the side 8 is obtuse.

The last part of that answer uses a fact the hinge suggested and we have not proved: when the angle between sides $a$ and $b$ is less than 90° the third side satisfies $c^2 < a^2 + b^2$, and when it is more than 90°, $c^2 > a^2 + b^2$. The final problem at the end of the lesson asks you to prove it. It also marks the limit of the theorem. For a triangle without a right angle, $a^2 + b^2 = c^2$ is false for every choice of which side to call $c$.

Distance between two points

The most common use of the theorem does not look like a triangle problem at all. Take two points on a coordinate grid, say $(1, 1)$ and $(6, 3)$. How far apart are they?

The distance between the points (1, 1) and (6, 3). A horizontal run of 5 and a vertical rise of 2 are the legs of a right triangle, and the distance is its hypotenuse, \sqrt{29} \approx 5.39.
The distance between the points $(1, 1)$ and $(6, 3)$. A horizontal run of 5 and a vertical rise of 2 are the legs of a right triangle, and the distance is its hypotenuse, $\sqrt{29} \approx 5.39$.
Monocurl source
let fr = Frame(0, 7, 0, 4, [-0.2, 0, 0], 5.25, 3.0)
let x1 = 1
let y1 = 1
let x2 = 6
let y2 = 3
let d2 = (x2 - x1) ^ 2 + (y2 - y1) ^ 2
mesh grid = GridLines(fr, [1, 2, 3, 4, 5, 6, 7], [1, 2, 3, 4])
mesh axes = [Axes(fr, "x", "y"), XTicks(fr, [1, 2, 3, 4, 5, 6]), YTicks(fr, [1, 2, 3])]
mesh tri = [
    Region([at(fr, x1, y1), at(fr, x2, y1), at(fr, x2, y2)], tint(SLATE, 0.14)),
    Square90(at(fr, x2, y1), [-1, 0, 0], [0, 1, 0], SLATE, 0.22),
    Seg(at(fr, x1, y1), at(fr, x2, y1), AZURE, 5),
    Seg(at(fr, x2, y1), at(fr, x2, y2), EMBER, 5),
    Seg(at(fr, x1, y1), at(fr, x2, y2), LEAF, 5),
    Pt(at(fr, x1, y1), INK, 0.1),
    Pt(at(fr, x2, y2), INK, 0.1)
]
mesh labels = [
    Name(str_join(["6 - 1 = ", to_string(x2 - x1)]), at(fr, 3.5, 0.62), 0.78, AZURE),
    Name("3 - 1", at(fr, 6.55, 2.3), 0.74, EMBER),
    Name(str_join(["= ", to_string(y2 - y1)]), at(fr, 6.55, 1.7), 0.74, EMBER),
    Name(str_join(["\sqrt{", to_string(d2), "} \approx ", to_string(sqrt(d2), 2)]), at(fr, 2.5, 2.55), 0.85, LEAF),
    Name("(1, 1)", at(fr, 0.6, 1.35), 0.74),
    Name("(6, 3)", at(fr, 6.0, 3.45), 0.74)
]

Uses the shared definitions for this lesson's figures.

Travel from the first point to the second in two moves: 5 units to the right, then 2 units up. The grid lines are perpendicular, so those two moves are the legs of a right triangle, and the straight segment joining the points is its hypotenuse. By the theorem its length $d$ satisfies $d^2 = 5^2 + 2^2 = 29$, so $d = \sqrt{29} \approx 5.39$.

For general points $(x_1, y_1)$ and $(x_2, y_2)$ the horizontal move has length $|x_2 - x_1|$ and the vertical move has length $|y_2 - y_1|$, and squaring removes the absolute values.

If the two points lie on the same horizontal or vertical line there is no triangle, but the formula still gives the right answer, because one of the two squares is zero. The distance formula is the Pythagorean theorem written in coordinates, and it is the form in which the theorem appears in much of mathematics, from the equation of a circle to the length of a vector.

Where it fails

The theorem is about right triangles in a flat plane, and both conditions matter. Without the right angle the equation is false, as the hinge showed. Without flatness it is false too. In the previous lesson we met a triangle on a sphere with three right angles, formed by the equator and two lines of longitude a quarter turn apart. Its three sides are all the same length $s$, a quarter of the way around the globe. Whichever side you call the hypotenuse, the theorem would demand $s^2 + s^2 = s^2$, which is false for any $s > 0$. The proof breaks at its first step, where we used the angle sum of 180° to get $\alpha + \beta = 90°$.

Looking back

The obstacle here was measuring a tilted square, whose side is usually not a whole number or even a fraction. The device that got around it was to enclose the awkward shape in a simple one and measure what was left over. That turned a question about a length we could not write down into a question about a box and four triangles, all with areas we could.

The same move, computing one area in two ways and comparing, is one of the most reliable sources of formulas in mathematics. The next lesson uses a cousin of it to find the area of a circle, by cutting the circle up and rearranging the pieces into a shape whose area is easy.

Check yourself

A rectangular field is 60 m long and 25 m wide. How long is the straight path from one corner to the opposite corner?

Problems

Problem 1

A right triangle has legs 8 and 15. Find its hypotenuse.

Show solutionHide solution

$c^2 = 8^2 + 15^2 = 64 + 225 = 289$, and $289 = 17^2$, so $c = 17$. Check: 17 is longer than each leg and shorter than $8 + 15 = 23$.

Problem 2

A right triangle has hypotenuse 13 and one leg 5. Find the other leg.

Show solutionHide solution

The unknown is a leg, so $5^2 + b^2 = 13^2$, which gives $b^2 = 169 - 25 = 144$ and $b = 12$.

Problem 3

Find the distance between the points $(-2, 3)$ and $(4, -5)$.

Show solutionHide solution

The horizontal difference is $4 - (-2) = 6$ and the vertical difference is $-5 - 3 = -8$. So $d^2 = 6^2 + (-8)^2 = 36 + 64 = 100$ and $d = 10$. The sign of the $-8$ does not matter, because it is squared.

Problem 4

A doorway is 0.9 m wide and 2.0 m tall. A thin, rigid, circular tabletop has a diameter of 2.15 m. Can it be carried through the doorway without bending it?

Show solutionHide solution

Neither the width nor the height of the doorway is 2.15 m, but a thin flat object can be tilted so that it passes along the diagonal of the opening. The diagonal of the doorway is the hypotenuse of a right triangle with legs 0.9 and 2.0, so its square is $0.9^2 + 2.0^2 = 0.81 + 4 = 4.81$, and its length is $\sqrt{4.81} \approx 2.19$ m. Since $2.15^2 = 4.6225 < 4.81$, the diameter is shorter than the diagonal, and the tabletop fits, with about 4 cm to spare.

Problem 5

Decide whether each set of lengths forms a right triangle: (a) 9, 40, 41; (b) 10, 15, 18; (c) 1, 2, $\sqrt{5}$.

Show solutionHide solution

In each case the only candidate for the hypotenuse is the longest side, so compare its square with the sum of the other two squares.

(a) $9^2 + 40^2 = 81 + 1600 = 1681$ and $41^2 = 1681$. Equal, so by the converse it is a right triangle.

(b) $10^2 + 15^2 = 100 + 225 = 325$ and $18^2 = 324$. These are close but not equal, so it is not a right triangle. (If it were, the theorem would give $325 = 324$.)

(c) $1^2 + 2^2 = 5$ and $(\sqrt{5})^2 = 5$. Equal, so it is a right triangle. This is the 1-by-2 triangle from the start of the lesson.

Problem 6

An equilateral triangle has all three sides of length 2. Find its height and its area. (Hint: the height from one corner meets the opposite side at its midpoint.)

Show solutionHide solution

The height splits the equilateral triangle into two right triangles. Each has hypotenuse 2 (a side of the big triangle) and one leg 1 (half of the base), and its other leg is the height $h$. So $1^2 + h^2 = 2^2$, giving $h^2 = 3$ and $h = \sqrt{3} \approx 1.732$. The area is half the base times the height: $\frac{1}{2} \cdot 2 \cdot \sqrt{3} = \sqrt{3} \approx 1.73$.

Two copies of a right triangle with legs a, b and hypotenuse c stand on a line, one turned a quarter turn from the other, and their top corners are joined. The outline is a trapezoid.
Two copies of a right triangle with legs $a$, $b$ and hypotenuse $c$ stand on a line, one turned a quarter turn from the other, and their top corners are joined. The outline is a trapezoid.
Monocurl source
let a = 1.95
let b = 3.25
let K = [-2.6, -1.6, 0]
let P = K + [b, 0, 0]
let L = K + [a + b, 0, 0]
let T1 = K + [0, a, 0]
let T2 = L + [0, b, 0]
mesh fills = [
    Region([K, P, T1], tint(AZURE, 0.3)),
    Region([P, L, T2], tint(AZURE, 0.3)),
    Region([P, T2, T1], tint(LEAF, 0.25))
]
mesh lines = [
    Outline([K, L, T2, T1], INK, 3),
    Path([T1, P, T2], INK, 3),
    Square90(K, [1, 0, 0], [0, 1, 0]),
    Square90(L, [-1, 0, 0], [0, 1, 0])
]
mesh labels = [
    Name("b", 0.5 * (K + P) + [0, -0.28, 0]),
    Name("a", 0.5 * (P + L) + [0, -0.28, 0]),
    Name("a", 0.5 * (K + T1) + [-0.28, 0, 0]),
    Name("b", 0.5 * (L + T2) + [0.28, 0, 0]),
    Name("c", 0.5 * (P + T1) + [0.22, 0.22, 0], 0.8, LEAF),
    Name("c", 0.5 * (P + T2) + [-0.28, 0.12, 0], 0.8, LEAF)
]

Uses the shared definitions for this lesson's figures.

Problem 7

The figure above shows a proof of the Pythagorean theorem published in 1876 by James Garfield, later a president of the United States. Two copies of the right triangle are placed as shown and their top corners joined, making a trapezoid. (a) Show that the middle triangle has a right angle between its two sides of length $c$. (b) Compute the area of the trapezoid in two ways and deduce $a^2 + b^2 = c^2$. (The area of a trapezoid is half the sum of its parallel sides times the distance between them.)

Show solutionHide solution

(a) At the point on the bottom line where the two triangles meet, three angles lie along a straight line: the angle of the left triangle opposite its leg $a$, the angle of the middle triangle, and the angle of the right triangle opposite its leg $b$. The outer two are the two acute angles of the original triangle, which add to 90°. So the middle angle is $180° - 90° = 90°$. This is the same argument that showed the tilted shape in the box was a square.

(b) The parallel sides of the trapezoid are the two vertical sides, of lengths $a$ and $b$, and the distance between them is the length of the bottom side, $a + b$. So its area is $\frac{1}{2}(a + b)(a + b) = \frac{1}{2}(a^2 + 2ab + b^2)$. On the other hand, the trapezoid is made of two copies of the original triangle, of area $\frac{1}{2}ab$ each, and the middle triangle, which by (a) is a right triangle with both legs $c$ and so has area $\frac{1}{2}c^2$. Therefore

$$ \tfrac{1}{2}(a^2 + 2ab + b^2) = ab + \tfrac{1}{2}c^2. $$

Multiplying by 2 gives $a^2 + 2ab + b^2 = 2ab + c^2$, and subtracting $2ab$ leaves $a^2 + b^2 = c^2$. Garfield’s trapezoid is half of our box, cut along a diagonal of the tilted square.

Left: a triangle with an acute angle at C. Right: a triangle with an obtuse angle at C. In each, H is the foot of the perpendicular from B to the line AC, at distance x from C and height h.
Left: a triangle with an acute angle at $C$. Right: a triangle with an obtuse angle at $C$. In each, $H$ is the foot of the perpendicular from $B$ to the line $AC$, at distance $x$ from $C$ and height $h$.
Monocurl source
let Alt = |C, b, a, deg| {
    let A = C + [b, 0, 0]
    let Bp = C + a * dir(rad(deg))
    let H = [Bp[0], C[1], 0]
    var parts = [
        Region([C, A, Bp], tint(SLATE, 0.14)),
        Seg(Bp, H, ROSE, 3),
        Outline([C, A, Bp], INK, 3),
        Seg(C, H, PLUM, 5),
        Square90(H, [0, 1, 0], [sign(A[0] - H[0] + 0.001), 0, 0], ROSE, 0.17),
        Pt(H, ROSE, 0.07),
        Name("C", C + [0, -0.3, 0]),
        Name("A", A + [0.05, -0.3, 0]),
        Name("B", Bp + [0, 0.3, 0]),
        Name("H", H + [0, -0.3, 0], 0.8, ROSE),
        Name("a", 0.5 * (C + Bp) + 0.28 * dir(rad(deg) + PI / 2)),
        Name("c", 0.5 * (A + Bp) + [0.25, 0.22, 0]),
        Name("x", 0.5 * (C + H) + [0, 0.25, 0], 0.8, PLUM)
    ]
    if (deg > 90) {
        parts .= Name("h", 0.5 * (Bp + H) + [-0.22, 0, 0], 0.8, ROSE)
        parts .= Name("b", 0.5 * (C + A) + [0, -0.3, 0])
    } else {
        parts .= Name("h", 0.5 * (Bp + H) + [0.22, 0, 0], 0.8, ROSE)
        parts .= Name("b - x", 0.5 * (H + A) + [0, -0.3, 0])
    }
    return parts
}
mesh acute = Alt([-3.5, -1.2, 0], 2.7, 2.6, 62)
mesh obtuse = Alt([1.35, -1.2, 0], 2.2, 2.3, 118)
mesh heads = [
    center{[-2.15, 1.85, 0]} Note("angle at C less than 90°", 0.72),
    center{[1.9, 1.85, 0]} Note("angle at C more than 90°", 0.72)
]

Uses the shared definitions for this lesson's figures.

Problem 8

In a triangle $ABC$, write $a = BC$, $b = CA$ and $c = AB$. Let $H$ be the foot of the perpendicular from $B$ to the line $AC$, and write $x = CH$ and $h = BH$, as in the figure above. (a) If the angle at $C$ is less than 90°, then $H$ lies on the same side of $C$ as $A$. Show that $c^2 = a^2 + b^2 - 2bx$, so that $c^2 < a^2 + b^2$. (b) If the angle at $C$ is more than 90°, then $H$ lies on the line $AC$ beyond $C$. Show that $c^2 = a^2 + b^2 + 2bx$, so that $c^2 > a^2 + b^2$.

Show solutionHide solution

In both cases the perpendicular creates two right triangles, $BHC$ and $BHA$, and we apply the Pythagorean theorem to each. The triangle $BHC$ has legs $x$ and $h$ and hypotenuse $a$, so

$$ a^2 = x^2 + h^2. $$

(a) Here $H$ and $A$ are on the same side of $C$, so the distance from $H$ to $A$ is $|b - x|$. The triangle $BHA$ has legs $|b - x|$ and $h$ and hypotenuse $c$, so

$$ c^2 = (b - x)^2 + h^2 = b^2 - 2bx + x^2 + h^2 = b^2 - 2bx + a^2, $$

where the last step replaced $x^2 + h^2$ by $a^2$. Since $b > 0$ and $x > 0$, the term $2bx$ is positive, and $c^2 < a^2 + b^2$. (Squaring makes the absolute value unnecessary, so the computation also covers the case where $H$ falls beyond $A$. If $H$ falls exactly on $A$, the triangle $BHA$ collapses to the segment $BA$, with $c = h$ and $b = x$, and the formula still holds.)

(b) Here $C$ lies between $H$ and $A$, so the distance from $H$ to $A$ is $b + x$. The triangle $BHA$ has legs $b + x$ and $h$, so

$$ c^2 = (b + x)^2 + h^2 = b^2 + 2bx + x^2 + h^2 = a^2 + b^2 + 2bx, $$

and $c^2 > a^2 + b^2$.

Together with the theorem itself, this shows that $c^2$ is less than, equal to, or greater than $a^2 + b^2$ exactly when the angle at $C$ is less than, equal to, or greater than 90°. The correction term $2bx$ is the beginning of the law of cosines.

Shared definitions used by this lesson's figures
# house kit: prepended to every essay figure after the std imports

# palette. AZURE and EMBER are the two actors, LEAF marks an answer, ROSE a problem
let PAPER = [1, 1, 1, 1]
let INK = [0.08, 0.09, 0.11, 1]
let SLATE = [0.40, 0.44, 0.50, 1]
let MIST = [0.85, 0.86, 0.88, 1]
let AZURE = [0.13, 0.42, 0.68, 1]
let EMBER = [0.89, 0.42, 0.12, 1]
let LEAF = [0.13, 0.55, 0.36, 1]
let ROSE = [0.78, 0.22, 0.24, 1]
let PLUM = [0.47, 0.30, 0.66, 1]
let GOLD = [0.85, 0.62, 0.08, 1]

background = PAPER

# an opaque pastel of col; use for fills so overlaps do not darken
let tint = |col, amount = 0.18| [
    1 - (1 - col[0]) * amount,
    1 - (1 - col[1]) * amount,
    1 - (1 - col[2]) * amount,
    1
]

# text: Cap for labels, Note for quiet labels, Math for typeset maths
let Cap = |txt, size = 0.75, col = INK| color{col} Text(txt, size, "Charter")
let Note = |txt, size = 0.65| color{SLATE} Text(txt, size, "Charter")
let Math = |tex, size = 0.9, col = INK| color{col} Tex(tex, size)

# a paper rectangle to sit behind text that crosses lines
let Plate = |pos, size| center{pos} fill{PAPER} stroke{alpha{0} PAPER, 0} Rect(size)

# shapes with fill and stroke both set, so no stray black appears
let Pt = |pos, col = INK, r = 0.075| center{pos} fill{col} stroke{col, 1} Circle(r, 48)
let Ring = |pos, col = INK, r = 0.1, w = 3| center{pos} fill{PAPER} stroke{col, w} Circle(r, 48)
let Seg = |a, b, col = INK, w = 3| stroke{col, w} Line(a, b)
let Path = |pts, col = INK, w = 3| stroke{col, w} Polyline(pts)
let Region = |pts, col| fill{col} stroke{alpha{0} col, 0} Polygon(pts)
let Outline = |pts, col = INK, w = 3| fill{alpha{0} PAPER} stroke{col, w} Polygon(pts)
let Shape = |pts, col, amount = 0.18, w = 3| fill{tint(col, amount)} stroke{col, w} Polygon(pts)
let Disc = |pos, r, col, amount = 0.18, w = 3| center{pos} fill{tint(col, amount)} stroke{col, w} Circle(r, 96)
let Box = |pos, size, col, amount = 0.18, w = 3| center{pos} fill{tint(col, amount)} stroke{col, w} Rect(size)
# a line from a to b ending in a small solid arrowhead
let Tip = |a, b, col = INK, w = 3, head = 0.17| {
    let d = normalize([b[0] - a[0], b[1] - a[1], 0])
    let n = [-d[1], d[0], 0]
    let base = [b[0] - d[0] * head, b[1] - d[1] * head, 0]
    return [
        stroke{col, w} Line(a, base),
        fill{col} stroke{col, 1} Polygon([
            b,
            [base[0] + n[0] * head * 0.42, base[1] + n[1] * head * 0.42, 0],
            [base[0] - n[0] * head * 0.42, base[1] - n[1] * head * 0.42, 0]
        ])
    ]
}

# plots. a frame is [x0, x1, y0, y1, centre, width, height]: a data window and the scene box it fills
let Frame = |x0, x1, y0, y1, c = [0, 0, 0], w = 6.4, h = 3.6| [x0, x1, y0, y1, c, w, h]
let fx = |fr, x| fr[4][0] + (x - (fr[0] + fr[1]) / 2) * fr[5] / (fr[1] - fr[0])
let fy = |fr, y| fr[4][1] + (y - (fr[2] + fr[3]) / 2) * fr[6] / (fr[3] - fr[2])
let at = |fr, x, y| [fx(fr, x), fy(fr, y), 0]

# axes through the data origin (or the nearest edge of the window), with optional names
let Axes = |fr, x_name = "", y_name = "", col = SLATE| {
    let ox = clamp(fr[0], 0, fr[1])
    let oy = clamp(fr[2], 0, fr[3])
    var parts = [
        Tip(at(fr, fr[0], oy), [fx(fr, fr[1]) + 0.25, fy(fr, oy), 0], col, 2.5, 0.15),
        Tip(at(fr, ox, fr[2]), [fx(fr, ox), fy(fr, fr[3]) + 0.25, 0], col, 2.5, 0.15)
    ]
    if (x_name != "") {
        parts .= center{[fx(fr, fr[1]) + 0.5, fy(fr, oy), 0]} Math(x_name, 0.8, col)
    }
    if (y_name != "") {
        parts .= center{[fx(fr, ox), fy(fr, fr[3]) + 0.5, 0]} Math(y_name, 0.8, col)
    }
    return parts
}

# tick marks with numbers at the listed data values
let XTicks = |fr, xs, col = SLATE, places = 0| block {
    let oy = fy(fr, clamp(fr[2], 0, fr[3]))
    for (x in xs) {
        . Seg([fx(fr, x), oy - 0.07, 0], [fx(fr, x), oy + 0.07, 0], col, 2)
        . center{[fx(fr, x), oy - 0.33, 0]} Math(to_string(x, places), 0.72, col)
    }
}
let YTicks = |fr, ys, col = SLATE, places = 0| block {
    let ox = fx(fr, clamp(fr[0], 0, fr[1]))
    for (y in ys) {
        . Seg([ox - 0.07, fy(fr, y), 0], [ox + 0.07, fy(fr, y), 0], col, 2)
        . center{[ox - 0.36, fy(fr, y), 0]} Math(to_string(y, places), 0.72, col)
    }
}

# faint grid lines at the listed data values
let GridLines = |fr, xs, ys, col = MIST| block {
    for (x in xs) {
        . Seg(at(fr, x, fr[2]), at(fr, x, fr[3]), col, 1.5)
    }
    for (y in ys) {
        . Seg(at(fr, fr[0], y), at(fr, fr[1], y), col, 1.5)
    }
}

# the graph of f over [a, b], drawn in the frame. values are clamped to the window
let Graph = |fr, f, a, b, col = AZURE, w = 4, n = 160|
    stroke{col, w} Polyline(map(sample(a, b, n), |x| at(fr, x, clamp(fr[2], f(x), fr[3]))))

# the region between the graph of f and the x axis over [a, b]
let AreaUnder = |fr, f, a, b, col = AZURE, amount = 0.2, n = 80| {
    var pts = [at(fr, a, 0)]
    for (x in sample(a, b, n)) {
        pts .= at(fr, x, clamp(fr[2], f(x), fr[3]))
    }
    pts .= at(fr, b, 0)
    return fill{tint(col, amount)} stroke{alpha{0} col, 0} Polygon(pts)
}

let dir = |th| [cos(th), sin(th), 0]
let rad = |d| d * PI / 180
let heading = |p, q| arctan2(q[1] - p[1], q[0] - p[0])
let Wedge = |p, t0, sw, col, r = 0.5| fill{tint(col, 0.5)} stroke{col, 2.5} Polygon(block {
    . p
    for (t in sample(t0, t0 + sw, to_int(max(8, ceil(sw * 14))))) {
        . p + r * dir(t)
    }
})
let Name = |txt, pos, size = 0.8, col = INK| center{pos} Math(txt, size, col)
# the little square that marks a right angle at p, between unit directions s and t
let Square90 = |p, s, t, col = INK, k = 0.2| stroke{col, 2.5} Polyline([p + k * s, p + k * s + k * t, p + k * t])
# a box of side a + b with corner k, and the four points that cut each side into a and b
let box = |k, a, b| {
    let s = a + b
    return [
        k, k + [s, 0, 0], k + [s, s, 0], k + [0, s, 0],
        k + [a, 0, 0], k + [s, a, 0], k + [b, s, 0], k + [0, b, 0]
    ]
}
let SOFT = 0.3