Lecture 2: Greatest Common Divisors

Recap and Summary

Last class period we talked at length about divisibility and the division algorithm. Today we moved on to discuss the concept of greatest common divisors. We finished by describing some properties that greatest common divisors enjoy, including the (surprisingly powerful) result that the gcd of two integers a and b can be expressed as an integral linear combination of a and b.

A few comments on the divisibility and the division algorithm

Along with the language we already established — namely that an integer d divides a, or that d is a divisor of a — there are plenty of other equivalent expressions. For instance, if there exists an integer q so that

(1)
$$a = dq$$

then one can say that "d divides a," that " d is a divisor of a," that ''dq is a factorization of a," or that "a is a multiple of d." All of these expressions capture the same equation above, and they should be pretty familiar vocabulary to all of you.

It is also worth pointing out the division algorithm gives us a way to measure the success or failure of one integer dividing another. What we mean by this is the following. In the case that $d \mid a$, we have an equation $a = dq$ which is satisfied. In the case that $d \nmid a$, however, the definition of divisibility doesn't give us an equation we can write down. The division algorithm, however, let's use write an equation of the form $a = dq + r$ (with $0 \leq r < d$) regardless of the divisibility of d and a. In fact, the remainder term tells us precisely whether we're in the case $d \mid a$ or the case $d \nmid a$. Being able to write down such an equation winds up being critically important in many circumstances, as you'll find in this week's assignment.

Finally, we provide an example of the division algorithm in action.

Example: The Division Algorithm

Suppose you wanted to run the division algorithm on $d = 11$ and $a=120$. Playing around with various multiples of 11, we see that $11\cdot 10$ is the smallest multiple of d which is less than or equal to a. Hence if we choose q as 10, then we get the equation

(2)
\begin{align} 120 = 11\cdot 10 + 10. \end{align}

In this case, we see that the division algorithm gives us $q = r = 10$. $\square$

Greatest Common Divisors

For two integers a and b, it is often useful to know if there are any numbers d so that $d \mid a$ and $d \mid b$. For obvious reasons, such a number is called a common divisor. Certainly common divisors exist for any pair of integers a and b, since we know that 1 always divides any integer. We also know that common divisors can't get too big since divisors can't be any larger than the number they are dividing; hence a common divisor d of a and b must have $d \leq a$ and $d \leq b$, so that $d \leq \min\{a,b\}$. With all this as motivation, we have the following

Definition: The greatest common divisor of two integers a and b, written $(a,b)$, is the largest integer d so that $d \mid a$ and $d \mid b$. More generally, if you have a collection of integers $a_1, \cdots, a_r$, then the greatest common divisor of the collection $a_1,\cdots,a_r$, written $(a_1,\cdots,a_r)$, is the largest integer d so that $d \mid a_i$ for every i.

Example: Non-trivial GCD

Suppose we'd like to know the greatest common divisor of 12 and 15. We can see that

• the divisors of 12 are $\{\pm 1, \pm 2, \pm 3, \pm 4, \pm 6, \pm 12\}$
• the divisors of 15 are $\{\pm 1, \pm 3, \pm 5, \pm 15\}$

The largest number which is a member of both of these sets — and hence the greatest common divisor of 12 and 9 — is therefore 3. So we have shown (12,9) = 3.$\square$

Example: Trivial GCD

If we want to know the greatest common divisor of 21 and 10, then we write down their divisors:

• the divisors of 21 are $\{\pm 1, \pm 3, \pm 7, \pm 21\}$
• the divisors of 10 are $\{\pm 1, \pm 2, \pm 5, \pm 10\}$.

Hence we know that (21, 10) = 1.$\square$

Example: GCD of a collection

Looking at the lists of divisors we've already written out, we can see that the greatest common divisor of 12, 15 and 10 is 1, so that (12, 15, 10) = 1.$\square$

Example: GCDs with 0

We finish by noting that $(0,n) = |n|$ for any $n \in \mathbb{Z}$. This follows since 0 has the property that every integer divides it. Since $|n|$ is the largest divisor of n, this means that $(0,n) = |n|$.$\square$

Of particular interest in number theory are integers which do not share a common divisor, and because of their importance they get their own special name.

Definition: Two integers a and b are said to be relatively prime if $(a,b)$ = 1; i.e., if a and b share no common non-trivial divisors. A collection $a_1, \cdots, a_r$ is relatively prime if $(a_1,\cdots, a_r) = 1$. A collection $a_1,\cdots,a_r$ is said to be pairwise relatively prime if $(a_i,a_j)=1$ whenever $i \neq j$.

