

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Preamble: For integers a and d, the expression “d divides a” means that a/d ∈ Z and assumes that d 6 = 0. It is also written as d|a. Note that any non-zero integer divides 0. If d ∈ Z∗^ divides a ∈ Z, then ±d divides ±a. We may as well assume that d ≥ 1 and that a > 0. If a, b ∈ Z+, then 1 divides both a and b, so the set of positive integers that divide a and b is never empty. If d|a and d|b, then clearly d ≤ min{a, b}. Then defining gcd(a, b) to be the greatest integer that divides both a and b makes sense for a, b ∈ Z+.
Simple things: If a|b, then gcd(a, b) = a. If p is a prime number and 1 ≤ a < p, then gcd(a, p) = 1. When gcd(a, b) = 1, we say that a and b are relatively prime.
Let a, b ∈ Z+^ and suppose that a ≥ b. Then a/b can always be written as a/b = m + f , where m ∈ Z+^ and f ∈ [0, 1) ∩ Q. This representation is unique, and is equivalent to a = mb + r, where r ∈ Z and 0 ≤ r < b. Note that a positive integer d divides both a and b if and only if d divides both b and r. Note also that r < b ≤ a.
To make the notation work out nicely, we rename a and b as a 0 and a 1 , and assume that 1 ≤ a 1 ≤ a 0. We can now write a 0 = m 1 a 1 + a 2 ,
where 0 ≤ a 2 < a 1. m 1 and a 2 are uniquely defined integers. We can define a sequence of numbers as follows. As long as ak+1 > 0, we can define mk+1 and ak+2 by dividing ak by ak+1 and taking the remainder. That is,
ak = mk+1ak+1 + ak+2.
Notice that the ak sequence is strictly decreasing. For some n ≥ 1, an+1 = 0 and we can’t go further. Then an = gcd(a 0 , a 1 ). This is true because gcd(ak− 1 , ak) = gcd(ak, ak+1) for 1 ≤ k ≤ n. The last pair is an and 0, with a greatest common divisor of an, as noted above. Also note that n = 1 if we start with a trivial case such as a 1 = 1 or a 0 = a 1 , since the first remainder, a 2 , would be 0.
Now define a sequence of integers, bk, for 0 ≤ k ≤ n + 1 as follows. bn+1 = 1 and bn = 0. For 1 ≤ k ≤ n, let bk− 1 = bkmk + bk+1.
It turns out that akbk+1 − ak+1bk = gcd(a 0 , a 1 ),
for all k ∈ { 0 , 1 ,... , n}.
How can this be proved? The easiest way is to use 2 × 2 matrices to avoid messy calcu- lations. Let d = gcd(a 0 , a 1 ) let
D =
d 0 0 1
For 1 ≤ k ≤ n, let
Mk =
mk 1 1 0
Note that det D = d and that det Mk = − 1 , ∀ k. Finally, let
Ak =
ak bk ak+1 bk+
for 0 ≤ k ≤ n. Note that An = D, and for 1 ≤ k ≤ n, it is easy to compute
MkAk =
mk 1 1 0
ak bk ak+1 bk+
mkak + ak+1 mkbk + bk+ ak bk
ak− 1 bk− 1 ak bk
= Ak− 1.
This means that
A 0 = M 1 A 1 = M 1 M 2 A 2 = M 1 M 2 M 3 A 3 .. . = M 1 M 2 M 3... MnAn
giving (^) [
a 0 b 0 a 1 b 1
∏^ n
k=
MkD.
The above can also be written as
[ a 0 /d b 0 a 1 /d b 1
∏^ n
k=
Mk.
Also, det A 0 = (−1)nd. Thus
a 0 b 1 − a 1 b 0 = (−1)nd.
If n is even, a 0 b 1 + a 1 (−b 0 ) = d and if n is odd, a 0 (−b 1 ) + a 1 b 0 = d.
The methods described above solve the problem of computing the greatest common di- visor, d, of two positive integers and of expressing d as a “linear combination” of these two integers.