UcenlyOpen in the app

Discrete Mathematics and Graphs · BE5B01DMG · Topic 6 of 12

Divisibility, Euclid and Diophantine equations

Repeated division computes gcd; back substitution turns it into an integer linear combination.

Open the interactive lesson

Key ideas

Division with remainder

For n>0, write any integer m uniquely as qn+r with 0≤r<n. This also works for negative m.

Euclidean algorithm

Replace the pair by divisor and remainder. For 48 and 18: 48=2·18+12, 18=12+6, 12=2·6. The last nonzero remainder is 6.

Bézout identity

Read the divisions backwards: 6=18−12=3·18−48. Thus gcd(a,b) is an integer combination of a and b.

All integer solutions

The equation ax+by=c is solvable exactly when d=gcd(a,b) divides c. For nonzero a,b and a particular solution (x₀,y₀), add the homogeneous solution.

In one line: Check gcd divisibility before spending time finding a particular solution.

Formulas

Practice with worked solutions

Question 1

Compute gcd(48,18) using Euclid’s algorithm.

Worked solution

Answer: 6

  1. 48=2⋅18+1248=2\cdot18+12
  2. 18=1⋅12+6,12=2⋅618=1\cdot12+6,\quad12=2\cdot6
  3. gcd⁡(48,18)=6\gcd(48,18)=6

The last nonzero remainder is 6.

Question 2

Find gcd(84,126).

Worked solution

Answer: 42

  1. 126=84+42;84=2⋅42.126=84+42; 84=2·42.
  2. Thusgcd(84,126)=42.Thus gcd(84,126)=42.

126−84=42 and 84 is twice 42.

Question 3

Compute gcd(1071, 462) with the Euclidean algorithm.

Worked solution

Answer: 21

  1. 1071=2⋅462+1471071=2\cdot462+147
  2. 462=3⋅147+21462=3\cdot147+21
  3. 147=7⋅21+0⇒gcd⁡=21147=7\cdot21+0\Rightarrow\gcd=21

Divide repeatedly and replace the pair by (divisor, remainder) until the remainder is 0.

More Discrete Mathematics and Graphs practice in Ucenly

Sources

Written by Ucenly. Based on the BE5B01DMG course materials: