ArtiGram / learning

Euclid's rectangle workshop

Find the greatest common divisor by cutting squares from a rectangle. Step through the geometry, then connect every cut to a division.

Choose an example

These are editable mathematical examples, not measured data. Dimensions must be integers from 1 to 200.

The idea

Keep the leftover.

Fit the largest possible squares along the long side. The leftover is a smaller rectangle. Repeat until nothing remains.

The side of the last square is the largest whole-unit square that tiles your original rectangle exactly.

CutDivisionSquare side

Why the arithmetic works

If a = q x b + r, every common divisor of a and b also divides r. Conversely, every common divisor of b and r divides a. So gcd(a, b) = gcd(b, r).

Replacing the pair with the smaller pair preserves its greatest common divisor. When the remainder is zero, the last nonzero side is the answer.