Try it yourself · Class 9 Maths · Class 9 Maths: gcd, averages, volumes and probability

Euclid's algorithm as squares: cut a rectangle and read the gcd

Euclid’s algorithm finds the highest common factor by repeated division. The simulation draws it as a rectangle m by n, cuts off the largest squares again and again, and lists each division step beside it.

The rectangle is by . Cut off the biggest squares you can, then repeat on what is left; the side of the last square is the gcd, and .

The simulation needs JavaScript; everything it shows is explained below.

What to change

  • Length m: from 2 to 60 in steps of 1 (start at 48).
  • Width n: from 2 to 60 in steps of 1 (start at 18).
  • Equal numbers (for example 30 and 30) give one square and a gcd equal to the number.

What to watch

  • m = 48, n = 18: there are 3 steps (, , ), the gcd is 6 and the lcm is 144.
  • m = 60, n = 45: only 2 steps, the gcd is 15 and the lcm is 180.
  • m = 35, n = 22: 5 steps and the last square has side 1, so the gcd is 1 and the lcm is 770; the numbers are co-prime.
  • m = 56, n = 42: the gcd is 14 and the lcm is 168.

The formula

are the two numbers, is the quotient (how many squares of side fit) and is the remainder (the strip left over). The last non-zero remainder is the gcd.

Try these questions

Work each one out with the simulation, tap to see the answer, then try the chapter quiz.

  1. Our question

    Evaluate .
    Show the answer
    (A)
  2. Our question

    Find .
    Show the answer
    (C)
  3. Our question

    Without dividing, which of these rational numbers has a terminating decimal expansion?
    Show the answer
    (A)

More to try in Class 9 Maths: gcd, averages, volumes and probability

Every simulation in the Lab