‹ Class 9 · Ch 11
The World of Algorithms · Principle 25 of 29

Remainders keep the gcd

gcd(m, n) = gcd(n, m mod n)

Stuck? Ask Guru

NCERT: 11.3.4 Āryabhaṭa's Division Algorithm

Think

Jump straight to the remainder

We saw that gcd(m, n) = gcd(n, m − n). Doing that step again and again until we cannot is the same as one division.
For 825 and 375: 825 mod 375 = 75.

Is gcd(825, 375) the same as gcd(375, 75)?

What this lesson covers

The idea

A divisor d divides both m and n exactly when it divides both n and m mod n, so gcd(m, n) = gcd(n, m mod n).

Jump straight to the remainder

We saw that gcd(m, n) = gcd(n, m − n). Doing that step again and again until we cannot is the same as one division. For 825 and 375: 825 mod 375 = 75.

Is gcd(825, 375) the same as gcd(375, 75)?

  • Yes
  • No
  • Only sometimes

Tile with the remainder

Pick a block size d. The bars show m = 825, n = 375 and m mod n = 75. Does d tile m and n exactly when it tiles n and m mod n?

Same common divisors again

A divisor d divides both m and n exactly when it divides both n and m mod n. So gcd(m, n) = gcd(n, m mod n).

m mod n is what is left after subtracting n from m as many times as possible, and each subtraction keeps the common divisors the same. So d tiles m and n if and only if it tiles n and m mod n. (The book writes "tiles m and m mod n"; it should be n and m mod n.) gcd(825, 375) = gcd(375, 75) = 75.

Notes

gcd(m, n) = gcd(n, m mod n): a divisor d tiles m and n exactly when it tiles n and the remainder m mod n.

Check yourself

Which pair has the same gcd as (60, 16)?

gcd(99, 2) = gcd(2, 99 mod 2). What is 99 mod 2?

Answer: 1

99 = 49 × 2 + 1, so 99 mod 2 = 1 and gcd(99, 2) = gcd(2, 1).

  • (16, 12) — correct. Yes. 60 mod 16 = 12, so gcd(60, 16) = gcd(16, 12).
  • (60, 12). The rule keeps n and the remainder: (16, 12).
  • (16, 3). 3 is the quotient, not the remainder.