Skip to main content

Section 8.1 The Greatest Common Divisor

Beginning Activity Beginning Activity 1: The Greatest Common Divisor

1.

Explain what it means to say that a nonzero integer m divides an integer n. Recall that we use the notation mn to indicate that the nonzero integer m divides the integer n.

2.

Let m and n be integers with m0. Explain what it means to say that m does not divide n.

Definition.

Let a and b be integers, not both 0. A common divisor of a and b is any nonzero integer that divides both a and b. The largest natural number that divides both a and b is called the greatest common divisor of a and b. The greatest common divisor of a and b is denoted by gcd(a,b).

3.

Use the roster method to list the elements of the set that contains all the natural numbers that are divisors of 48.

4.

Use the roster method to list the elements of the set that contains all the natural numbers that are divisors of 84.

5.

Determine the intersection of the two sets in Exercise 3 and Exercise 4. This set contains all the natural numbers that are common divisors of 48 and 84.

6.

What is the greatest common divisor of 48 and 84?

7.

Use the method suggested in Exercise 3 through Exercise 6 to determine each of the following: gcd(8,12), gcd(0,5), gcd(8,27), and gcd(14,28).

8.

If a and b are integers, make a conjecture about how the common divisors of a and b are related to the greatest common divisor of a and b.

Beginning Activity Beginning Acivity 2: The GCD and the Division Algorithm

When we speak of the quotient and the remainder when we “divide an integer a by the positive integer b,” we will always mean the quotient q and the remainder r guaranteed by the Division Algorithm. (See Section 3.5, The Division Algorithm.)

1.

Each row in the following table contains values for the integers a and b. In this table, the value of r is the remainder (from the Division Algorithm) when a is divided by b. Complete each row in this table by determining gcd(a,b), r, and gcd(b,r).

a b gcd(a,b) Remainder r gcd(b,r)
44 12
75 21
50 33

2.

Formulate a conjecture based on the results of the table in Exercise 1.

Subsection The System of Integers

Number theory is a study of the system of integers, which consists of the set of integers, Z={,3,2,1,0,1,2,3,} and the various properties of this set under the usual operations of addition and multiplication and under the usual ordering relation of “less than.” The properties of the integers in Table 8.1 will be considered axioms in this text.

We will also assume the properties of the integers shown in Table 8.2. These properties can be proven from the properties in Table 8.1. (However, we will not do so here.)

Table 8.1. Axioms for the Integers
For all integers a,b, and c:
Closure Proporties for Addition and
Multiplication
a+bZ and abZ
Commutative Properties for Addition
and Multiplication
a+b=b+a, and ab=ba
Associative Properties for Addition
and Multiplication
(a+b)+c=a+(b+c) and
(ab)c=a(bc)
Distributive Properties of Multiplication
over Addition
a(b+c)=ab+ac, and
(b+c)a=ba+ca
Additive and Multiplicative
Identity Properties
a+0=0+a=a, and
a1=1a=a
Additive Inverse Property a+(a)=(a)+a=0
Table 8.2. Properties of the Integers
Zero Property of Multiplication If aZ, then a0=0a=0.
Cancellation Properties of
Addition and Multiplication
If a,b,cZ and a+b=a+c, then b=c.
If a,b,cZ, a0 and ac=bc, then b=c.

We have already studied a good deal of number theory in this text in our discussion of proof methods. In particular, we have studied even and odd integers, divisibility of integers, congruence, and the Division Algorithm. See the summary Section 3.7 for a summary of results concerning even and odd integers as well as results concerning properties of divisors. We reviewed some of these properties and the Division Algorithm in the beginning activities.

Subsection The Greatest Common Divisor

One of the most important concepts in elementary number theory is that of the greatest common divisor of two integers. The definition for the greatest common divisor of two integers (not both zero) was given in Beginning Activity 1.

  1. If a,bZ and a and b are not both 0, and if dN, then d=gcd(a,b) provided that it satisfies all of the following properties:

    • da and db. That is, d is a common divisor of a and b.

    • If k is a natural number such that ka and kb, then kd. That is, any other common divisor of a and b is less than or equal to d.

  2. Consequently, a natural number d is not the greatest common divisor of a and b provided that it does not satisfy at least one of these properties. That is, d is not equal to gcd(a,b) provided that

    • d does not divide a or d does not divide b; or

    • There exists a natural number k such that ka and kb and k>d.

    This means that d is not the greatest common divisor of a and b provided that it is not a common divisor of a and b or that there exists a common divisor of a and b that is greater than d.

