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 ad. 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; ab if   a<b or   a=b.

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

  1. a=bq+r
  2. 0r<|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. 1510 = 150   in   , 150 = 436+6,  and 1510 = 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=1517+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. 0r<|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. 0r<|b|
  2. q,r such that a=bq+r and 0r<|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. 0r<|b|.
    1. Since r=a-qb then a=bq+r.
    2. Since bqa and b(q+1)>a, 0a-bq and b>a-bq. So 0r and b>r.
  2. Assume q1,r1 and a=bq1+r1 and 0r1<|b| and assume q2,r2 and a=bq2+r2 and 0r2<|b|. To show: q1=q2 and r1=r2 Since a-r1=bq1 and 0r1<|b|, bq1 is the largest integer in b which is a. Since a-r2=bq2 and 0r2<|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   0r<|b|   then   gcd(a,b)=gcd(b,r). 1288 = 1144+144 1144 = 7144+136 9144 = 1296 144 = 136+8 8144 = 1152 136 = 178+0. 7144 = 1008 So gcd(1288,144) = gcd(1144,144) = gcd(144,136) = gcd(136,8) = gcd(8,0) = 8. Note: 8 = 144-136 = 144-(1144-7144) = 8144-1144 = 8(1288-1144)-1144 = 81288-91144

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

Proof.
Let l>0 be minimal such that lx+m. To show:   l=x+m To show:
  1. lx+m
  2. x+ml.
  1. Since lx+m, lx+m
  2. Assume yx+m. To show:   yl. Since l is minimal yl. So y=ql+r   with   0r<l. So r=y-qlx+m. So r=0,   since  l  is minimal positive integer in   x+m. So y=ql. So yl. 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 xl, then   l|x. Since ml, then   l|m. Since d=gcd(x,m), then   l|d.
  2. Since d|x and d|m, then xd and md. So x+md. So ld. So ld. So d|l.

Notes and References

Where are these from?

References

References?

page history