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

Subtract and keep the gcd

Reducing gcd by subtraction

Stuck? Ask Guru

NCERT: 11.3.3 Euclid's Subtraction Algorithm — Reducing a problem to a simpler one

Think

A smaller pair

Euclid's idea starts from one observation. Take m = 825 and n = 375, so m − n = 450.

Do the pairs (825, 375) and (375, 450) have the same common divisors?

What this lesson covers

The idea

For m ≥ n, gcd(m, n) = gcd(n, m – n), because the pairs have exactly the same common divisors.

A smaller pair

Euclid's idea starts from one observation. Take m = 825 and n = 375, so m − n = 450.

Do the pairs (825, 375) and (375, 450) have the same common divisors?

  • Yes, exactly the same
  • No: 450 has different divisors
  • Only 1 is common to both pairs

Tile the bars

Pick a block size d. The bars show m = 825, n = 375 and m − n = 450 cut into blocks of size d. Compare: does d tile both m and n? Does it tile both n and m − n?

Same common divisors

For m ≥ n, gcd(m, n) = gcd(n, m − n), because the two pairs have exactly the same common divisors.

• If d divides m and n, write m = ad and n = bd. Then m − n = ad − bd = (a − b)d, so d divides m − n. • If d divides n and m − n, write n = xd and m − n = yd. Then m = n + (m − n) = (x + y)d, so d divides m. If d tiles m and n, it also tiles m − n, and the converse is true too. So gcd(825, 375) = gcd(375, 450) = 75.

Notes

For m ≥ n: gcd(m, n) = gcd(n, m − n). A block size d tiles m and n exactly when it tiles n and m − n.

Check yourself

d divides both m and n. Why must d divide m − n?

gcd(825, 375) = gcd(375, 450). What is gcd(375, 450)?

Answer: 75

The common divisors are the same, so the gcd is the same: 75.

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

  • m − n = ad − bd = (a − b)d — correct. Yes. m − n is a whole number of blocks of size d.
  • Because m − n is smaller than m. Being smaller is not enough: 7 is smaller than 10 but 5 does not divide 7.
  • Because d is the gcd. This works for every common divisor d, not just the gcd.
  • (16, 44) — correct. Yes. 60 − 16 = 44, so gcd(60, 16) = gcd(16, 44).
  • (60, 76). That adds instead of subtracting.
  • (16, 4). 16 − 4 is not 60 − 16; this pair does not come from the rule.