In the beginning activities, we determined the greatest common divisors for several pairs of integers. The process we used was to list all the divisors of both integers, then list all the common divisors of both integers and, finally, from the list of all common divisors, find the greatest (largest) common divisor. This method works reasonably well for small integers but can get quite cumbersome if the integers are large. Before we develop an efficient method for determining the greatest common divisor of two integers, we need to establish some properties of greatest common divisors.

One property was suggested in Beginning Activity 1. If we look at the results in Exercise 7 of that beginning activity, we should observe that any common divisor of a and b will divide gcd(a,b). In fact, the primary goals of the remainder of this section are

  1. To find an efficient method for determining gcd(a,b), where a and b are integers.

  2. To prove that the natural number gcd(a,b) is the only natural number d that satisfies the following properties:

    • d divides a and d divides b; and

    • if k is a natural number such that ka and kb, then kd.

The second goal is only slightly different from the definition of the greatest common divisor. The only difference is in the second condition where kd is replaced by kd.

We will first consider the case where a and b are integers with a0 and b>0. The proof of the result stated in the second goal contains a method (called the Euclidean Algorithm) for determining the greatest common divisor of the two integers a and b. The main idea of the method is to keep replacing the pair of integers (a,b) with another pair of integers (b,r), where 0r<b and gcd(b,r)=gcd(a,b). This idea was explored in Beginning Activity 2. Lemma 8.3 is a conjecture that could have been formulated in Beginning Activity 2.

Proof.

Let c and d be integers, not both equal to zero. Assume that q and r are integers such that c=dq+r. For ease of notation, we will let

m=gcd(c,d) and n=gcd(d,r).

Now, m divides c and m divides d. Consequently, there exist integers x and y such that c=mx and d=my. Hence,

r=cdqr=mx(my)qr=m(xyq).

But this means that m divides r. Since m divides d and m divides r, m is less than or equal to gcd(d,r). Thus, mn.

Using a similar argument, we see that n divides d and n divides r. Since c=dq+r, we can prove that n divides c. Hence, n divides c and n divides d. Thus, ngcd(c,d) or nm. We now have mn and nm. Hence, m=n and gcd(c,d)=gcd(d,r).

Progress Check 8.4. Illustrations of Lemma 8.3.

We completed several examples illustrating Lemma 8.3 in Beginning Activity 2. For another example, let c=56 and d=12. The greatest common divisor of 56 and 12 is 4.

(a)

According to the Division Algorithm, what is the remainder r when 56 is divided by 12?

Solution.

The remainder is 8.

(b)

What is the greatest common divisor of 12 and the remainder r?

Solution.

gcd(12,8)=4

(c)

The key to finding the greatest common divisor (in more complicated cases) is to use the Division Algorithm again, this time with 12 and r. We now find integers q2 and r2 such that

12=rq2+r2.

What is the greatest common divisor of r and r2?

Solution.

12=81+4 and gcd(r,r2)=gcd(8,4)=4

Subsection The Euclidean Algorithm

The example in Progress Check 8.4 illustrates the main idea of the Euclidean Algorithm for finding gcd(a,b), which is explained in the proof of the following theorem.

Proof.

Let a and b be integers with a0 and b>0, and let d=gcd(a,b). By the Division Algorithm, there exist integers q1 and r1 such that

(67)a=bq1+r1 , and 0r1<b.

If r1=0, then equation (67) implies that b divides a. Hence, b=d=gcd(a,b) and this number satisfies Condition a and Condition b.

If r1>0, then by Lemma 8.3, gcd(a,b)=gcd(b,r1). We use the Division Algorithm again to obtain integers q2 and r2 such that

(68)b=r1q2+r2 , and 0r2<r1.

If r2=0, then equation (68) implies that r1 divides b. This means that r1=gcd(b,r1). But we have already seen that gcd(a,b)=gcd(b,r1). Hence, r1=gcd(a,b). In addition, if k is an integer that divides both a and b, then, using equation (67), we see that r1=abq1 and, hence k divides r1. This shows that r1=gcd(a,b) satisfies Condition a and Condition b.