In the examples above, we see that 21 and 10 are relatively prime, and that the collection $\{10, 12, 15\}$ is relatively prime. Notice in this last example that the collection is relatively prime even though each pair of integers from the collection is not relatively prime. (As a general rule of thumb, you'll care more about whether a collection is pairwise relatively prime than whether it's relatively prime).

Properties of the GCD

Having met and played around with greatest common divisors a bit, we'll now introduce a few properties that they enjoy.

Removing the GCD

First, we'll see what we get when we remove the gcd of two integers.

Lemma: For any pair of integers a and b, we have $\displaystyle \left(\frac{a}{(a,b)},\frac{b}{(a,b)}\right) = 1$.

Proof: Since $(a,b) \mid a$ and $(a,b) \mid b$, there exist integers $q_a,q_b$ so that

(3)
\begin{align} a = (a,b)q_a \quad \mbox{ and } \quad b = (a,b)q_b. \end{align}

Our goal, then, is to show that $(q_a,q_b) = 1$. For this, suppose that there were some common divisor $d>1$ of both $q_a$ and $q_b$. This would imply that there exist integers $c_a,c_b$ satisfying

(4)
\begin{align} q_a = dc_a \quad \mbox{ and } q_b = dc_b. \end{align}

Putting this together with the previous equation, we'd then have

(5)
\begin{align} a = (a,b)q_a = (a,b) d c_a \quad \mbox{ and } \quad b = (a,b)q_b = (a,b)d c_b. \end{align}

Hence the integer $(a,b)d$ would be a common divisor of a and b which is larger than (a,b). This is a contradiction to the definition of greatest common divisor, and hence we are left to conclude that

(6)
\begin{align} \left(\frac{a}{(a,b)},\frac{b}{(a,b)}\right) = 1. \end{align}

$\square$

You might be tempted to think that the integers a and $\frac{b}{(a,b)}$ are relatively prime; resist the temptation! In general, it is not true that $(a,\frac{b}{(a,b)}) = 1$. $\square$

GCD as a linear combonation

Another surprisingly useful result to have around is the following Proposition, which says that the gcd of two integers a and b can be expressed as a linear combination of the a and b.

Proposition: For any two integers a and b, we have $\displaystyle (a,b) = \min\{ma+nb > 0: m,n \in \mathbb{Z}\}.$

Proof: To prove this result, we'll define $d = \min\{ma+nb > 0: m,n \in \mathbb{Z}\}$, and we'll show that it is in fact the greatest common divisor. Toward this end, we'll start by showing that d is a common divisor of both a and b, then we'll show that all other common divisors divide d (and so all other divisors are no bigger than d).

To show that d is a divisor of a, we'll start by using the Division Algorithm to find integers q and r with $0 \leq r < d$ that satisfy $a = qd + r$. Using the fact that $d = ma + nb$ for appropriately chosen integers m and n, this means we have

(7)
$$r = a - qd = a-q(ma+nb) = (1-qm)a+(-qn)b.$$

But since d is chosen as the minimum positive integral linear combination of a and b, we therefore have $r = 0$, and so $a = qd$. Hence $d \mid a$, and a similar proof shows that $q \mid b$. So d is a common divisor.

Now we show that any other common divisor k of a and b is also a divisor of d, from which we conclude that $|k| \leq d$; this ensures that d is the greatest common divisor, as claimed. To show that $k \mid d$, we note that since $k \mid a$ and $k \mid b$, then we have k divides any integral linear combination of a and b. In particular, we have

(8)
\begin{align} k \mid ma+nb = d. \end{align}

$\square$

Corollary: Two integers a and b are relatively prime if and only if 1 can be written as an integral linear combination of a and b.

Another interesting property which the gcd of two integers has is that all other common divisors of a and b will divide (a,b). We actually proved this in the midst of the proof of the last theorem, so we can write is as a

Corollary: For any pair of integers a and b, a common divisor d has $d \mid (a,b)$.

As a final corollary, we note that since the gcd of two numbers is their smallest positive integral linear combination, any positive number smaller than their gcd cannot be expressed as an integral linear combination.

Corollary: If k is a positive integer which is smaller than $(a,b)$, then there are no integers x and y so that the equation $k = xa+yb$ holds.

Divisibility and Relatively Prime Integers

One of the real benefits of using relatively prime integers is that they let you conclude certain statements about divisibility which you might not usually get to make. For instance, if you are told that $a \mid bc$, you might be tempted to conclude that $a \mid b$ or $a \mid c$. In general, though, this is false (can you find a counterexample?). When you have some ''nice'' property involving relatively prime integers, however, you can call on a result such as this.

Lemma: If $(a,b) = 1$ and $a \mid bc$, then $a \mid c$.

I won't prove this for you now, since this is one of your homework exercises.