2. Division Algorithm
Calculating the greatest common divisor of two large numbers make take too much time without a proper algorithm. The following algorithm is central in number theory because it provides an important characteristic of the greatest common divisor
Theorem: (The division algorithm) Given positive integers, a,b with b≠0, there exist unique q and r such that a=qb+r with 0≤r<b.
Proof) Let S={a−qb | q∈Z}∩Z≥0, then we have a∈S, so the set S is nonempty. Z≥0 is the set of all non-negative integers. Also S is bounded below 0 because by our construction. By the well-ordering principle, there exists a minimal element a−qb for some q∈Z. Let r=ab−q and suppose r≥b, then we have ab−q≥b⇒a(b−1)−q≥0, hence a(b−1)−q∈S which contradicts the minimality of r. Hence 0≤r<b. Now for uniqueness, consider if there exist two pairs (q1,r1),(q2,r2) such that
a=q1b+r1
a=q2b+r2
By subtracting the two equations, we get (q1−q2)b+(r1−r2)=0. This implies that b|(r1−r2). Because 0≤r1,r2<b, we see that −b<r1−r2<b, hence in order for b to divide r1−r2, r1−r2 has to equal to 0, hence r1=r2. Then we have (q1−q2)b=0. Since we have assumed b≠0, q1−q2=0⇒q1=q2.
The same result holds for any two integers not both zero by generalizing into the following form:
Theorem: (Generalization) Given two integers a,b with b≠0, there exist unique q and r such that a=qb+r with 0≤r<|b|.
Proof) Exercise for the reader.
Sidenote[Skip this note if you have not taken abstract algebra]: For those who will be taking (have taken) abstract algebra, the ring of integers Z becomes a euclidean domain. Then the unique factorization theorem comes by the fact that the euclidean domain is a UFD(unique factorization domain), or more strongly a PID(Principal Ideal Domain).
As mentioned above, the division algorithm provides an easier way to compute the greatest common divisor of two pairs which is stated as the following lemma:
Lemma: If a=bq+r, then gcd(a,b)=gcd(b,r).
Proof) Let d=gcd(a,b) then d|b and d|a hence d|a−bq=r from the lemma of the previous post. Thus d satisfies the first property of the greatest common divisor for b and r. Suppose we have c|b and c|r, then c|bq+r=a, hence c|gcd(a,b)=d, hence c≤d. By the uniqueness of the greatest common divisor, we see that d=gcd(b,r).
Without loss of generosity, we may assume that a≥b, then as r<|b| we are given a new pair of integers (b,r) that are "smaller" than the original pair (a,b). Continuing the process, we are given with two pairs that are multiple of each other and the divisor becomes the divisor of the original pair. Which can be stated as follows:
Theorem: (The Euclidean Algorithm) Let a,b∈Z with b≠0, then apply division algorithm recursively will give
a=bq+r
b=rq0+r1
r=r1q1+r2
⋮
Then there exists k such that the remainder is 0
rk=rk+1qk+1
Then gcd(a,b)=gcd(rk,rk+1)=rk+1.
Proof) We have sequence of positive numbers |b|>r0>r1>⋯, then after applying at most |b|-times, we see that the remainder has to be 0 at some point. (i.e. the process ends). Then by the lemma above we have gcd(a,b)=gcd(b,r0)=gcd(r0,r1)=⋯gcd(rk,rk+1)=rk+1 as rk+1|rk.
Theorem: If gcd(a,b)=d, then there exist integers x,y such that ax+by=d.
Proof) We reverse the euclidean algorithm. Then observe that rk+1 is a linear combination of rk and rk−1, then by induction we can show that rk+1 is a linear combination of a and b. The detail is omitted is because the proof is tedious.
Corollary: Let a and d be relatively prime, then d|ab, then d|b.
Proof) Because gcd(a,d)=1, there exist x,y such that ax+dy=1, then multiplying b on both side, we get abx+dby=b, then because d|ab and d|d, we see that d|abx+dby=b.
Corollary: Let gcd(a,b)=d, and suppose c|a and c|b then c|d.
Proof) There exist x,y∈Z such that ax+by=d, then by the assumption we clearly see that c|ax+by=d.
Corollary: Let a|m and b|m with a and b be relatively prime, then ab|m.
Proof) There exists q such that aq=m. By the previous corollary, b|m=aq implies that b|q as gcd(a,b)=1, hence there exists r such that q=br, i.e. abr=m. As a result, ab|m.
Comments
Post a Comment