If r2>0, then by Lemma 8.3, gcd(b,r1)=gcd(r1,r2). But we have already seen that gcd(a,b)=gcd(b,r1). Hence, gcd(a,b)=gcd(r1,r2). We now continue to apply the Division Algorithm to produce a sequence of pairs of integers (all of which have the same greatest common divisor). This is summarized in the following table:

Original Pair Equation from
Division Algorithm
Inequality from
Division Algorithm
New Pair
(a,b) a=bq1+r1 0r1<b (b,r1)
(b,r1) b=r1q2+r2 0r2<r1 (r1,r2)
(r1,r2) r1=r2q3+r3 0r3<r2 (r2,r3)
(r2,r3) r2=r3q4+r4 0r4<r3 (r3,r4)
(r3,r4) r3=r4q5+r5 0r5<r4 (r4,r5)

From the inequalities in the third column of this table, we have a strictly decreasing sequence of nonnegative integers (b>r1>r2>r3>r4). Consequently, a term in this sequence must eventually be equal to zero. Let p be the smallest natural number such that rp+1=0. This means that the last two rows in the preceding table will be

Original Pair Equation from
Division Algorithm
Inequality from
Division Algorithm
New Pair
(rp2,rp1) rp2=rp1qp+rp 0rp<rp1 (rp1,rp)
(rp1,rp) rp1=rpqp+1+0

Remember that this table was constructed by repeated use of Lemma 8.3 and that the greatest common divisor of each pair of integers produced equals gcd(a,b). Also, the last row in the table indicates that rp divides rp1. This means that gcd(rp1,rp)=rp and hence rp=gcd(a,b).

This proves that rp=gcd(a,b) satisfies Condition a of this theorem. Now assume that k is an integer such that k divides a and k divides b. We proceed through the table row by row. First, since r1=abq, we see that k must divide r1. The second row tells us that r2=br1q2. Since k divides b and k divides r1, we conclude that k divides r2. Continuing with each row, we see that k divides each of the remainders r1, r2, r3, ,rp. This means that rp=gcd(a,b) satisfies Condition b of the theorem.

Progress Check 8.6.

(a)

Use the Euclidean Algorithm to determine gcd(180,126). Notice that we have deleted the third column (Inequality from Division Algorithm) from the following table. It is not needed in the computations.

Original Pair Equation from
Division Algorithm
New Pair
(180,126) 180=1261+54 (126,54)
(126,54) 126=
     

Consequently, gcd(180,126)= .

Solution.

Original Pair Equation from
Division Algorithm
New Pair
(180,126) 180=1261+54 (126,54)
(126,54) 126=542+18 (54,18)
(54,18) 54=183+0

Consequently, gcd(180,126)=18.

(b)

Use the Euclidean Algorithm to determine gcd(4208,288).

Original Pair Equation from
Division Algorithm
New Pair
(4208,288) 4208=28814+176 (288,)
     

Consequently, gcd(4208,288)= .

Solution.

Original Pair Equation from
Division Algorithm
New Pair
(4208,288) 4208=28814+176 (288,176)
(288,176) 288=1761+112 (112,64)
(112,64) 112=641+48 (64,48)
(64,48) 64=481+16 (48,16)
(48,16) 48=163+0

Consequently, gcd(4208,288)=16

Subsection Some Remarks about Theorem 8.5

Theorem 8.5 was proven with the assumptions that a,bZ with a0 and b>0. A more general version of this theorem can be proven with a,bZ and b0. This can be proven using Theorem 8.5 and the results in the following lemma.

The proofs of these results are in Exercise 4. An application of this result is given in the next example.

Example 8.8. Using the Euclidean Algorithm.

Let a=234 and b=42. We will use the Euclidean Algorithm to determine gcd(234,42).

Step Original Pair Equation from
Division Algorithm
New Pair
1 (234,42) 234=425+24 (42,24)
2 (42,24) 42=241+18 (24,18)
3 (24,18) 24=181+6 (18,6)
4 (18,6) 18=63

So gcd(234,42)=6 and hence gcd(234,42)=6.

Subsection Writing gcd(a,b) in Terms of a and b

