Greatest Common Divisors: Reading
Greatest Common Divisors: Reading
Greatest Common Divisors: Reading
Reading
The reading is contained in section 4.3. Specifically, you should read starting from the section on Greatest Common
Divisors and Least Common Multiples up until the end of the section, but you can ignore everything about prime
numbers and prime factorizations and so forth.
Summary
The greatest common divisor of two integers a and b, not both zero, is the largest positive integer which divides
both a and b. It is denoted gcd(a, b). We define gcd(0, 0) = 0 by convention. The integers a and b are relatively
prime, or coprime, if gcd(a, b) = 1.
Example 1. An important basic example to keep in mind is that, for any integer a, we have gcd(a, 0) = |a|. You
should convince yourself of why this is true.
Theorem 2. Let a and b be integers, not both of which are zero.
(a) There exist integers s and t such that
gcd(a, b) = as + bt.
(b) Every integer that can be written in the form ax + by for some x, y Z is a multiple of gcd(a, b).
Proof. Let q be the quotient of dividing a by b, so that a = bq + r. Then r = a bq, so if d = gcd(a, b), then d | r
using part (d) of the theorem. So d divides both b and r.
If c is a common divisor of b and r, then clearly c also must divide bq + r = a, so c is also a common divisor of
b and a, so c | d. Thus d is a common divisor of b and r, and every common divisor of b and r also divides d, so
d = gcd(b, r).
1
Example 4. Proposition 3 actually gives us a very efficient algorithm for computing greatest common divisors
called the euclidean algorithm. I think its more confusing to describe in the abstract, and the mathematical essense
of the algorithm is just proposition 3, so I wont bother. Instead, lets work through it in an example.
Let a = 96 and b = 9. Dividing, we get 96 = 9 10 + 6. The proposition tells us that
Probably at this point you can compute gcd(9, 6) in your head, but say you couldnt. Well, you can just repeat this
division process! We can write 9 = 6 1 + 3, so
Example 5. By being more careful with the euclidean algorithm, we can actually figure out integers s and t such
that gcd(a, b) = as + bt. Again, lets do this in an example. This is not the most efficient process: you can be
more clever and more efficient by using the extended euclidean algorithm, but the mathematical essence of that
algorithm is the same as whats described here.
Again, lets do this with the example we had before, where a = 96 and b = 9. In the end, we saw that the gcd
was equal to gcd(3, 0) = 3. Notice that at this final step, its really easy to express 3 as a linear combination of 3
and 0: specifically, we can take 3 = 3 1 + 0 0. Now remember that we got to 3 because it was the remainder upon
dividing 9 by 6. We had 9 = 6 1 + 3, which means that 3 = 9 6 1. So lets substitute this in instead of 3, and
we get
3 = (9 6 1) 1 + 0 0 = 9 6 1.
Now remember that we got to 6 because it was the remainder of dividing 96 by 9. In other words, we have
6 = 96 9 10, so again substituting, we get
Clearly a | (asc). We assumed that a | (bc), so a | (btc). Thus a divides both sides of the right hand side, so
a | gcd(a, b) c.
Corollary 7. If a and b are relatively prime integers and a | (bc) for some integer c, then a | c.
The least common multiple of two nonzero integers a and b is the smallest of the positive common multipes of
a and b. It is denoted lcm(a, b). It is closely related to the gcd by the following result.
Proposition 8. Let a and b be positive integers. Then
Proof. This is exercise 31 in Rosen, 4.3. You can prove this using prime factorizations, but you dont need to use
them. It might be good practice to try to prove it without using prime factorizations.
2
Comments
(1) A lot of facts about greatest common divisors can be proved using prime factorizations. Well see a formula for
gcd(a, b) in terms of prime factorizations of a and b next lecture, but there are two reasons its good to be able
to prove things without using prime factorizations.
Firstly, if youre interested in applications, computing prime factorizations is very difficult. For example, it
is much quicker to compute greatest common divisors using the euclidean algorithm. In general, if you find
yourself needing to do anything with greatest common divisors when writing a computer program, youll likely
end up using one of their properties listed in theorem 2.
Secondly, if youre interested in theory, the notion of greatest common divisors generalizes, vaguely speaking,
to the notion of ideals in ring theory. Some rings dont have prime factorizations, but you can still deal with
their ideals like you would deal with greatest common divisors of integers.
(2) Theorem 2 has, as a consequence, that given three integers a, b and d 0, the following three conditions are
equivalent.
(a) d = gcd(a, b).
(b) d is a common divisor of a and b, and every common divisor of a and b is also a divisor of d.
(c) d = as + bt for some integers s and t, and every integer of the form ax + by for some integers x and y is a
multiple of d.
Often, you prove that some integer is the greatest common divisor of some pair by using one of these two
conditions.
Examples
Here is a list of facts that you should be able to prove.
(a) If a and b are relatively prime integers and a | c and b | c for some integer c, then (ab) | c.
(b) If a and a0 are relatively prime integers, then gcd(aa0 , b) = gcd(a, b) gcd(a0 , b) for all integers b.
(c) An integer a is relatively prime to both integers b and c if and only if a is relatively prime to the product bc.
(d) If a, b and n are any integers, then gcd(na, nb) = |n| gcd(a, b).
(e) For all integers a, b and c, we have gcd(gcd(a, b), c) = gcd(a, gcd(b, c)).