Download The Euclidean Algorithm and Its Consequences

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

List of important publications in mathematics wikipedia , lookup

Vincent's theorem wikipedia , lookup

Georg Cantor's first set theory article wikipedia , lookup

Mathematics of radio engineering wikipedia , lookup

Mathematical proof wikipedia , lookup

Fundamental theorem of calculus wikipedia , lookup

Arithmetic wikipedia , lookup

Four color theorem wikipedia , lookup

Wiles's proof of Fermat's Last Theorem wikipedia , lookup

Addition wikipedia , lookup

Theorem wikipedia , lookup

Fermat's Last Theorem wikipedia , lookup

Factorization of polynomials over finite fields wikipedia , lookup

Location arithmetic wikipedia , lookup

Fundamental theorem of algebra wikipedia , lookup

Elementary mathematics wikipedia , lookup

Proofs of Fermat's little theorem wikipedia , lookup

Transcript
The Euclidean Algorithm and Its Consequences
Contents
1 Introduction: A Tale of Two Problems
2
2 The Key Fact.
3
3 Applying the Key Fact.
6
4 Interlude: Linear Combinations and GCD’s.
8
4.1 What Are Linear Combinations? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.2 What Is the Property? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
5 The Extended Euclidean Algorithm.
11
5.1 How the Extended Algorithm Works. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
5.2 Why the Extended Algorithm Works. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
6 Some Conclusions You Can Draw· · ·
6.1 Establishing the Property on p.11. . . . . . . . .
6.2 More about GCD’s. . . . . . . . . . . . . . . . .
6.3 Another Way To Say That gcd(a, b) = 1. . . . .
6.4 More about Relatively Prime Integers. . . . . . .
6.5 The Fundamental Theorem of Arithmetic. . . . .
6.5.1 Another Thing That Prime Numbers Do.
6.5.2 The Statement and Proof of the FTA. . .
1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
14
14
15
16
16
20
20
22
1
Introduction: A Tale of Two Problems
The Euclidean Algorithm is a powerful and elegant way to solve to a problem that would otherwise be quite
difficult. In order to make its importance clear, I will set the stage by comparing two similar-sounding problems.
Problem #1 is how to find all of the divisors of a positive integer. For small positive integres, this can be done
by inspection; for example, list the positive divisors of the following integers:
[a]: The positive divisors of 48 (there are 10 of them):
[b]: The positive divisors of 49 (there are 3 of them):
For large integers, though, inspection is tedious and time-consuming—it would take a lot of guesswork to list
the positive divisors of 12, 404, 459, for example1 —and to date, no one has come up with anything better than
guesswork for this problem. If the number under consideration is really large,2 the fastest computer would need
more time than the lifetime of the universe to find all of its positive divisors.
Problem #2 is how to find the greatest common divisor of two nonnegative integers.
Recall that for two nonnegative integers a and b, not both
zero, that the greatest common divisor (or gcd)
of a and b is the largest integer d such that d a and d b. (The gcd of a and b is usually written “gcd(a, b).”)
For small integers a and b, one can find gcd(a, b) by listing the common divisors. For example, find the gcd of
the following pairs of integers by listing their common divisors.
[a]: gcd(21, 33) =
[b]: gcd(21, 32) =
[c]: gcd(22, 33) =
[d]: gcd(531, 18) =
Since we are solving Problem #2 by listing divisors, it would be natural to suppose that the second problem is
as just as hard as the first problem, so that, for example,
• finding gcd(907200, 26460) would involve tons of tedious guesswork, or
• finding the gcd of two thousand-digit numbers would require more time than the lifetime of the universe.
Interestingly, though, this turns out not to be the case, because there is a better method for finding gcd(a, b)—the
Euclidean Algorithm. This handout will introduce this algorithm,3 explain why it works, and indicate some
interesting facts about whole numbers that we can learn from it.
1
They are: 1, 3517, 3, 527, and 12, 404, 459.
with one thousand digits, say
3
An algorithm is a step-by-step procedure for carrying out a task.
2
2
2
The Key Fact.
The Euclidean Algorithm depends upon a connection between common divisors and the algorithm for division
that you learned in grade school. Before stating the relationship in general, I will introduce it through some
examples. We will work the first one together, and I will have you do the others as classwork.
First example: a = 144 and b = 52. Let us divide 52 into 144, getting a quotient q and a remainder r.
At the left, perform this division as you learned to
do in grade school. When you finish, verify that
your quotient q and remainder r have the following
properties:
• 144 = q × 52 + r, and
• 0 ≤ r ≤ 51.
For larger integers, it will be helpful to have a way to find q and r on your calculator. Here is how
this is done for 52 and 144; the same steps work on for any two integers.
1. Divide 144 by 52 on your calculator; notice that the whole-number part of the answer is the
quotient q.
2. Subtract the whole number part from the number in your calculator, leaving the decimal part
in place.
3. Now multiply the decimal by 52. Notice that the answer you now have is is the remainder r.4
Now, write the remainder we found in the space below; then, list the common divisors of the two numbers on
each side
a = 144 and b = 52:
Common Divisors
4
b = 52 and r =
Common Divisors
:
Because your calculator is not always 100% accurate, you might have to round an answer like 34.9999999 to 35.
3
Worksheet
For each pair of integers a and b below:
1. Find the quotient q and remainder r that result when b is divided into a. (You may use your calculator to
do this.)
2. List all of the common divisors of a and b.
3. List all of the common divisors of b and r.
a:
b:
132
66
144
64
144
75
144
80
144
8
r:
q:
Divisors of a and b:
4
Divisors of b and r:
The pattern you see in the examples is completely general; to prove this, the first step is to state it precisely. Let
a and b be nonnegative whole numbers with b 6= 0, and let q be the quotient and r be the remainder when b is
divided into a;5 that is,

 a = (q × b) + r



