Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Greatest Common Divisors and Linear Combinations

Let a and b be positive integers. The greatest common divisor of a and b


(“gcd(a, b)”) has a close and very useful connection to things called “linear
combinations” of a and b (defined below). This handout will explain the con-
nection.
Definition 1 Let a and b be positive integers. A linear combination of a and
b is any number
n = ax + by, (1)
where x and y are whole numbers.
Note that although a > 0 and b > 0, the numbers x and y are allowed to
be negative or zero.
Examples. Together in class, we will list some of the linear combinations of
two pairs of integers.

Some linear combinations of a = 9 and b = 12:

y 0 1 -1 2 -2 3 -3 ...
12y ⇒ 0 12 -12 24 -24 36 -36 ...
x 9x ⇓ ...
...
0 0 ...
...
1 9 ...
...
−1 −9 ...
...
2 18 ...
...
−2 −18 ...
...
3 27 ...
...
−3 −27 ...
.. .. .. .. .. .. .. .. .. .. ..
. . . . . . . . . . .

1
Some linear combinations of a = 42 and b = 30:

y 0 1 -1 2 -2 3 -3 ...
30y ⇒ 0 ...
x 42x ⇓ ...
...
0 0 ...
...
1 ...
...
−1 ...
...
2 ...
...
−2 ...
...
3 ...
...
−3 ...
.. .. .. .. .. .. .. .. .. .. ..
. . . . . . . . . . .

Some linear combinations of a = 12 and b = 7:

y 0 1 -1 2 -2 3 -3 ...
7y ⇒ 0 ...
x 12x ⇓ ...
...
0 0 ...
...
1 ...
...
−1 ...
...
2 ...
...
−2 ...
...
3 ...
...
−3 ...
.. .. .. .. .. .. .. .. .. .. ..
. . . . . . . . . . .

2
Notice that—as far as we went, anyway—the numbers that appear in the linear
combinations table for a and b all seem to be multiples of gcd(a, b). Notice also
that in each case, the multiples of gcd(a, b) all seem to be showing up. Both
of these statements turn out to be true, but other interesting facts will emerge
first. Throughout, let a and b be positive integers.
Theorem LC# 1 Let a and b be positive integers, and let ax + by be a linear
combination of a and b. For any integer d: if d a and d b, then d ax + by.

Proof . Since d a (given) and a ax (obvious), by Property C on the Divisibility
Handout, we get
d ax. (2)

By the same token: since d b (given) and a by (obvious), by Property C on
the Divisibility Handout, we get

d by. (3)
Now, we can apply Property A of the Divisibility Handout to Equations (2)
and (3):
d ax + by.
Proof of Theorem LC#1 is complete.
The next step is to show that gcd(a, b) itself will always show up in the linear
combinations table of a and b; we will do this by identifing a particular linear
combination in the table that will turn out to be the gcd. Which one will
work? Well, if we are correct in our guess that all the numbers in the table are
multiples of the gcd, then the gcd must be the smallest positive number1 in the
table. (Note that “positive” means strictly positive. Zero does not count here.)
So, we will focus on the smallest positive number in the table and try to show
that this number is indeed gcd(a, b). Let us call this number d0 . Since d0 is in
the table, it is a linear combination of a and b; that is, there are integers x0 and
y0 such that d0 = ax0 + by0 . To summarize:
d0 = ax0 + by0 is the smallest positive linear combination of a and b. (4)
Now, if d0 is going to turn out to be the greatest common divisor of a and b, it
must in the first place be some common divisor of a and b. Proving this is the
first step.
Theorem LC# 2 d0 divides a.
Proof . First, divide d0 into a, getting a quotient q and a remainder r. Recall
that this means that
a = qd0 + r





and (5)




0 ≤ r ≤ d0 − 1.
1 There have to be positive numbers in the table, of course, so there has to be a smallest

positive number. This is true even though the table itself in infinite.

