Book II · Proposition 5

II.5

If a straight line be cut into equal and unequal segments, the rectangle contained by the unequal segments of the whole together with the square on the straight line between the points of section is equal to the square on the half.Heath, 1908

Euclid's tool for solving quadratics: ab + ((a-b)/2)^2 = ((a+b)/2)^2.

ABCDFEGHK
38 lines and circles drawn, of which 27 helper constructions drew the fainter ones

Every step, checked

What it needs, and what needs it

Needs: I.10 I.43 I.46

Used by: II.6 II.14 III.35 VI.27 VI.28 X.17

Rests on: C.N.1, C.N.2, C.N.3, C.N.4, C.N.5, Def.10, Def.15, Def.22, Def.4, Post.5

Depth: 12 steps of argument above the first principles. Parallel postulate: needed.

What it takes on trust

The proposition as code

@proposition(
    "II.5",
    THEOREM,
    sample=_adjacent_segments,
    note="Euclid's tool for solving quadratics: ab + ((a-b)/2)^2 = ((a+b)/2)^2.",
)
def prop_II_5(a: Point, b: Point, c: Point) -> Out:
    """AC is bisected at D and cut unequally at B."""
    hypothesis("B cuts AC unequally", between(a, b, c))
    middle = posit(prop_I_10(a, c).midpoint, "D")
    hypothesis("the two sections are distinct", middle != b)
    outline(a, c, close=False)

    # The rectangle on the unequal segments stands above the line, the square on
    # the half below it, so the two areas being compared can be seen at once.
    rectangle = _rectangle(a, b, _across(b, c), "E", "F")
    square = _rectangle(middle, c, _across(c, middle), "H", "G")

    first, second = length(a, b), length(b, c)
    half, offset = length(a, middle), length(middle, b)
    because(prop_I_46, middle, c)
    # Euclid's gnomon: the square on the half, cut by the diameter, has the
    # piece between the sections standing at the corner, and I.43 makes the two
    # complements equal. K is that corner, taken along the diameter.
    _fraction = offset / half
    _corner = posit(Point(square[0].x + _fraction * (square[2].x - square[0].x),
                          square[0].y + _fraction * (square[2].y - square[0].y)), "K")
    because(prop_I_43, square[0], square[1], square[2], square[3], _corner)

    claim("D bisects AC", "I.10", eq_len(a, middle, middle, c))
    claim("the drawn rectangle is contained by the unequal segments", "Def.22",
          _area(*rectangle) == first * second)
    claim("and the drawn square is the square on the half", "I.46",
          _area(*square) == half * half)
    claim("the rectangle on the unequal segments, with the square on the piece between "
          "the sections, equals the square on the half", ["I.43", "I.46"],
          _area(*rectangle) + offset * offset == _area(*square))
    return Out(midpoint=middle, rectangle=rectangle, square=square)