Greatest common divisors and Euclid's algorithm

Arun Ram
Department of Mathematics and Statistics
University of Melbourne
Parkville, VIC 3010 Australia
aram@unimelb.edu.au

Last update: 05 March 2012

Number systems - ℤ, the integers

ℤ={...,(-1)+(-1)+(-1),(-1)+(-1),-1,0,1,1+1,1+1+1,...} with (-1)+1=0,  1+(-1)=0,  0+1=1,  0+(-1)=-1,  1+0=1,  (-1)+0=-1. Let d∈ℤ. The multiples of d is dℤ = {...,(-d)+(-d)+(-d),(-d)+(-d),-d,0,d,d+d,d+d+d,...}. Let a,d∈ℤ. The integer d divides a, d|a, if a∈dℤ. Let x,m∈ℤ. The greatest common divisor of x and m, gcd(x,m), is d∈ℤ>0 such that

  1. d|x and d|m
  2. If l∈ℤ>0 and l|x and l|m then l|d.
Let a,b∈ℤ. Define a<b if there exists   x∈ℤ>0   such that   a+x=b; a≤b if   a<b or   a=b.

(Euclidean algorithm) Let a,b∈ℤ. There exist unique q,r∈ℤ such that

  1. a=bq+r
  2. 0≤r<|b|, where |b|= { b, if   b∈ℤ>0, 0, if   b=0, -b, if   -b∈ℤ>0. }
If (a) and (b) hold write a=r modb.

Example. The 15th row of the multiplication table for ℤ/36ℤ is ⋅ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 15 15 30 9 24 3 18 33 12 27 6 21 36 15 30 9 24 3 18 ⋯ Notice that

  1. 15⋅10 = 150   in   ℤ, 150 = 4⋅36+6,  and 15⋅10 = 6   in   ℤ/36ℤ.
  2. The numbers in row 15 of the multiplication table for ℤ/36ℤ are 3,6,9,15,18,21,24,27,30,33,36 (all multiples of 3 in ℤ/36ℤ)
  3. 3=15⋅17+12(-7)

Let x,m∈ℤ. There exists l∈ℤ>0 such that lℤ=xℤ+mℤ.

Let x,m∈ℤ. Let l∈ℤ>0 such that lℤ=xℤ+mℤ. Let d=gcd(x,m). Then d=l.

(Euclidean algorithm). Let a,b∈ℤ. There exist unique q,r∈ℤ such that

  1. a=bq+r
  2. 0≤r<|b|, where |b|= { b, if   b∈ℤ>0, 0, if   b=0, -b, if   -b∈ℤ>0. }

Proof.
Assume a,b∈ℤ. To show:
  1. There exist q,r∈ℤ such that
    1. a=bq+r
    2. 0≤r<|b|
  2. q,r∈ℤ such that a=bq+r and 0≤r<|b| are unique.
  1. Let bq= the smallest integer in bℤ less than or equal to a and r=a-qb. To show:
    1. a=bq+r
    2. 0≤r<|b|.
    1. Since r=a-qb then a=bq+r.
    2. Since bq≤a and b(q+1)>a, 0≤a-bq and b>a-bq. So 0≤r and b>r.
  2. Assume q1,r1∈ℤ and a=bq1+r1 and 0≤r1<|b| and assume q2,r2∈ℤ and a=bq2+r2 and 0≤r2<|b|. To show: q1=q2 and r1=r2 Since a-r1=bq1 and 0≤r1<|b|, bq1 is the largest integer in bℤ which is ≤a. Since a-r2=bq2 and 0≤r2<|b|, bq2 is the largest integer in bℤ which is ≤a. So   bq1=bq2   and   q1=q2. So   r1=a-bq1=a-bq2=r2.

□

Example. Using Euclids algorithm find gcd(1288,1144) Hodgson says: If   a=bq+r  with   0≤r<|b|   then   gcd(a,b)=gcd(b,r). 1288 = 1144+144 1144 = 7⋅144+136 9⋅144 = 1296 144 = 136+8 8⋅144 = 1152 136 = 17⋅8+0. 7⋅144 = 1008 So gcd(1288,144) = gcd(1144,144) = gcd(144,136) = gcd(136,8) = gcd(8,0) = 8. Note: 8 = 144-136 = 144-(1144-7⋅144) = 8⋅144-1144 = 8(1288-1144)-1144 = 8⋅1288-9⋅1144

Let x,m∈ℤ>0 with 1≤x≤m. There exists l∈ℤ>0 such that lℤ=xℤ+mℤ.

Proof.
Let l∈ℤ>0 be minimal such that l∈xℤ+mℤ. To show:   lℤ=xℤ+mℤ To show:
  1. lℤ⊆xℤ+mℤ
  2. xℤ+mℤ⊆lℤ.
  1. Since l∈xℤ+mℤ, lℤ⊆xℤ+mℤ
  2. Assume y∈xℤ+mℤ. To show:   y∈lℤ. Since l is minimal y≥l. So y=ql+r   with   0≤r<l. So r=y-ql∈xℤ+mℤ. So r=0,   since  l  is minimal positive integer in   xℤ+mℤ. So y=ql. So y∈lℤ. So lℤ=xℤ+mℤ.

□

Let x,m∈ℤ. Let l∈ℤ>0 such that lℤ=xℤ+mℤ. Let d=gcd(x,m). Then d=l.

Proof.
Let d=gcd(x,m). Let l∈ℤ>0 such that lℤ=xℤ+mℤ. To show:   l=d. To show:
  1. d|l
  2. l|d
  1. Since x∈lℤ, then   l|x. Since m∈lℤ, then   l|m. Since d=gcd(x,m), then   l|d.
  2. Since d|x and d|m, then x∈dℤ and m∈dℤ. So xℤ+mℤ⊆dℤ. So lℤ⊆dℤ. So l∈dℤ. So d|l.

□

Notes and References

Where are these from?

References

References?

page history