3
There are two logical possibilities for r: either
⇒(a): r = 0, which would show that a = qd0 (so that d0 a, which is what we
want to prove) or
⇒(b): 1 ≤ r ≤ d0 − 1.
I will show that (b) cannot happen; this will finish the proof.
Proof that (b) cannot happen: Solving the equation “a = qd0 + r” for r
gives
r = a − qd0 ; (6)
then, substituting (ax0 + by0 ) in for d0 in (6) gives
r = a − q (ax0 + by0 ) . (7)
We now make some algebra moves on (7):
Equation (7) repeated −→ r = a − q (ax0 + by0 )
multiply through −→ r = a − qax0 − qby0
factor a out of first two terms −→ r = a (1 − qx0 ) − qby0
factor b out of right-hand term −→ r = a (1 − qx0 ) + b(−qy0 ).
The last line shows that r is a linear combination of a and b. If possibility (b)
were true, then r would be a positive linear combination of a and b that is
smaller than d0 , contradicting the fact that d0 was chosen to be the smallest
positive linear combination of a and b. Thus, (b) cannot happen. Proof of
Theorem LC#2 is complete.
Theorem LC# 3 d0 divides b.
Proof . The proof of this is exactly parallel to the proof of LC#2, and will be
left as an exercise.
Exercise 1. Prove Theorem LC#3.
Up to this point, we have shown that d0 is a common divisor of a and b, but we
don’t yet know that it is the greatest common divisor. To establish this fact, I
will show that if d1 is any common divisor of a and b, then d1 ≤ d0 .

More is true: I will show that in fact d1 d0 . (8)

Theorem LC# 4 If d1 a and d1 b, then d1 d0 .

Proof . Since d1 a and d1 b, by Theorem LC#1, d1 divides any linear combi-
nation (ax + by) of a and b. Since d0 = ax0 + by0 is a linear combination of a
and b [Equation (4)], d1 must divide d0 . Proof of Theorem LC#4 is complete.
Two things are worth emphasizing at this point.
⇒ First, the LARGEST COMMON DIVISOR of a and b is the SMALL-
EST POSITIVE LINEAR COMBINATION of a and b.
⇒ Second, as (8) indicates, the gcd of a and b is not only LARGER than every
other common divisor; it is a MULTIPLE of every other common divisor.
The final theorem in this group is the one that confirms the pattern we observed,
namely that all of the table entries seem to be multiples of the gcd and that all
the multiples of the gcd seem to be showing up in the table.

4
Theorem LC# 5 Let a and b be positive integers, and let d0 = ax0 + by0 be
the gcd 2 of a and b. Then, for any integer n:
 
 n is a linear 
⇐⇒ d0 n.
combination of a and b
 

Comment on how to prove this. As mentioned before the proof of Theorem EA1
on the previous handout, the “⇐⇒” means two things:
If n is a linear combination of a and b, then n will also be a multiple
of d0 ( the “=⇒”);
and
If n is a multiple of d0 , then n will also be a linear combination of a
and b (the “⇐=”).
These two things must be proved separately.
Proof (=⇒): By Theorems LC#2 and LC#3, we know that d0 a and d0 b, so
that by theorem LC#1, d0 will divide every linear combination of a and b. But
we’re given that n is a linear combination of a and b, so necessarily d0 n. Proof
of =⇒ is complete.
Proof (⇐=): We’re given that d0 n, so that, for some k,

n = kd0 . (9)

The proof consists of replacing d0 by (ax0 + by0 ) in Equation (9) and making
some algebra moves:

Equation (9) repeated −→ n = kd0


make the replacement −→ n = k(ax0 + by0 )
multiply through −→ n = kax0 + kby0
change order of multiplication in each term −→ n = a(kx0 ) + b(ky0 )

The last equation above shows that n is a linear combination of a and b. Proof
of ⇐= is complete.

2 d was defined to be the smallest positive number in the linear combinations table, but
0
we have now proved that d0 = gcd(a, b).

You might also like