MathClario
← Back to Middle school
Middle schoolπŸ”’Arithmetic●●○○○· 4 min
πŸ”’

Euclidean algorithm: GCD by successive divisions

A systematic method to find the GCD of two integers. Successive divisions, stop when the remainder hits 0.

The principle

gcd⁑(a,b)\gcd(a, b) doesn’t change if we replace aa by the remainder of aa divided by bb.

gcd⁑(a,b)=gcd⁑(b,r)where a=bq+r\gcd(a, b) = \gcd(b, r) \quad \text{where } a = bq + r

Repeat until the remainder is 0. The last nonzero remainder is the GCD.

Step-by-step

Example: gcd⁑(252,105)\gcd(252, 105).

StepDivisionQuotientRemainder
1252 = 105 Γ— 2 + 42242
2105 = 42 Γ— 2 + 21221
342 = 21 Γ— 2 + 020

gcd⁑(252,105)=21\gcd(252, 105) = 21.

Another example

gcd⁑(1071,462)\gcd(1071, 462):

  • 1071 = 462 Γ— 2 + 147
  • 462 = 147 Γ— 3 + 21
  • 147 = 21 Γ— 7 + 0

GCD = 21.

Why it works

Each step strictly reduces the numbers. The algorithm terminates. GCD is preserved at each step (Euclid’s lemma).

Applications

  • Simplify a fraction: divide top and bottom by their GCD.
  • Solve Diophantine equation ax+by=cax + by = c: solvable iff gcd⁑(a,b)∣c\gcd(a, b) \mid c.
  • Cryptography: extended Euclid appears in RSA.

Common mistakes

  1. Stopping too early: continue until remainder is 0.
  2. Wrong remainder: GCD is the LAST NONZERO remainder.
  3. Confusing remainder and quotient.
?Γ€ toi de jouer

GCD(48, 18) by Euclidean algorithm?

Mini-quiz

Question 1 / 3

GCD(48, 18) via Euclid?

#GCD#algorithm#Euclid#grade 9

You might also like