Book VIII · Proposition 4

VIII.4

Given as many ratios as we please in least numbers, to find numbers in continued proportion which are the least in the given ratios.Heath, 1908

Every step, checked

What it needs, and what needs it

Needs: VII.18 VII.34

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

What it takes on trust

Nothing. It draws no intersections and reads nothing off the picture.

The proposition as code

@proposition(
    "VIII.4",
    CONSTRUCTION,
    sample=lambda rng: (rng.randint(2, 5), rng.randint(2, 5), rng.randint(2, 5),
                        rng.randint(2, 5)),
)
def prop_VIII_4(a: int, b: int, c: int, d: int) -> Out:
    """Given the ratios a:b and c:d, find the least continued proportion in them."""
    hypothesis("the ratios are genuine", all(n > 1 for n in (a, b, c, d)), guard=True)
    first, second = least_terms(a, b)
    third, fourth = least_terms(c, d)
    # The middle term must be measured by both consequents, so take the least
    # number they both measure and scale each ratio up to meet it.
    middle = lcm(second, third)
    terms = [first * (middle // second), middle, fourth * (middle // third)]

    because(prop_VII_18, a, b, c)
    because(prop_VII_34, a, b)

    claim("the first pair keeps its ratio", "VII.18", terms[0] * b == terms[1] * a)
    claim("the second pair keeps its ratio", "VII.18", terms[1] * d == terms[2] * c)
    claim("and the middle is the least that both consequents measure", "VII.34",
          measures(second, middle) and measures(third, middle)
          and not any(measures(second, m) and measures(third, m)
                      for m in range(1, middle)))
    return Out(terms=terms)