(1)
and




0 ≤ r ≤ b − 1.
What we want to prove can now be precisely stated.
Theorem 1 Let a, b > 0, q and r be as in Equation (1). Then a and b have exactly the same common divisors
as do b and r. In other words, for any positive integer d,
 
 
d a
d b














and
⇐⇒
and .










 

 

db
dr
Comment on how to prove this. The “⇐⇒” is asserting two independent statements:6
• If d satisfies the conditions on the left, then d must satisfy the conditions on the right (“=⇒”); and
• If d satisfies the conditions on the right, then d must satisfy the conditions on the left (“⇐=”).
These two statements must be proved separately.
Proof of the “=⇒” statement.
Let d satisfy the conditions on the left. One of the conditions that we must
prove on the right is “d b”, which we also have as a given on the left; therefore, to prove “=⇒”, we need
only show that d r.
Since d a, a = dk for some k, and since d b, b = d` for some `. We can thus solve the equation in (1) for
r, substitute dk for a and d` for b, and factor, as shown:
solve (1) for r −→
make the substitutions −→
regroup and factor −→
Thus r = d k − q` , so that d r.
r = a − qb
r = dk − q(d`)
r = d k − q` .
equation (1) −→
make the substitutions −→
regroup and factor −→
Thus a = d q` + t , so that d a.
a = qb + r
a = q(d`) + dt
a = d q` + t .
Proof of the “⇐=” statement.
Let d satisfy the conditions on the right. One of the conditions that we must
prove on the left is “d b”, which we also have as a given on the right; therefore, to prove “⇐=”, we need
only show that d a.
Again, since d b, b = d` for some `, and since d r, r = dt for some t. We can thus take equation (1) as
given, substitute dt for r and d` for b, and factor, as shown:
The proof of Theorem (1) is complete.
The main purpose of Theorem 1 is to prove Theorem 2 below. Recall that
the greatest common divisor of
integers a and b (“gcd(a, b)”) is the largest integer d such that d a and d b.
5
6
You can divide b into a even if 0 ≤ a < b; in such cases, q = 0 and r = a.
These statements are each other’s converses.
5
Theorem 2 (The Key Fact) Let a, b > 0, q and r be as in Equation (1).
[a]: If r = 0, then gcd(a, b) = b.
[b]: If r 6= 0, then gcd(a, b) = gcd(b, r).
Proof of [a]. If r = 0, then b a; and since (obviously) b b, b is a common divisor of a and b. It must also be
the largest common divisor, since no number larger than b can divide b.
Proof of [b]. We know from Theorem 1 that
the common divisors of
are the same as
a and b
the common divisors of
b and r
.
Thus,
gcd(a, b) = largest of the numbers on the left
= largest of the numbers on the right
= gcd(b, r).
3
Applying the Key Fact.
Because of the Key Fact, there is a procedure7 for finding the gcd through repeated division. The precise
description of the procedure is somewhat cryptic, but an example will help to make the meaning clear.
The Euclidean Algorithm
Start with a nonnegative integer a and a positive integer b.
Step 1: Long-divide b into a, and note down the quotient q and r.
Step 2: If r = 0, then gcd(a, b) = b, so you’re finished. If r 6= 0, go on to Step 3.
Step 3: Replace a with b, replace b with r, and go back up to Step 1 with these new values of
a and b.
End with the gcd of the original two integers as the current value of b.
Example. Together, we will use the Euclidean Algorithm to find gcd(1040, 134). (Note that there are some
columns below that you are not used to. Ignore those for now, and just fill in the “Dividend” “Divisor”
“Remainder” and “Quotient” columns.)
Dividend (a)
×(x0 )
1040
+
Divisor (b)
+
134
×(y0 )
Remainder (r)
Quotient (q)
+
+
+
+
gcd(1040, 134) =
7
= 1040 · (
This is the Euclidean Algorithm.
6
) + 134 · (
)
Worksheet
Use the Euclidean Algorithm to find the following gcd’s.
Dividend (a)
×(x0 )
3372
+
Divisor (b)
+
2524
×(y0 )
Remainder (r)
Quotient (q)
+
+
+
+
+
= 3372 · (
gcd(3372, 2524) =
Dividend (a)
×(x0 )
56310
+
Divisor (b)
+
13242
) + 2524 · (
×(y0 )
Remainder (r)
)
Quotient (q)
+
+
+
+
+
+
= 56310 · (
gcd(56310, 13242) =
Dividend (a)
×(x0 )
361831
+
Divisor (b)
+
1024
) + 13242 · (
×(y0 )
Remainder (r)
)
Quotient (q)
+
+
+
+
+
+
+
+
gcd(361831, 1024) =
= 361831 · (
7
) + 1024 · (
)
4
Interlude: Linear Combinations and GCD’s.
There is an important (and nonobvious) property of the integers that can be proved by means of the Euclidean
Algorithm.8 The property relates gcd(a, b) to something called the “linear combinations” of a and b. Before stating
this property precisely and proving it, I will introduce you to linear combinations; after you have constructed
some examples of these, I will draw your attention to two patterns that occur in each case—instances of this
property. I will then state the property precisely and, with the help of the Euclidean Algorithm, will prove that
it holds true in every case.
4.1
What Are Linear Combinations?
Definition 1 Let a and b be nonnegative integers. A linear combination of a and b is any number
n = ax + by,
(2)
where x and y are any integers.
Let me first spell out some aspects of this definition.
• If a = 0 and b = 0, then every linear combination of a and b equals zero:
ax + by = 0 × x + 0 × y = 0 + 0 = 0.
• If a = 0 but b > 0, then the linear combinations of a and b are just the multiples of b: for any x and any y,
ax + by = 0 × x + by = 0 + by = by.
• Although a ≥ 0 and b > 0, the numbers x and y are allowed to be negative or zero.
Example. Together in class, we will list some of the linear combinations of a = 9 and b = 12.
For each box, fill in the sum of the boldface number at the left and the boldface number at the top.
y→
..
↓x↓
.
12y
.
9x
8
1
−1
2
−2
3
−3
...
0
12
−12
24
−24
36
−36
···
→
..
..
↓↓
0
.
0
0
···
1
9
···
−1
−9
···
2
18
···
−2
−18
···
..
.
..
.
..
.
..
.
..
.
..
.
..
.
..
.
..
.
..
.
We will first need to extend the algorithm; when we do, you will learn what the other columns are for.
8
Worksheet
Imitate the example on the previous page to list the linear combinations of the following pairs of integers.
Some linear combinations of a = 15 and b = 30
For each box, fill in the sum of the boldface number at the left and the boldface number at the top.
y→
..
↓x↓
.
30y
..
15x
1
−1
2
−2
3
−3
...
0
30
−30
60
−60
90
−90
···
→
.
..
↓↓
0
.
0
0
···
1
15
···
−1
−15
···
2
30
···
−2
−30
···
..
.
..
.
..
.
..
.
..
.
..
.
..
.
..
.
..
.
..
.
Some linear combinations of a = 16 and b = 12
For each box, fill in the sum ofthe boldface number at the left and the boldface number at the top.
y→
..
↓x↓
.
16x
12y
..
1
−1
2
−2
3
−3
...
0
12
−12
24
−24
36
−36
···
→
.
..
↓↓
0
.
0
0
···
1
16
···
−1
−16
···
2
32
···
−2
−32
···
..
.
..
.
..
.
..
.
..
.
..
.
9
..
.
..
.
..
.
..
.
Some linear combinations of a = 7 and b = 3
Fill in the multiples of 3 along the second row and the multiples of 7 down the second column; then, for each
box, fill in the sum of the multiple of 7 you filled in at the left and the multiple of 3 you filled in at the top.
y→
..
↓x↓
.
7x
3y
..
0
−1
−2
2
3
−3
4
−4
···
→
···
.
..
↓↓
1
.
0
···
1
···
−1
···
2
···
−2
···
..
.
..
.
..
.
..
.
..
.
..
.
..
.
..
.
..
.
..
.
..
.
..
.
Try to spot the patterns.
• The smallest 15 numbers that appear in the table on p.8,
listed in order of increasing size, are:
• Examine the four tables of linear combinations you
filled in above. In each case, identify the smallest
strictly positive entry in the table—let’s call it S—
and copy it into the appropriate space below.
(I)
Value of
a:
(II)
Value of
b:
9
12
15
30
16
12
7
3
0, ±3, ±6, ±9, ±12, ±15, ±18.
Make a similar list for each of the worksheet tables.
(III)
S = smallest
a = 15 and b = 30:
positive
entry in table:
a = 16 and b = 12:
a = 7 and b = 3:
• Do you see any simple relationship between the Snumbers in column (III) of the chart at the left and
the linear combinations you have listed above?
• Do you see any other heading for column (III) that
would have led to your filling in the exact same numbers as the S-numbers?
10
4.2
What Is the Property?
The patterns on p.10 are these: in each case,
1. The S-number for a and b appears to equal gcd(a, b); and
2. The linear combinations of a and b appear to be the multiples of the S-number for a and b.
Both of these statements hold in every case; they can be summarized in the single statement:9
Let a and b be nonnegative integers, with b 6= 0. For every integer z,
(3)
⇐⇒
z is a linear combination of a and b
z is a multiple of gcd(a, b).
The hardest part of establishing (3) is showing that there exist integers x0 and y0 for which10
gcd(a, b) = a × (x0 ) + b × (y0 );
(4)
that is, that gcd(a, b) is a linear combination of a and b of any sort whatever —smallest or otherwise. It turns out
that this step can be caried out by extending the Euclidean Algorithm.
5
The Extended Euclidean Algorithm.
The extended algorithm consists of two parts. The first part is the procedure you have already learned for finding
gcd(a, b) for given inputs a and b.
5.1
How the Extended Algorithm Works.
To illustrate how the extension works, I will paste in the partially-completed table from p.6 and explain what the
empty columns are for and how to fill them in.11
Dividend (a)
×(x0 )
+
Divisor (b)
1040
+
134
×(y0 )
Remainder (r)
Quotient (q)
134
102
7
+
102
32
1
102
+
32
6
3
32
+
6
2
5
6
+
2
0
3
gcd(1040, 134) =
2
= 1040 · (
) + 134 · (
)
As we have already discussed: the dividend/divisor pairs all have the same gcd, namely 2; after the remaining
columns have been filled in, we will see that in every row,
2 = ax0 + by0 .
We will fill in the chart from the bottom up. I will explain first how to fill in the bottom row (easy) and then
how to move up each row from each row to the row above (not so easy).
9
It follows that the GREATEST common divisor of a and b is the SMALLEST positive linear combination of a and b.
There are actually infinitely many possiblities.
11
You will also learn why I had you keep track of the quotients.
10
11
The bottom row. To fill in the bottom row, we need to find integers x0 and y0 for which
2 = 6 × (x0 ) + 2 × (y0 );
the easiest way
12
to do this is simply to take x0 = 0 and y0 = 1, since, obviously,
2 = 6 × 0 + 2 × 1.
Let us put the values take x0 = 0 and y0 = 1 into the bottom row.
Dividend (a)
×(x0 )
6
0
+
Divisor (b)
+
2
×(y0 )
Remainder (r)
Quotient (q)
0
3
1
Since the divisor will always equal the gcd in the last row of every Euclidean Algorithm chart, the values
take x0 = 0 and y0 = 1 will always work there. Therefore we will
always take x0 = 0 and y0 = 1 in the bottom row.
Exercise 1 Fill in the bottom row of each Euclidean Algorithm chart in the worksheet on p.7.
Moving up. The method for using a filled-in row to fill in the row above it is a little complicated. I will
•
•
•
•
describe the method while applying it to the fourth row in the example above;
work together with you in class to fill in the rest of the rows in the example above; and
have you apply the method to the worksheet examples. Then,
I will show you why it works.
The Method.
• Copy the y0 value of the lower row into the x0 box of the upper row. In the fourth row of the example,
we get
Dividend (a)
32
×(x0 )
6
1
+
+
Divisor (b)
6
0
+
2
×(y0 )
1
Remainder (r)
2
Quotient (q)
5
0
3
• Getting the y0 value of the upper row is a three-step process.
Step#1: Multiply the y0 value of the lower row by the quotient from the upper row.
Step#2: Subtract the answer you got in Step#1 from the x0 value of the lower row.
Step#2: Copy the answer you got in Step#2 into the y0 box of the upper row.
For the fourth row of the example, we get
Answer from Step#1 = (1) × (5) = 5;
Answer from Step#2 = 0 − 5 = (−5).
Dividend (a)
32
6
×(x0 )
1
+
+
Divisor (b)
6
0
+
2
×(y0 )
−5
Remainder (r)
2
Quotient (q)
5
1
0
3
Together, we will now apply this method to finish filling in the chart on p.11; as we fill in each new row,
we will verify that 2 = a × (x0 ) + b × (y0 ) in the new row.
Exercise 2 Complete the charts in the worksheet starting on p.7.
12
of infinitely many ways
12
5.2
Why the Extended Algorithm Works.
Clearly, the rule on p.12 guarantees that gcd(a, b) = ax0 + by0 in the bottom row. Moreover, it turns out that the
complicated rule for moving up—let’s call it the “CR” for short—will ensure that this property will be carried
up from any row to the row above. This is because, as I will show you, the CR appears as a solution to the
problem:13
If
g = cK + dL
in some row, how can we use this information to find values of x0 and y0 that will make
(5)
g = ax0 + by0
in the row above?
Here is how to arrive at the CR as a solution to the boxed problem (5). Let us begin by displaying the rows
under consideration:
Dividend
a
×(x0 )
??
+
+
Divisor
b
×(y0 )
??
Remainder
r
Quotient
q
c
K
+
d
L
s
t
We first now include several pieces of information into the mix:
First: We know (from the gcd part of the calculation) that
• c in the lower row equals b from the upper row, and that
• d in the lower row equals r from the upper row.
We incorporate these facts by giving c and d their other names.
Dividend
a
×(x0 )
+
+
Divisor
b
×(y0 )
Remainder
r
Quotient
q
b
K
+
r
L
s
t
Second: We know (also from the gcd part of the calculation) that
a = qb + r.
(6)
Third: We know that K and L in the lower row satisfy the equation
g = bK + rL.
(7)
We can now solve (5) with a calculation:
Solving (6) for r
then, substituting (8) into (7)
then, multiplying out in (9)
finally, rearranging terms in (10)
gives:
gives:
gives:
gives:
r = a − qb;
g = bK + (a − qb)L;
g = bK + aL − qbL;
g = aL + b(K − qL).
Equation (11) is exactly the CR! As promised, the CR is a solution to problem (5).
13
Let “g” denote the gcd of the dividend and divisor in each row—recall that the gcd will be the same in all rows.
13
(8)
(9)
(10)
(11)
Some Conclusions You Can Draw· · ·
6
For any integers a ≥ 0 and b (b > 0), the extended Euclidean Algorithm gives us a way to find integers x0 and y0
such that
g = gcd(a, b) = ax0 + by0 .
(12)
That simple fact brings with it an important piece of knowledge:
For any integers a ≥ 0 and b > 0, gcd(a, b) is a linear combination of a and b.
This fact is not obvious: without the algorithm, it is not obvious why there should be any integers x0 and y0
whatsoever that work in (12). This fact leads to a lot of others, and this section will introduce you to some of
them.
6.1
Establishing the Property on p.11.
Let me first rephrase the property slightly. The exact statements I will prove are (i), (ii), and (iii) below.14
Theorem 3 For any integers a ≥ 0 and b > 0:
(i) Every linear combination of a and b is a multiple of gcd(a, b).
(ii) Every multiple of gcd(a, b) is a linear combination of a and b.
(iii) The smallest positive linear combination of a and b is equal to gcd(a, b).
Proof. I will make repeated use of the following three facts.
Fact#1. There exist integers x0 and y0 such that g = gcd(a, b) = ax0 + by0 . (This is what (12)
says.)
Fact#2. Since g a, there is an integer k such that a = gk.
Fact#3. Since g b, there is an integer ` such that b = g`.
Proof of (i). Let z be a linear combination of a and b, so that z = ax + by for some integers x and y. Then
given −→
substitute using Fact#2 and Fact#3 −→
factor the g out −→
z = ax + by
z = (gk)x + (g`)y
z = g(kx + `y).
(13)
Equation (13) says that z is a multiple of g. This proves (i).
Proof of (ii). Let z be a multiple of g, so that z = gc for some integer c. Then
given −→
substitute using Fact#1 −→
multiply out −→
z = gc
z = (ax0 + by0 )c
z = a(x0 c) + b(y0 c).
(14)
Equation (14) says that z is a linear combination of a and b. This proves (ii).
Proof of (iii). We already know that g is positive and that g is a linear combination of a and b; what remains
to show is that g is smaller than any other positive linear combination of a and b.
So let w be any positive linear combination of a and b such that w 6= g. [The proof will be done if we can
show that w > g.] By statement (i)—which we may now use, because we have proved it—w is a multiple
of g; let m be the integer such that w = gm. We need to focus on m: a little thought shows that some
values are impossible for m.
14
Statements (ii) and (iii) are the “=⇒” and “⇐=” parts of statement #2 on p.11, which is a “⇐⇒” statement.
14
• If m were ≤ 0, then gm would also be ≤ 0. Since w = gm is positive, we know that m cannot be
≤ 0.
• If m were equal to 1, then gm would be equal to g. Since w = gm is not equal to g, we know that m
cannot equal 1.
So the impossible values for m are the integers · · · , −3, −2, −1, 0, 1; that leaves as possible values for m the
integers 2, 3, 4, 5, · · ·—in other words, all integers m > 1. But if you multiply the inequality m > 1 on both
sides by g, you get the inequality g · m > g · (1).15 Thus w = gm > g. This proves (iii).
6.2
More about GCD’s.
There is another nonobvious property of the gcd that can now be understood. Recall the work you did on the
worksheet on p.4, where you were finding gcd’s by constructing lists of common divisors. I want to take another
look at this process, but this time I want to focus on the entire list rather than just the largest number in it.
These lists follow a certain pattern, which I did not point out on p.4. Before saying what the pattern is, I will
introduce it through a few examples.
Worksheet
Fill in the table below.
15
a:
b:
42
56
48
56
48
72
35
72
0
56
65
95
21
6
21
7
21
8
Divisors of a :
Divisors of b :
All integers
This is valid because g is positive.
15
Common divisors of
a and b:
The pattern is this: on each line of the chart, the numbers in the right-hand box—the common divisors of a and
b—are all divisors of gcd(a, b). In other words: not only is gcd(a, b) bigger than every other common divisor of a
and b; gcd(a, b) is a multiple of every other common divisor of a and b.
This turns out to be true for every pair of integers a ≥ 0 and b > 0. This means, for example, that there do
not exist integers a and b whose (positive) common divisors are exactly the four numbers {1, 2, 5, 7} (and no
others). The precise statement is part [b] of Theorem 4; part[a], of this theorem, which is obvious, is included
for completeness.
Theorem 4 Let a ≥ 0 and b > 0 be integers, and let g = gcd(a, b). For any positive integer d:
[a]: If d divides g, then d divides a and d divides b.
[b]: If d divides a and d divides b, then d divides g.
Proof of [a].
Since d g and g) a, by Theorem 2.2
on p.50 of your text, d a. The exact same argument will
show that d b. Proof of [b]. We are given that d a and d b, so that
dk = a
for some integer k
(15)
for some integer `.
(16)
and
d` = b
By the extended Euclidean Algorithm, we also know that g = ax0 + by0 for some integers x0 and y0 (equation (12)
on p.14). We can then compute as follows.
make substitutions using (15) and (16) −→
factor d out −→
Equation (17) shows that d g.
6.3
g = ax0 + by0
g = (dk)x0 + (d`)y0
g = d kx0 + `y0 .
(17)
Another Way To Say That gcd(a, b) = 1.
Theorem 5 below. what is often the most useful way to say that two integers are relatively prime.16
Theorem 5 Let a ≥ 0 and b > 0 be integers.
[a]: If gcd(a, b) = 1, then there exist integers x0 and y0 such that
1 = ax0 + by0 .
(18)
[b]: If there exist integers x0 and y0 such that 1 = ax0 + by0 , then gcd(a, b) = 1.
Proof of [a]. Equation (12) says that gcd(a, b) = ax0 + by0 ; since gcd(a, b) = 1, we can replace “gcd(a, b)”
with “1” in equation (12). When we do, we get equation (18).
Proof of [b]. We’re given that 1 = ax0 + by0 ; this says that 1 is a linear combination of a and b. Now Theorem 3
part (i) says that every linear combination of a and b is a multiple of gcd(a, b); since 1 is a linear combination of
a and b, 1 must be a multiple of gcd(a, b)—or, equivalently, gcd(a, b) must be a divisor of 1. But the only positive
divisor of 1 is the number 1 itself. Necessarily, then, gcd(a, b) = 1.
6.4
More about Relatively Prime Integers.
Relatively prime integers have a number of special properties, but the most important of these is the one that is
discussed in this section. I will introduce the property with a classwork assignment.
16
Recall: two integers a ≥ 0 and b > 0 are relatively prime if gcd 9a, b) = 1.
16
Worksheet
(i): Fill in the products in the table below:
Column Number−→
Test number:
6
7
9
10
11
36
1×7 =
1×9 =
1×10 =
1×11 =
1×36 =
2×7 =
2×9 =
2×10 =
2×11 =
2×36 =
3×7 =
3×9 =
3×10 =
3×11 =
3×36 =
4×7 =
4×9 =
4×10 =
4×11 =
4×36 =
5×7 =
5×9 =
5×10 =
5×11 =
5×36 =
6×7 =
6×9 =
6×10 =
6×11 =
6×36 =
7×7 =
7×9 =
7×10 =
7×11 =
7×36 =
8×7 =
8×9 =
8×10 =
8×11 =
8×36 =
9×7 =
9×9 =
9×10 =
9×11 =
9×36 =
10×7 =
10×9 =
10×10 =
10×11 =
10×36 =
11×7 =
11×9 =
11×10 =
11×11 =
11×36 =
12×7 =
12×9 =
12×10 =
12×11 =
12×36 =
13×7 =
13×9 =
13×10 =
13×11 =
13×36 =
14×7 =
14×9 =
14×10 =
14×11 =
14×36 =
15×7 =
15×9 =
15×10 =
15×11 =
15×36 =
16×7 =
16×9 =
16×10 =
16×11 =
16×36 =
17×7 =
17×9 =
17×10 =
17×11 =
17×36 =
18×7 =
18×9 =
18×10 =
18×11 =
18×36 =
19×7 =
19×9 =
19×10 =
19×11 =
19×36 =
20×7 =
20×9 =
20×10 =
20×11 =
20×36 =
(ii): In the table, underline all the multiples of the test number 6.
(iii): Among the numbers you underlined, circle those for which the boldface number is not a multiple of the
test number 6.
17
(iv): Now, look for a pattern:
• Which columns have circled numbers? Write down the corresponding column numbers.
• How are these column numbers related to the test number 6?
• Which columns do not have circled numbers? Write down the corresponding column numbers.
• How are these column numbers related to the test number 6?
• What is the difference between the numbers of columns that have circled numbers and the numbers
of columns that do not have circled numbers?
• Do you think a column numbered 27 would contain circled numbers?
• Do you think a column numbered 29 would contain circled numbers?
18
Examining which columns in the chart contain circled numbers and which ones do not lead to the following
observation:
• Those columns in the chart whose numbers ARE relatively prime to 6 DO NOT contain
any circled numbers
(19)
• Those columns in the chart whose numbers ARE NOT relatively prime to 6 DO contain
circled numbers.
This turns out to be a perfectly general phenomenon: it will manifest itself in any chart like this one, regardless
what column names you choose or what number you use as a test number.17
In order to you why this is always happens, I need general mathematical statement of the rule we are using to draw
the circles. I will explain the general statement by generalizing from a particular example from the chart—the
third box down in the column numbered 10. This box contains the equation
3 × 10 = 30.
The 30 was underlined (because 6 divides 30), and then the 30 was circled (because 6 does not divide 3).
We can get the general rule by:
1. replacing the test number (6) by a variable a to represent any test number;
2. replacing the column number (10) with a variable b to represent any column number; and
3. replacing the boldface multiplier 3 with a variable
c to represent any multiplier.
When we make these replacements, the general rule comes out like this:
Rule for When To Draw a Circle
For test number a, column number b, and multiplier c, and box equation
you should draw a circle around the number cb if and only if
c × b = cb :
• a DOES divide cb, but
• a does NOT divide
C.
With the help of this rule, I can now state precisely and prove pattern (19):18
Theorem 6 Let a and b be positive integers, and let g = gcd(a, b).
[a]: If g > 1, then there exist positive integers c such that
a (cb) but a † c.
[b]: If g = 1, then there are no such integers c. In other words: if a (cb) then a will divide c as well.
(20)
Proof of [a]. I will prove [a] by showing a method for finding a c that works in (20) whenever g > 1, as follows.
ab
Since g divides both a and b, we can calculate
as a product of integers in two different ways:
g
b
a
a
=
b.
(21)
g
g
17
18
In the worksheet, 6 is the test number.
From here on, I will replace with just plain c.
c
19
a
a
. Equation (21) implies that a (cb); but since g > 1, we know that c =
g
g
is smaller a. Therefore a cannot divide c.
Now take c to be the integer
Proof of [b]. I will prove [b] in the form:
If gcd(a, b) = 1 and a (cb), then a c.
That means that I have two things to work with, namely
a (cb),
so that for some integer `,
a` = cb.
gcd(a, b) = 1, so that for some integers x0 and y0 , 1 = ax0 + by0 (Theorem 5).
(22)
(23)
I can then calculate as follows.
multiply equation (23) on both sides by c
distribute the product
replace cb by a` (equation (22))
factor out a on the right
c = c(ax0 + by0 )
c = cax0 + cby0
c = cax0 + a`y0
c = a(cx0 + `y0 ).
(24)
Equation (24) shows that a divides c.
6.5
The Fundamental Theorem of Arithmetic.
This theorem is the most important single fact about the integers. I will introduce you to what it says19 through
an example. Consider the following two factorizations of 72:
72 = 18 × 4
versus 72 = 12 × 6.
These factorizations look nothing alike, but they are also only partial factorizations, since the 18, the 4, the 12
and the 6 can all be factored further. If we complete the factorizations by continuing each of them until only
prime numbers20 remain, we get
72 = 3 × 3 × 2 × 2 × 2 versus 72 = 2 × 2 × 3 × 2 × 3 ,
and these two factorizations are identical: both of them consist of three 2’s and two 3’s. The Fundamental
Theorem of Arithmetic (or “FTA”) is the statement that this must always happen; roughly speaking, it says that
“prime factorization is unique;” the precise statement is Theorem 9 on p.23.
Before turning to the proof of the FTA, we must first learn a little more about prime numbers.
6.5.1
Another Thing That Prime Numbers Do.
The idea here is closely related to worksheets like the one on p.17; it concerns what can and cannot happen when
the test number is a prime.
19
20
I have mentioned this property in class a few times but without going into detail or proving it.
Recall that an integer p is prime if and only if (a), p ≥ 2, and (b), p has only two divisors, namely 1 and p itself.
20
Worksheet
(i): Fill in the products in the table below:
Column Number−→
Test number:
5
7
9
10
11
25
1×7 =
1×9 =
1×10 =
1×11 =
1×25 =
2×7 =
2×9 =
2×10 =
2×11 =
2×25 =
3×7 =
3×9 =
3×10 =
3×11 =
3×25 =
4×7 =
4×9 =
4×10 =
4×11 =
4×25 =
5×7 =
5×9 =
5×10 =
5×11 =
5×25 =
6×7 =
6×9 =
6×10 =
6×11 =
6×25 =
7×7 =
7×9 =
7×10 =
7×11 =
7×25 =
8×7 =
8×9 =
8×10 =
8×11 =
8×25 =
9×7 =
9×9 =
9×10 =
9×11 =
9×25 =
10×7 =
10×9 =
10×10 =
10×11 =
10×25 =
11×7 =
11×9 =
11×10 =
11×11 =
11×25 =
12×7 =
12×9 =
12×10 =
12×11 =
12×25 =
13×7 =
13×9 =
13×10 =
13×11 =
13×25 =
14×7 =
14×9 =
14×10 =
14×11 =
14×25 =
15×7 =
15×9 =
15×10 =
15×11 =
15×25 =
16×7 =
16×9 =
16×10 =
16×11 =
16×25 =
17×7 =
17×9 =
17×10 =
17×11 =
17×25 =
18×7 =
18×9 =
18×10 =
18×11 =
18×25 =
19×7 =
19×9 =
19×10 =
19×11 =
19×25 =
20×7 =
20×9 =
20×10 =
20×11 =
20×25 =
(ii): In the table, underline all the multiples of the test number 5.
(iii): Among the numbers you underlined, circle those for which the boldface number is not a multiple of the
test number 5.
21
Here is the difference between what you can observe on the charts on p.21 and p.17. On the chart on p.17, where
the test number was 6, we can find three types of column:
1. A column in which every number is underlined (and most of them are circled); this is the case in column #36
in the chart on p.17.
2. A column with no circles whatever; this is the case in column #7 and column #11 in the chart on p.17.
3. A column in which not every number is underlined but which nevertheless contains some circles; this is the
case in column #9 and column #10 in the chart on p.17.
On the chart on p.21, though, only the first two types of column are in evidence; there are none of the third type.
This is not a coincidence: Theorem 7 below can be interpreted as stating that when the test number is prime,
there can be no columns of type 3.
Theorem 7 Let p be prime. For any positive integer n:
Either [a]: gcd(p, n) = 1,
or [b]: n is a multiple of p.
Proof. I will prove the theorem by showing: if [a] is false, then [b] must be true. Let g := gcd(p, n); if [a] is
false, then g 6= 1. We know that g is a divisor of p; since p has only two divisors, namely 1 and p, and since g 6= 1,
necessarily g = p. Since gcd(p, n) must divide n, we can conclude that p divides n.
An immediate consequence of Theorem 7 is Theorem 8, which crystallizes the exact property of primes needed
to prove the FTA:
Theorem 8 Let p be prime, and let a and b be positive integers. If p (ab), then
Either [a]: p a
or [b]: p b
(or both).
Proof. As in the proof of Theorem 7, I will prove this theorem by showing: if [a] is false, then [b] must be true.
Suppose [a] is false. Then, by Theorem 7, gcd(p, a) = 1. We can then apply Theorem 6([b]) (p.19) by making
replacements
a −→ p and c −→ a;
the conclusion is that p b—that is, that [b] is true.
6.5.2
The Statement and Proof of the FTA.
Let me set the stage. Say you have factored some integer n into primes, and arranged your primes in nondecreasing
order:21
n = p1 × p2 × · · · × pr
for primes p1 ≤ p2 ≤ · · · ≤ pr ;
for example for n = 144, you would get
144 = 2 × 2 × 2 × 2 × 3 × 3.
Say also that I have factored the same integer into primes and arranged them in nondecreasing order:
n = q1 × q2 × · · · × qs
for primes q1 ≤ q2 ≤ · · · ≤ qs .
I cannot assume that we are using the same primes, or even that we have the same number of factors (ie, that
r = s). But our factorizations do indeed match! This is exactly what Theorem 9 (below) says.
21
The order requirement is there only for convenience.
22
Theorem 9 Let p1 ≤ p2 ≤ · · · ≤ pr and q1 ≤ q2 ≤ · · · ≤ qs be prime numbers. If
p 1 × p2 × · · · × p r = q 1 × q 2 × · · · × q s ,
(25)
then
p1
p2
p3
..
.
=
=
=
..
.
q1
q2
q3
..
.
Proof.
Case 1. Suppose first that r = 1 (that is, that n = p1 is prime).22 Then there can be only one q on the right,
because p can’t be factored into a product of multiple q’s. So the factorizations match.
Case 2. On the other hand, if r ≥ 2, we have the following chain of reasoning:
• p1 divides the product q1 × q2 × · · · × qs .
• Therefore, by Theorem 8, p divides one of the q’s; say, p1 qi . Since qi is prime, it has only the divisors
1 and qi ; since p1 6= 1, it must be the case that p1 = qi .
• Pair up p1 ←→ qi , remove them from equation (25), and repeat the process.
This process will pick primes off of the two sides in matching pairs, until equation (25) has only one p left
on the left. Then, apply Case 1: there is one q left as well, and q = p, and the last two primes can be
paired up.
22
The theorem must be proved for all factorizations, even those with only one prime in them.
23