Section 3.1 gave the constructed integers a relation
and a
division with remainder (Theorem 3.1.2).
This section asks what two integers have in common. Here
is a concrete version. A machine accepts only coins
worth and units, and gives
change in the same coins. Which amounts can be paid
exactly? Paying
coins of the first kind and of the second, with
negative numbers for coins received as change, pays
. So can
be paid, and hence every multiple of ; and since divides both and , nothing else can. Why
, and why exactly
the multiples of ?
The answer is a theorem about every pair of integers,
and its proof is the main move of this chapter.
Integer
combinations
The amounts form a set that deserves a name.
Definition
3.2.1 (Integer Combinations)
Let . The set of integer
combinations of and is and the set of multiples of
is .
So is the
set of
with (Sets, Relations, and Cardinality, Definition 2.2.1),
and is
written as one symbol: it is defined directly, not as a
sum of two sets. Three closure properties hold for every
. For
, the ring laws of Theorem 2.3.1
and Proposition 2.3.2
(c) give so is closed under , under , and under
multiplication by any integer. It
contains , and . Taking gives ,
by Proposition 2.3.2
(b) and (F6); so has the same three
properties.
Examples:
-
contains , , and , so it contains every multiple of , by the third closure
property.
- : it contains , and with it for every
.
- The degenerate case: (the
case above,
since by Proposition 2.3.2
(b)). It is the only case in which has no
positive element (if , one of , is a positive element,
by Proposition 3.1.1
(h); likewise for ), and the theorem below
must exclude it.
Non-example by minimal change. Allow only
paying, with no change given: . It contains and and is closed under
, but not under
: it contains no
negative integer, since give . Nor does it contain : a non-zero element has
or , so it is at
least . The
coefficients must range over all of .
The
greatest common divisor
An integer is
a common divisor of and if and . Every pair has
the common divisor (Proposition 3.1.1
(a)). For the coins, is a common divisor of
and , and the question was
why it is the one that matters.
The greatest common divisor is the largest
integer that divides both.
Definition
3.2.2 (Greatest Common Divisor)
Let . If , the greatest common
divisor is the greatest element, for , of the set of common
divisors of and
. We set .
In words: among all integers dividing both and , take the largest. The
definition says “the greatest element”, so it owes us a
proof that there is one.
Well-definedness. Let , and
let be the set of
common divisors of and . It is non-empty, since
. Say (otherwise , and the same
argument runs with ). By Proposition 3.1.1
(h), one of ,
is positive;
call it . Every
satisfies
: if , then by Proposition 3.1.1
(d), and by
Proposition 3.1.1
(e); if ,
then . So is
bounded above, and by Proposition 2.3.6
it has a greatest element. Since , that element is
at least . Hence
whenever , and ,
since the condition “ and ” is symmetric in and .
Examples:
- .
A positive common divisor satisfies , by Proposition 3.1.1
(e), and ,
so by discreteness (Theorem 2.3.4
(c)), as in the small-primes remark of Section 3.1. Now
and , because and
have non-zero remainders (the divisibility test after Theorem 3.1.2),
while divides
both. So the greatest common divisor is .
- : the common divisors of and are the divisors of
(Proposition 3.1.1
(d) and Proposition 2.3.2
(a)), and the greatest is , by Proposition 3.1.1
(e).
-
for every : a common divisor divides , so (Proposition 3.1.1
(g)), and the greater is .
Why the convention for . Every
integer divides ,
so and have no greatest common
divisor for ,
and some value has to be chosen. The value is the one that keeps
clauses (c) and (e) of the theorem below true for , as the remark
after it shows. It also matches Sets, Relations, and Cardinality, Example (The supremum under divisibility is the least common multiple)
of Sets, Relations, and Cardinality, Section
2.6, where is the
top of ,
divisible by everything.
Listing divisors one by one, as in the first example,
is slow. The Euclidean algorithm below replaces the list
by one division per step, and Bézout’s theorem is what
makes it work.
Bézout’s
theorem
Here is the answer to the coin question for every
pair of integers: the payable amounts are exactly the
multiples of the greatest common divisor, and the
greatest common divisor is itself payable.
Theorem
3.2.1 (Bézout’s Theorem)
Let , not both , and let .
- (a) has a least element
, and for some
.
- (b) and .
- (c) Every common
divisor of and
divides .
- (d) . In
particular, for some .
- (e) .
Try it first (ten minutes): for and , list the positive
numbers
you can reach. Which is the least, and why should the
least one divide ?
Idea. The obvious plan starts from
the greatest common divisor and tries to write it as
. It stalls:
the definition of says nothing about combinations, so there is
nothing to build
and from. The
attempt on and
suggests
starting at the other end. The positive combinations
have a least element, and it was found as
a combination. Why should it divide ? Divide by it. The remainder
is minus a
multiple of a combination, so it is again a combination,
and it is smaller than the least positive one. So it
cannot be positive: it is . Once the least
positive combination is known to divide
and , the rest is
bookkeeping: every common divisor divides the
combination , so
none exceeds it.
Before reading on: where is the minimality of
used, and where
its positivity?
Proof.
(a) Suppose ; if , then , and the argument
is the same with
in place of . Both
and lie in , and by Proposition 3.1.1
(h) one of them is positive. So . Every
element of is
positive, so is a
lower bound, and by Proposition 2.3.6
has a least
element . Since
,
there are with .
(b) Since , Theorem 3.1.2
(a) gives with and . Then so . If , then and , contradicting the minimality of . Hence , and , that is, . Dividing by in the same way gives
.
(c) Let and . By Proposition 3.1.1
(c), .
(d) By (b), is a common divisor of
and . Let be any common divisor.
If , then
by (c),
and by Proposition 3.1.1
(e), since . If , then . So is the greatest common
divisor: by Definition 3.2.2,
and .
(e) Let . Then . Let . By (b),
and , so by Proposition 3.1.1
(c), that is, . This proves the theorem.
The answer to the prompt: the minimality of is used once, in (b),
to force the remainder to be . The positivity of
is used twice: to
divide by at all
(Theorem 3.1.2
needs a positive divisor), and in (d), where for positive
comes from Proposition 3.1.1
(e) and for the other from . (The step uses the
positivity of ,
not of , which is
why the case
is split off.)
The proof of (b) is the move this chapter is built
on, and we give it a name: least positive
element, then divide. Take the least positive
element of a set
closed under integer combinations; divide any element of
the set by ; the
remainder lies in the set and is smaller than , so it is . Section 3.3 uses the
move again for common multiples, and Section 3.4 for
sets closed under subtraction.
For the coins, the theorem says: the payable amounts
form , where is the least positive
payable amount, and . The Try-it-first list finds .
Pairs whose greatest common divisor is get a name of their
own.
Definition
3.2.3 (Coprime Integers)
Integers are coprime if .
For instance,
and are coprime,
and so are and
any ; but and are not, since , and
neither are and
, since . For
coprime integers, (d) of the theorem produces as a combination, and
conversely:
Corollary
3.2.2 (Coprime Means 1 Is a Combination)
Let . Then and are coprime if and only
if for
some .
Proof. If , then
,
since , and Theorem 3.2.1
(d) gives with .
Let
. Then
,
since otherwise . So , and divides and , hence divides by Proposition 3.1.1
(c). By Proposition 3.1.1
(g), or , and rules out . So .
The direction is how
coprimality is usually proved: exhibit one combination
equal to . Thus
shows again that and are coprime, with no
list of divisors.
The
Euclidean algorithm
Bézout’s theorem says that is a
combination of
and , but its
proof finds it as a least element, which is no way to
compute it. Computing needs a step that makes the
numbers smaller without changing the set of
combinations. Division with remainder is that step.
Lemma
3.2.3 (One Step of the Euclidean
Algorithm)
Let
and , and let with . Then , and hence .
Proof. For , . For , . So the two sets are
equal. Neither pair is , since . By Theorem 3.2.1
(a) and (d), is the least element of , and is the least
element of , the same set. So .
The lemma does not need to be the remainder;
any will do.
Choosing the remainder makes the new pair smaller, and
repeating the step gives a sequence. To define “repeat”
without “and so on”, we use the recursion theorem.
Theorem
3.2.4 (The Euclidean Algorithm)
Let
and . Define for by and where, when , is the remainder of
on division by
. Then:
- (a) for every ;
- (b) there is a least
with
; moreover
, and for
every ;
- (c) .
The sequence is well defined. Let send to , where is the remainder of
on division by
, if , and to if . This is a
function: the remainder exists and is unique by Theorem 3.1.2
(a), and it lies in because (Theorem 2.3.4
(b)). The recursion theorem (Sets, Relations, and Cardinality, Theorem 2.3.1,
read on as Theorem 1.5.1
by Corollary 1.7.3
(b)), with , starting value and step , gives exactly one sequence with the two
displayed properties.
Idea. Part (a) is Lemma 3.2.3,
once per step, carried along by induction. For (b), the
second entries are natural numbers that drop at each
step while they are positive, and a set of natural
numbers has a least element, which cannot be positive.
For (c), at the first index with , the invariant
(a) reads , and Bézout’s theorem identifies the gcd
as the least positive element of this set.
Proof.
(a) We use Logic and Proof, Axiom 4.2.1
(through Corollary 1.7.3
(b)) on , for
: “”. The base case holds since .
Suppose . If
, then
for some , and Lemma 3.2.3
with , in place of , gives If , then , and is .
(b) The set is non-empty and has the lower
bound , so it has
a least element
(Proposition 2.3.6).
If , then
by the definition of the step and Theorem 3.1.2
(a), contradicting the choice of . So , and the set
is non-empty, with lower bound . Let be its least element
(Proposition 2.3.6).
Then , since
; so
. For , by the choice
of , so (as , Theorem 2.3.4
(b)), and .
(c) Since , and , so by (b),
and the definition of the step gives . By
(a) with , and
since ,
The least positive element of is : it lies in the set
(), and every positive element is divisible by
, so by Proposition 3.1.1
(e). Since , , and by Theorem 3.2.1
(a) and (d), the least element of is . Hence .
In practice the sequence is written as a chain of
divisions, each dividing the previous divisor by the
previous remainder, until a remainder is ; then , the last
non-zero second entry, is the gcd. If , it is the last
non-zero remainder ; if , it is , and then . Exercise B3
shows that at most divisions are
needed.
To find coefficients with , we run the identity of Lemma 3.2.3
backwards.
Algorithm.
Back-substitution. Write out the
divisions for , so that and . Start from
, a combination of the last
pair. Then, for in turn, rewrite a combination
of the pair with index as one of the pair
with index , by
substituting : the identity in the proof of Lemma 3.2.3.
After , the
combination is one of and . Multiply it out to check it. (By hand, the
step
changes nothing, since ; so one
starts from the last division with a non-zero remainder,
as in the example below.)
The procedure only computes; nothing rests on it.
That some
exist is Theorem 3.2.1
(d), and the final multiplication checks the particular
found.
Example
(Two runs of the algorithm)
Compute and , and write each as a combination of the two
numbers.
Solution. The pair . The
chain of divisions is In the notation of the theorem, runs through
, , , , , so and . Back-substitution, from the third division
up: Check: , , and .
The pair . The first entry may be negative; only
the second must be positive. The remainder of on division by is , not : So , and Check: , , and .
Warning. Bézout coefficients are
not unique. From and , So “the” coefficients of means nothing
by itself; when a computation needs particular ones,
they are those produced by back-substitution, and any
other pair works as well.
Quick check. Compute and .
Solution. . Every
integer divides ,
so the common divisors of and are the divisors of
, which are those
of (Proposition 3.1.1
(d) and Proposition 2.3.2
(a)). The positive ones are at most (Proposition 3.1.1
(e)), and is one
of them. (The theorem does not apply directly to , since its second
entry is negative; it does apply to , with the one
division .)
, by the chain , ,
.
Exercises
A. Check your
understanding
Exercise
(A1)
These questions are about the proof of Theorem 3.2.1.
- (a) Where is the
minimality of
used?
- (b) Run the proof on
:
find , , , and the divisions of
(b).
- (c) Which step fails
for ?
- (d) State the idea
of the proof in two sentences.
Solution.
(a) Once, in (b):
the remainder of
on division by
is a combination
of and , and if it were
positive it would be an element of smaller than . Minimality forces
.
(b) The set contains . Every element of is
divisible by ,
since and
(Proposition 3.1.1
(c)), so every element of is at least (Proposition 3.1.1
(e)). Hence ,
with and
. The
divisions of (b) are and : both remainders are , as the proof
predicts.
(c) Step (a):
, so , and Proposition 2.3.6
does not apply. There is no to divide by.
(d) Take the
least positive integer combination of and . Dividing (or ) by leaves a remainder that
is again a combination and smaller than , so it is ; thus is a common divisor,
and since every common divisor divides the combination
, it is the
greatest.
B. Practice
Exercise
(B1)
Run the Euclidean algorithm on , and use
back-substitution to write as with .
Solution. The chain of divisions is
so by Theorem 3.2.4
(c). Back-substitution: Check: , , and . Hence
, works.
Exercise
(B2)
Let . Prove that ,
and that if .
Solution. First claim. If
,
then also , and both sides are by convention.
Otherwise as well, since would give (Proposition 2.3.2
(a); because
and the
inverse is unique). By Proposition 3.1.1
(d),
implies ,
and
implies (Proposition 2.3.2
(a)). So and
have the same
divisors, the pairs and have the same common divisors, and the
greatest is the same (Definition 3.2.2).
Second claim. Let . Every integer
divides (Proposition 3.1.1
(a)), so the common divisors of and are the divisors of
. Among them is
itself. A
positive divisor
satisfies
by Proposition 3.1.1
(e), and a non-positive one satisfies . So is the greatest, and
.
Exercise
(B3: The algorithm stops quickly)
In the notation of Theorem 3.2.4,
prove that for every with . Deduce that : the algorithm stops after at most divisions.
Solution. We use Logic and Proof, Axiom 4.2.1
(through Corollary 1.7.3
(b)) on , for
: “if , then ”. The base
case is . Suppose
, and let . Then , so and gives . By Theorem 3.2.4
(b), , so by discreteness (Theorem 2.3.4
(c)), that is, . Hence , which is .
With :
,
so . Each
index is
one division, so there are of them.
C. Going deeper
Exercise
(C1: Exit check: Bézout)
Let , not both , and let . Prove that has a least element
; that and ; that every
common divisor of
and divides ; and that .
Solution. has a least
element. Say (otherwise exchange the roles of and ). Both
and are combinations of and , and one of them is
positive (Proposition 3.1.1
(h)); so . It is bounded below by , so it has a least
element (Proposition 2.3.6),
and
for some .
divides
and . Divide by (Theorem 3.1.2
(a)):
with . Then is a combination of and . If , then and , against the
minimality of . So
and . The same
argument with
gives .
Common divisors divide . If and , then
(Proposition 3.1.1
(c)).
is the
gcd. is a
common divisor. A common divisor divides , so (Proposition 3.1.1
(e)); a common divisor satisfies . So is
the greatest common divisor (Definition 3.2.2).
Marking scheme. (10 points) - 2:
shows , with a reason that covers or (for instance,
one of , is a positive
combination). - 1: obtains the least element by a cited
well-ordering result for sets of integers bounded below.
- 3: divides by
and writes the
remainder as a combination of and . - 2: uses the
minimality of to
force the remainder to be , for and for . - 2: shows every
common divisor divides , and deduces that is the greatest (with
the case of non-positive divisors). Fatal errors (0 for
the step): assuming that the gcd is a combination of
and (circular); citing Theorem 3.2.4
(c) or the gcd clause of Lemma 3.2.3
(both are proved from Theorem 3.2.1,
so this is circular); “ divides because is the least positive
combination”, with no division step. A second route goes
through the Euclidean algorithm, with back-substitution,
by induction on the number of steps. Citing Theorem 3.2.4
(a), (b) and the equality
of Lemma 3.2.3
is allowed; if the invariant used is “the common
divisors are unchanged”, it must be proved directly from
. The
invariant earns the 3 points for the division, and
termination earns the 2 points for minimality. The
answer must still identify the gcd with the least
element of ( since
;
since the gcd divides every combination). The rest is
marked as written.
Exercise
(C2: Scaling the gcd)
Let
and . Prove that .
Solution (Hint 1). Use the
description of in Theorem 3.2.1
(e), and the description of the gcd as a least element
in (a) and (d).
Solution (Hint 2). If and
, first show .
Solution. If , then
by Proposition 2.3.2
(b), and both sides are : .
Otherwise let , so . Say (otherwise ; exchange the roles of and ); then , since and has no zero divisors
(Proposition 2.3.5
(f)). So , and Theorem 3.2.1
applies to both pairs.
The combinations. For , . As range over , ranges over (Theorem 3.2.1
(e)), so
The least positive element. by (O4), and
. Every positive element of is divisible by
, so by Proposition 3.1.1
(e). So is the
least element of , and
by Theorem 3.2.1
(a) and (d), .
For instance, , since and are coprime (, Corollary 3.2.2).
Marking scheme. (10 points) - 2:
treats by the convention, and checks
otherwise, with a reason (no zero divisors). - 4: shows
, citing Theorem 3.2.1
(e) for . -
2: shows that is
the least positive element of . - 2: concludes
through Theorem 3.2.1
(a), (d) for . Fatal errors (0 for the step): asserting
that every common divisor of and is times a common divisor
of and (false: divides and , and is not times an integer);
using prime factorizations, which this section does not
have. A second route, showing is a common divisor
and every common divisor divides because , earns the same total: 2 for treating by the
convention and checking otherwise (no zero divisors); 3
for showing is a
common divisor and a combination (
with from Theorem 3.2.1);
3 for every common divisor dividing ; 2 for concluding
is the greatest
(, rule
(e) for positive divisors, and the non-positive
divisors) via Definition 3.2.2.