We will use Example 8.8 to illustrate another use of the Euclidean Algorithm. It is possible to use the steps of the Euclidean Algorithm in reverse order to write gcd(a,b) in terms of a and b. We will use these steps in reverse order to find integers m and n such that gcd(234,42)=234m+42n. The idea is to start with the row with the last nonzero remainder and work backward as shown in the following table:

Explanation Result
First, use the equation in Step 3 to
write 6 in terms of 24 and 18.
6=24181
Use the equation in Step 2 to write
18=42241. Substitute this into
the preceding result and simplify.
6=24181
=24(42241)
=42(1)+242
We now have written 6 in terms of
42 and 24. Use the equation in
Step 1 to write 24=234425.
Substitute this into the preceding
result and simplify
6=42(1)+242
=42(1)+(234425)2
=2342+42(11)

Hence, we can write

gcd(234,42)=2342+42(11).

(Check this with a calculator.) In this case, we say that we have written gcd(234,42) as a linear combination of 234 and 42. More generally, we have the following definition.

Definition.

Let a and b be integers. A linear combination of a and b is an integer of the form ax+by, where x and y are integers.

Progress Check 8.9. Writing the gcd as a Linear Combination.

Use the results from Progress Check 8.6 to

(a)

Write gcd(180,126) as a linear combination of 180 and 126.

Solution.

From Progress Check 8.6, gcd(180,126)=18.

18=126542=126(180126)2=1263+180(2).

So gcd(180,126)=18, and 18=1263+180(2).

(b)

Write gcd(4208,288) as a linear combination of 4208 and 288.

Solution.

From Progress Check 8.6, gcd(4208,288)=16.

16=6448=64(11264)=642112=(176112)2112=17621123=1762(288176)3=17652883=(420828814)52883=42085+288(73).

So gcd(4208,288)=16, and 16=42085+288(73).

The previous example and progress check illustrate the following important result in number theory, which will be used in the next section to help prove some other significant results.

We will not give a formal proof of this theorem. Hopefully, the examples and activities provide evidence for its validity. The idea is to use the steps of the Euclidean Algorithm in reverse order to write gcd(a,b) as a linear combination of a and b. For example, assume the completed table for the Euclidean Algorithm is

Step Original Pair Equation from
Division Algorithm
New Pair
1 (a,b) a=bq1+r1 (b,r1)
2 (b,r1) b=r1q2+r2 (r1,r2)
3 (r1,r2) r1=r2q3+r3 (r2,r3)
4 (r2,r3) r2=r3q4+0

We can use Step 3 to write r3=gcd(a,b) as a linear combination of r1 and r2. We can then solve the equation in Step 2 for r2 and use this to write r3=gcd(a,b) as a linear combination of r1 and b. We can then use the equation in Step 1 to solve for r1 and use this to write r3=gcd(a,b) as a linear combination of a and b.

In general, if we can write rp=gcd(a,b) as a linear combination of a pair in a given row, then we can use the equation in the preceding step to write rp=gcd(a,b) as a linear combination of the pair in this preceding row.

The notational details of this induction argument get quite involved. Many mathematicians prefer to prove Theorem 8.10 using a property of the natural numbers called the Well-Ordering Principle. The Well-Ordering Principle for the natural numbers states that any nonempty set of natural numbers must contain a least element. It can be proven that the Well-Ordering Principle is equivalent to the Principle of Mathematical Induction.

Exercises Exercises

1.

Find each of the following greatest common divisors by listing all of the positive common divisors of each pair of integers.

(a)

gcd(21,28)

Answer.

The set of positive common divisors of 21 and 28 is {1,7}. So gcd(21,28)=7.

(b)

gcd(21,28)

Answer.

The set of positive common divisors of 21 and 28 is {1,7}. So gcd(21,28)=7.

(c)

gcd(58,63)

Answer.

The set of positive common divisors of 58 and 63 is {1}. So gcd(58,63)=1.

(d)

gcd(0,12)

Answer.

The set of positive common divisors of 0 and 12 is {1,2,3,4,6,12}. So gcd(0,12)=12.

(e)

gcd(110,215)

(f)

gcd(110,215)

2.

Complete the following.

(a)

Let aZ and let kZ with k0. Prove that if ka and k(a+1), then k1, and hence k=±1.

Hint.

