MATH10040
Chapter 1: Integers and divisibility
1. Divisibilty
Recall the basic definition:
Definition 1.1. If a, b ∈ Z, we say that b divides a, or that a is a multiple
of b – and we write b|a – if there is an integer c such that a = bc.
Example 1.2. Take a = 75, b = 5. 5|75 since 75 = 5 · 15. (So in this case
c = 15.)
Example 1.3. If b is any integer, then b|0 since 0 = b · 0.
So 0 is divisible by every integer.
Example 1.4. If 0|a then a = 0 · c for some integer c, and hence a = 0.
Thus the only integer divisible by 0 is 0.
Example 1.5. An integer is even if and only if it is divisible by 2. It is
odd if and only if it is not divisible by 2.
1.1. Elementary properties of divisibility.
Lemma 1.6. If a, b ∈ Z and if b|a then b|ta for all integers t.
Proof. Since b|a there is some integer c with a = bc. Let t ∈ Z. Then
at = (bc)t = b(ct) is a multiple of b since ct is an integer.
Lemma 1.7. If d ∈ Z and if d|a and d|b, then d|a + b.
Proof. Since d|a, a = dm for some m ∈ Z. Since d|b, b = dn for some n ∈ Z.
Thus
a + b = dm + dn = d(m + n)
is a multiple of d, since m + n ∈ Z.
Lemma 1.8. If d ∈ Z and if d|a and d|b, then d|as + bt for any s, t ∈ Z.
Proof. d|as and d|bt by Lemma 1.6. Therefore d|as + bt by Lemma 1.7. 1.2. The Division Algorithm. Of course, in general, given two integers
a and b, it will not be true that b|a.
Even in primary school we learn how to make the best of this situation:
(when a > 0) we find the largest multiple of a which is less than b. The
remaining difference is called the remainder
1
2
Example 1.9. Given a = 37 and b = 5. Then 35 = 5 · 7 is the multiple of 5
which is closest to – but not greater than – 37. The remainder is 37−35 = 2.
We say that 37 leaves remainder 2 on division by 5.
Note that our calculation can be summarised as 37 = 5 · 7 + 2.
Dividing across by 5, we can write this as
37
2
=7+ .
5
5
Here, 7 is the largest integer which is not greater than 37/5. It is called the
integer part or greatest integer of 37/5.
2/5 is called the fractional part of 37/5.
Definition 1.10. Let x be a real number. We denote by bxc the largest
integer which is less than or equal to x. (bxc is called the greatest integer
of x or the floor of x.)
Example 1.11. b1.5c = 1.
b37/5c = 7.
bπc = 3.
b157c = 157.
b−1.5c = −2.
b−πc = −4.
Lemma 1.12. Let x ∈ R and let t = bxc. Then t ≤ x < t + 1.
Proof. By definition of bxc, t ≤ x.
Suppose, for the sake of contradiction, that x 6< t + 1. Then t + 1 ≤ x. But
since t ∈ Z, t + 1 ∈ Z. Since t + 1 > t, this contradicts the fact that t is the
largest integer which is less than or equal to x.
The following (very important) theorem just sets down in formal mathematical language something you have known (or at least assumed true) since
primary school. We will use it extensively throughout the semester: it is
the basis for almost everything which follows.
Theorem 1.13 (The Division Algorithm). Let p, q ∈ Z with q > 0.
Existence There exist integers t, r ∈ Z such that
p = tq + r
and
0 ≤ r < q.
Uniqueness There is only one pair of integers t and r satisfying the conditions
p = tq + r
and
0 ≤ r < q.
3
Remark 1.14. We say that r is the remainder of p on division by q. (Because of the uniqueness part of the theorem, it makes sense to use the definite
article - ‘the’ - here.)
We will sometimes use the notation Rq (p) for the remainder of p on division
by q.
Thus R5 (27) = 2, R7 (50) = 1, R10 (123456) = 6, etc.
(This notation is not standard; there is no standard agreed notation for
remainders.)
Remark 1.15. Of course, if we do not require that 0 ≤ r < q, then there
are many pairs t, r satisfying the equation p = tq + r: take any integer t
and then take r := p − tq.
The point of the theorem is that there is one and only one solution satisfying
the crucial extra condition that 0 ≤ r < q.
Proof. We first prove the existence part:
Existence Let t = bp/qc. Then t ∈ Z, and
p
t≤ <t+1
q
by our Lemma. Multiply across by q to get
tq ≤ p < tq + q.
Subtracting tq gives
0 ≤ p − tq < q.
Thus, if we let r := p − tq then 0 ≤ r < q and p = tq + r.
Uniqueness Suppose that t, r ∈ Z satisfy
(1)
p = tq + r
and
0 ≤ r < q.
We’ll show first that t must be equal to bp/qc: dividing across by q
in (1) gives
p
r
r
=t+
and 0 ≤ < 1.
q
q
q
Since 0 ≤ qr we have pq = t + qr ≥ t. Since qr < 1, pq = t + qr < t + 1.
Thus the integer t satisfies t ≤ pq < t + 1. Thus it is the largest
integer which is less than or pq . By definition, it follows that t = b pq c.
Hence t is determined by p and q.
Since r = p − qt = p − b pq ct, it follows that r is also uniquely
determined by p and q.
4
2. Greatest Common Divisors
2.1. Example: Water-pouring problems. These problems and their
connection with Die Hard 3 will be covered in the lectures.
2.2. Definition and elementary properties.
Definition 2.1. Let a, b ∈ Z \ {0}.
An integer which divides both a and b is called a common divisor.
The greatest common divisor of a and b is the largest integer which divides
both a and b.
We will denote it gcd(a, b), or, more simply when no confusion can arise,
(a, b).
We begin with the following observation:
Lemma 2.2. For any a, b ∈ Z \ {0}, (a, b) ≥ 1.
Proof. Certainly 1 is a common divisor of a and b. So the greatest common
divisor is at least as big as 1.
For small pairs of numbers, it is easy to calculate the gcd by considering
the factors of the smaller number: (6, 15) = 3. (5, 15) = 5. (37, 43) = 1. etc
For larger pairs, this is not a feasible or efficient approach. (Try to calculate
(1517, 2183).)
We will see below that there is a beautifully efficient method for calculating
the gcd of two integers a and b without factoring either of them. (This is
Euclid’s Algorithm.)
Definition 2.3. More generally suppose that a1 , . . . , at are any t nonzero
integers.
If d|ai for i = 1, . . . , t we say that d is a common divisor of a1 , . . . , at .
The largest common divisor of a1 , . . . , at is called the greatest common divisor, and is denoted gcd(a1 , . . . , at ) or, more simply, (a1 , . . . , at ).
Example 2.4. gcd(12, 33, 48) = 3.
gcd(14, 49, −21, 56) = 7.
Exercise 2.5. Find three nonzero integers a, b, c such that (a, b) > 1,
(a, c) > 1 and (b, c) > 1 but (a, b, c) = 1.
We will often use the following elementary observation about gcds:
5
Lemma 2.6. Suppose that a, b are nonzero integers and let g = (a, b). Then
a b
,
= 1.
g g
Proof. Since g is a common divisor of a and b there are integers m, n such
that a = gm and b = gn; i.e. a/g = m, b/g = n ∈ Z.
Suppose that d ≥ 1 is a common divisor of m and n. So m = ds and n = dt
for some integers s and t. It follows that a = (gd)s and b = (gd)t, and
hence gd is a common divisor of a and b.
Since g is the greatest common divisor of a and b, this implies that d = 1.
Corollary 2.7. Let q be a nonzero rational number. Then there exist integers m, n satisfying (m, n) = 1 and q = m/n.
Proof. Since q is rational, q = a/b for some nonzero integers a and b. Let
g = (a, b). Then there are integers m, n with a = gm, b = gn. By Lemma
2.2, (m, n) = 1. Also
a
gm
m
q= =
= .
b
gn
n
If q is a nonzero rational number and q = m/n with (m, n) = 1, we say that
we have written it in reduced form or in lowest terms.
Example 2.8. Write the rational number 24/16 in reduced form. Answer:
3/2 (cancel the gcd 8 above and below).
Suppose given two nonzero integers a and b. Let us consider the following
problem:
Which integers can be written as a combination of the form as + bt for some
integers s and t?
(We will discuss the connection of this question with water-pouring problems in class.)
The theory of divisors tells us that in general we cannot expect that every
integer can be expressed in this way: Recall that if d is a common divisor of
a and b then d also divides every integer of the form as + bt. In particular,
the greatest common divisor g = (a, b) must divide every integer of the form
as + bt. To put this another way: If the integer n is not divisible by (a, b)
then it cannot be expressed as as + bt for some integers s, t.
Example 2.9. The equation 1849 = 27s+15t has no integer solutions since
3 = (27, 15) and 3 6 |1849.
6
We can express this fact as follows: A necessary condition for the equation
n = as + bt to have integer solutions is that (a, b)|n.
The obvious follow-up question is: Is this condition also sufficient?: If
(a, b)|n does it follow that there are integers s and t satisfying n = as + bt?
Let g = (a, b). A particular case of this last question is: can g be expressed
as a combination of a and b; do there exist integers s and t such that
g = as + bt?
Amazingly, the answer to these questions is yes:
Theorem 2.10 (GCD Theorem). Let a, b be nonzero integers. Let g =
(a, b). Then there exist integers s and t such that g = as + bt.
Proof. We are going to use the well-ordering principle: every nonempty set
of positive integers has a least element.
First let I be the set of all integers which can be expressed in the form
au + bv for some u, v ∈ Z; i.e.
I := {n ∈ Z | n = au + bv for some u, v ∈ Z}.
Note that a ∈ I since a = a · 1 + b · 0. Similarly −a = a · (−1) + b · 0 ∈ I.
Similarly ±b ∈ I.
Let S be the subset of positive integers which belong to I:
S := {n ∈ I | n > 0}.
S is non-empty (since, for example, either a ∈ S if a > 0 or −a ∈ S if
a < 0). By the well-ordering principle S has a least element. Let’s call it h.
Since h ∈ S ⊂ I, there exist s, t ∈ Z such that h = as+bt. By our discussion
above, it follows that g|h.
Claim: h is a common divisor of a and b.
Proof of Claim: We will show that h|a. An identical proof shows that
h|b. By the division algorithm, we can write a = wh + r for some w ∈ Z
and r satisfying 0 ≤ r < h.
However, note that r ∈ I, since
r = a − wh = a − w(as + bt) = a · (1 − ws) + b · (−wt), 1 − ws, −wt ∈ Z.
However, since r < h and h is the least element of S, it follows that r 6∈ S;
i.e. r 6> 0. Since 0 ≤ r it follows that r = 0, and hence a = wh, proving the
claim.
Since h is a common divisor of a and b, and since g is the greatest common
divisor of a and b, it follows that h ≤ g. But h > 0 and g|h. This implies
h = g, and the proof is complete (since h is of the form as + bt).
7
Observe that as a consequence of the proof we have:
Corollary 2.11. Let a and b be nonzero integers, and let g = (a, b). Then
g is the smallest positive integer which can be written in the form as + bt
for some s, t ∈ Z.
Another corollary of the Theorem is the following:
Corollary 2.12. Let a, b be nonzero integers and let d be any common
divisor of a and b. Then d|(a, b).
Proof. Let g = (a, b). Then g = as + bt for some s, t ∈ Z by the Theorem.
Thus, if d|a and d|b then d|as + bt = g.
Hence, not only is the greatest common divisor larger than any other common divisor; it is in fact a multiple of any other common divisor.
The theorem also allows us to answer completely the question with which
we began this discussion:
Corollary 2.13. Let a and b be nonzero integers and let g = (a, b). An
integer n can be expressed in the form as + bt with s, t ∈ Z if and only if n
is a multiple of g.
Proof. We have already seen in the discussion above that any integer of the
form as + bt is divisible by g.
We must prove the converse statement: Suppose that g|n. We must show
that n = as + bt for some integers s and t.
Now g|n =⇒ n = gm for some m ∈ Z. By the GCD Theorem, g = au + bv
for some u, v ∈ Z. Therefore
n = gm = (au + bv)m = a(um) + b(vm)
which is of the required form, since s = um, t = vm ∈ Z.
We will often have occasion to use the following very important special case
(when g = 1) of this last corollary:
Corollary 2.14. Let a and b be nonzero integers and suppose that (a, b) = 1.
Then there exist integers s and t satisfying 1 = as + bt.
We also make the simple observation that the converse statement is also
true:
Corollary 2.15. Let a and b be nonzero integers. Then (a, b) = 1 ⇐⇒
there exist s, t ∈ Z with as + bt = 1.
8
Proof. ‘=⇒’ is just the last result.
⇐=: Suppose conversely that there are integers s and t satisfying as+bt = 1.
Suppose that d is a common divisor of a and b. Then d|as + bt = 1. So
d = ±1. Hence (a, b) = 1.
Definition 2.16. We say that the nonzero integers a and b are relatively
prime if (a, b) = 1.
Example 2.17. Are there integers s and t such that the equation 55 =
97s + 61t?
Answer: yes! (61, 97) = 1. So any multiple of 1 (i.e. any integer) can be
expressed in the form 97s + 61t. In particular, 55 can be expressed in this
way.
Example 2.18. Are there integers s and t such that 55 = 91s + 63t?
Answer: No. (91, 63) = 7 and 7 6 |55.
2.3. Euclid’s Algorithm. We know that the equation 55 = 97s + 61t has
integer solutions, but how do we find them?
There is a very elegant procedure, due to Euclid, which simultaneously
finds the gcd, g of two numbers a and b, and finds a solution of the equation
g = as + bt.
The principle behind this procedure is the following simple result:
Lemma 2.19. Let a and b be nonzero integers and suppose that b = am + c
for some integers m, c with c 6= 0. Then
(a, b) = (a, c).
(That is, in calculating the gcd of a and b, we can replace b with c and
instead calculate the gcd of a and c).
Proof. We simply show that the pairs of integers a, b and a, c have precisely
the same common divisors. It follows that they have the same greatest
common divisor.
Suppose first that d is a common divisor of a and b. Since c = −am + b we
have d|c. Thus d is acommon divisor of a and c.
Conversely, suppose that f is a common divisor of a and c. Since b = am+c,
we have f |b also and hence f is a common divisor of a and b.
In particular, Euclid’s algorithm consists of using the following special case
over and over again to reduce the size of the numbers involved:
Lemma 2.20. Let a and b be positive integers with a < b. Let r be the
remainder of b on division by a. Then (a, b) = (a, r).
9
Proof. By the division algorithm, b = ta + r for some integer t. By the last
lemma (a, b) = (a, r).
We begin with a very elementary example, just to illustrate the method:
Example 2.21. Find the greatest common divisor g of 15 and 37. Express
g is the form 15s + 37t for some s, t ∈ Z.
We first divide the smaller into the larger:
(2)
37 = 2 · 15 + 7
By Lemma 2.20, g = (15, 37) = (15, 7) = (7, 15).
Divide the smaller into the larger again:
(3)
15 = 2 · 7 + 1
By Lemma 2.20 again, g = (7, 15) = (1, 7) = 1.
So far, this tells us what we can see at a glance: (15, 37) = 1.
However, we can use the equations (2) and (3) to determine values of s and
t such that 15s + 37t = 1:
First, start with the last equation – equation (3) – and use it to express 1
in terms of 7 and 15:
(4)
1 = 15 − 2 · 7.
Then use the previous equation to express 7 in terms of 15 and 37 and
substitute this expression for 7 into (4):
1 = 15 − 2 · 7 = 15 − 2 · (37 − 2 · 15) = 5 · 15 − 2 · 37.
So s = 5 and t = −2 are the required integers.
Here are some less elementary examples.
Example 2.22. Find the greatest common divisor g of the numbers 986
and 437, and find integers s and t satisfying g = 986s + 437t.
Solution: First we use the division algorithm repeatedly until (our remainder is a common divisor):
(5)
(6)
(7)
(8)
(9)
986
437
112
101
11
=
=
=
=
=
2 · 437 + 112
3 · 112 + 101
101 + 11
9 · 11 + 2
5·2+1
10
This gives g = (986, 437) = 1. (To spell this out: Using Lemma 2.20
repeatedly
(986, 437) = (437, 112) = (112, 101) = (101, 11) = (11, 2) = 1.)
Now we bootstrap our way in reverse through the equations to find s and t:
1 = 11 − 5 · 2 by (9)
= 11 − 5 · (101 − 9 · 11) = 46 · 11 − 5 · 101 using (8)
= 46 · (112 − 101) − 5 · 101 = 46 · 112 − 51 · 101 using (7)
= 46 · 112 − 51 · (437 − 3 · 113) = 199 · 112 − 51 · 437 using (6)
= 199 · (986 − 2 · 437) − 51 · 437 = 199 · 986 − 449 · 437 using (5).
Thus s = 199 and t = −437 work.
Example 2.23. Find the gcd of 1517 and 2183 and express it as a linear
combination of these two numbers.
Solution:
2183
1517
666
185
111
=
=
=
=
=
1517 + 666
2 · 666 + 185
3 · 185 + 111
111 + 74
74 + 37
Since 37 divides 74 (and hence also 111) we have reached the end of the
road, and we can deduce that (2183, 1517) = 37.
Finally,
37 = 111 − 74 = 111 − (185 − 111) = 2 · 111 − 185
= 2 · (666 − 3 · 185) − 185 = 2 · 666 − 7 · 185
= 2 · 666 − 7 · (1517 − 2 · 666) = 16 · 666 − 7 · 1517
= 16 · (2183 − 1517) − 7 · 1517 = 16 · 2183 − 23 · 1517.
Thus, 37 = 2183s + 1517t where s = 16 and t = −23.
Example 2.24. Find a solution of the equation 55 = 97x + 61y in integers
x and y.
11
Solution: We use the method suggested by the proof of Corollary 2.13.
97
61
36
25
11
3
=
=
=
=
=
=
61 + 36
36 + 25
25 + 11
2 · 11 + 3
3·3+2
2+1
So
1 = 3 − 2 = 3 − (11 − 3 · 3) = 4 · 3 − 11
= 4 · (25 − 2 · 11) − 11 = 4 · 25 − 9 · 11
= 4 · 25 − 9 · (36 − 25) = 13 · 25 − 9 · 36
= 13 · (61 − 36) − 9 · 36 = 13 · 61 − 22 · 36
= 13 · 61 − 22 · (97 − 61) = 35 · 61 − 22 · 97.
Multiplying across the equation 1 = 35 · 61 − 22 · 97 by 55 gives
55 = (35 · 55) · 61 − (22 · 55) · 97 = 1925 · 61 − 1210 · 97.
Thus x = −1210 and y = 1925 is a solution.
© Copyright 2026 Paperzz