Prove that k[(a+1)a].

(b)

Let aZ. Find the greatest common divisor of the consecutive integers a and a+1. That is, determine gcd(a,a+1).

3.

Complete the following.

(a)

Let aZ and let kZ with k0. Prove that if ka and k(a+2), then k2.

(b)

Let aZ. What conclusions can be made about the greatest common divisor of a and a+2?

4.

Let a,bZ with b0. Prove each of the following:

(a)

gcd(0,b)=|b|

Answer.

|b| is the largest natural number that divides 0 and b.

(b)

If gcd(a,b)=d, then gcd(a,b)=d. That is, gcd(a,b)=gcd(a,b).

Answer.

The integers b and b have the same divisors. Therefore, gcd(a,b)=gcd(a,b).

5.

For each of the following pairs of integers, use the Euclidean Algorithm to find gcd(a,b) and to write gcd(a,b) as a linear combination of a and b. That is, find integers m and n such that d=am+bn.

(a)

a=36,b=60

Answer.

gcd(36,60)=12, 12=362+60(1)

(b)

a=901,b=935

Answer.

gcd(901,935)=17, 17=90127+935(26)

(d)

a=12628,b=21361

(e)

a=901, b=935

Answer.

gcd(901,935)=17, 17=90127+(935)(26)

(f)

a=36, b=60

6.

Complete the following.

(a)

Find integers u and v such that 9u+14v=1 or explain why it is not possible to do so. Then find integers x and y such that 9x+14y=10 or explain why it is not possible to do so.

Answer.

One possibility is u=3 and v=2. In this case, 9u+14v=1. We then multiply both sides of this equation by 10 to obtain

9(30)+1420=10.

So we can use x=30 and y=20.

(b)

Find integers x and y such that 9x+15y=10 or explain why it is not possible to do so.

(c)

Find integers x and y such that 9x+15y=3162 or explain why it is not possible to do so.

7.

Complete the following.

(a)

Notice that gcd(11,17)=1. Find integers x and y such that 11x+17y=1.

Answer.

11(3)+172=1

(b)

Let m,nZ. Write the sum m11+n17 as a single fraction.

Answer.

m11+n17=17m+11n187

(c)

Find two rational numbers with denominators of 11 and 17, respectively , whose sum is equal to 10187.

Hint.

Write the rational numbers in the form m11 and n17, where m,nZ. Then write

m11+n17=10187.

Use Task 7.a and Task 7.b to determine m and n.

(d)

Find two rational numbers with denominators 17 and 21, respectively, whose sum is equal to 326357 or explain why it is not possible to do so.

(e)

Find two rational numbers with denominators 9 and 15, respectively, whose sum is equal to 10225 or explain why it is not possible to do so.

Activity 47. Linear Combinations and the Greatest Common Divisor.

(a)

Determine the greatest common divisor of 20 and 12.

(b)

Let d=gcd(20,12). Write d as a linear combination of 20 and 12.

(c)

Generate at least six different linear combinations of 20 and 12. Are these linear combinations of 20 and 12 multiples of gcd(20,12)?

(d)

Determine the greatest common divisor of 21 and 6 and then generate at least six different linear combinations of 21 and 6. Are these linear combinations of 21 and 6 multiples of gcd(21,6)?

(e)

The following proposition was first introduced in Activity 30 in Section 5.2. Complete the proof of this proposition if you have not already done so.

Proposition 5.22: Let a, b, and t be integers with t0. If t divides a and t divides b, then for all integers x and y, t divides \text{(} ax + by\text{)} .

Proof. Let a, b, and t be integers with t0, and assume that t divides a and t divides b. We will prove that for all integers x and y, t divides (ax+by). So let xZ and let yZ. Since t divides a, there exists an integer m such that .

(f)

Now let a and b be integers, not both zero, and let d=gcd(a,b). Theorem 8.10 states that d is a linear combination of a and b. In addition, let S and T be the following sets:

S={ax+byx,yZ} and T={kdkZ}.

That is, S is the set of all linear combinations of a and b, and T is the set of all multiples of the greatest common divisor of a and b. Does the set S equal the set T? If not, is one of these sets a subset of the other set? Justify your conclusions.

In Task 47.c and Task 47.d, we were exploring special cases for these two sets.