Unit 3 - Congruence (Open University)
Unit 3 - Congruence (Open University)
Number Theory
Unit 3
Congruence
97 96 95 94 93 92 91 90
98 71 70 69 68 67 66 89
99 72 53 52 51 50 65 88
100 73 54 43 42 49 64 87
101 74 55 44 41 48 63 86
102 75 56 45 46 47 62 85
103 76 57 58 59 60 61 84
104 77 78 79 80 81 82 83
CONTENTS
Introduction 4
1 Properties of Congruence 6
1.1 Definition and basic properties 6
1.2 Residue classes 9
1.3 Further properties 12
2 Divisibility Tests 14
3 Linear Congruences 16
3.1 Polynomial congruences 16
3.2 Linear congruences 18
3.3 Solving linear congruences 20
4 Simultaneous Linear Congruences 22
4.1 The Chinese Remainder Theorem 22
4.2 Solving simultaneous congruences 24
Additional Exercises 27
Solutions to the Problems 30
Solutions to Additional Exercises 35
Index 43
INTRODUCTION
It is curious how often what seem to be very different branches of
mathematics become interlinked by some problem. For more than
2000 years it had been known how to construct both an equilateral triangle
and a regular pentagon inscribed in a given circle using only compass and
straightedge. But as the seventeenth century drew to its close constructions
were still not known for any other regular polygon with a prime number of
sides. The brilliant French mathematician Fermat had been discussing the Fermat will appear frequently in
n
numbers Fn = 22 + 1 (later to become known as Fermat Numbers) the remaining units of the course.
believing them all to be prime, unaware of how intricately these numbers We shall read more about him in
Unit 4.
were woven in the solution of the polygon problem. It required the genius of
the German mathematician Gauss to see how these numbers could be used
to solve the construction problem.
Carl Frederick Gauss (1777-1855)
Gauss was unquestionably one of the greatest mathematicians of all
time. His father, a labourer in Brunswick, did not want his son to
receive an education. But Carl was an infant prodigy, and his mother
encouraged him in his studies. It is known that as a child of three he
corrected an error his father made in a wages list, and by age ten he so
amazed his schoolteacher with his arithmetic prowess that the teacher
admitted there was no more he could teach the boy. The tale is reported
that one day, to keep the children occupied, the teacher asked them to
add up all the numbers from 1 to 100. Gauss handed in his slate
immediately and to the dismay of the teacher was the only one in the
class to get the correct answer. It is presumed that Gauss had discovered
for himself the formula for the sum of the first n natural numbers.
Before he reached the age of twenty Gauss had, amongst many other
achievements, conjectured the Prime Number Theorem, proved the Law
of Quadratic Reciprocity (which we shall meet in Unit 6 ) and given a
construction using compass and straightedge for a regular 17-gon to be
inscribed in a given circle. It was this last result that launched Gauss on
his career as a mathematician and it is the first result listed in a diary
he kept of all his discoveries. The diary, which did not come to light
until some forty years after his death, records brief statements of
146 results which amply display the genius of Gauss.
But it is his book ‘Disquisitiones Arithmeticae’, published when he was
24 years old, for which Gauss is best remembered. In this renowned
work Gauss laid the foundations of modern Number Theory. It was here
that he introduced and developed the language and notations of ‘the
algebra of congruence’, and used this novel approach to produce elegant
solutions to a variety of number-theoretic problems. Towards the end of
the book Gauss returned to the construction of the regular 17-gon and
generalized his earlier result to show exactly which regular N -gons can
be constructed with compass and straightedge; the construction is
possible if, and only if, N = 2r p1 p2 . . . pk , where the primes pi are
distinct Fermat numbers and r ≥ 0.
Sadly Gauss’ career as a mathematician was foreshortened as his
interest was caught by many other subjects. In particular a succession of
discoveries gained him a deserved reputation in astronomy, and indeed
for forty years from 1807 he was the director of the Göttingen
Observatory. He is also well remembered for his work on magnetism,
where a unit of magnetic intensity is the ‘gauss’, appropriately named
after him. Late in life he expressed regret that he had abandoned
mathematics, described by him as ‘the queen of the sciences, with the
theory of numbers being the queen of mathematics’. He always held
number theory in the highest esteem and, not surprisingly, his name will
feature regularly in the coming sections.
4
Diversion
Construction of the regular pentagon. AB and CD are perpendicular diagonals. L
is the mid-point of AO. Using compasses: LC = LM ; CM = CN . CN is the
required edge.
5
1 PROPERTIES OF CONGRUENCE
Problem 1.1
For each of the following statements decide whether it is true or false.
(a) 3 ≡ 29 (mod 8)
(b) 3 ≡ −29 (mod 8)
(c) 63 ≡ 37 (mod 13)
(d) 37 ≡ 63 (mod 13)
(e) 63 ≡ 63 (mod 37)
(f) 63 *≡ 13 (mod 25)
Parts (c) and (d) of Problem 1.1 illustrate one apparent property of
congruence, namely that if a is congruent modulo n to b then b is congruent
modulo n to a. Part (e) illustrates the further property that any integer is
congruent modulo n to itself. These are two of a number of general
properties of congruence which highlight certain similarities with ordinary
equality, and which we shall prove in our first result.
6
Theorem 1.1 Properties of congruence
Let n be a fixed positive integer and let a, b, c and d be any integers.
Then the following properties hold.
(a) a ≡ a (mod n).
(b) If a ≡ b (mod n) then b ≡ a (mod n).
(c) If a ≡ b (mod n) and b ≡ c (mod n) then a ≡ c (mod n).
(d) If a ≡ b (mod n) and c ≡ d (mod n) then a + c ≡ b + d (mod n).
(e) If a ≡ b (mod n) and c ≡ d (mod n) then ac ≡ bd (mod n).
(f) If a ≡ b (mod n) then ar ≡ br (mod n), for any integer r ≥ 1.
7
The following problem gives you an opportunity to prove some simple
properties of congruence working from the definition alone.
Problem 1.2
Suppose that a ≡ b (mod n) and m is an integer. Prove the following.
(a) If m > 0 and m divides n then a ≡ b (mod m).
(b) If m > 0 then ma ≡ mb (mod mn) and ma ≡ mb (mod n).
a b " n$
(c) If d > 0 is a common divisor of a, b and n then ≡ mod .
d d d
(d) gcd(a, n) = gcd(b, n).
(e) For any integer c, a + c ≡ b + c (mod n).
Example 1.1
Show that 3737 + 2 is divisible by 13.
We start by looking for numbers to which 3737 is congruent modulo 13. Now
as 37 ≡ −2 (mod 13), Theorem 1.1(f) tells us that
3737 ≡ (−2)37 ≡ (−1) × 237 (mod 13) .
Now
24 = 16 ≡ 3 (mod 13) ,
and so
3737 ≡ (−1) × (24 )9 × 2 ≡ (−1) × 39 × 2 (mod 13) .
But
33 = 27 ≡ 1 (mod 13) ,
so
3737 ≡ 33 × 33 × 33 × (−2) ≡ −2 (mod 13) .
Finally, Theorem 1.1(d) allows us to conclude that
3737 + 2 ≡ (−2) + 2 ≡ 0 (mod 13) ,
which amounts to saying that 3737 + 2 is divisible by 13. "
In the final step of Example 1.1 we inferred from a statement of the form
a ≡ 0 (mod n), that n divides a. This is an immediate consequence of the
definition of congruence. Indeed we have a characterization of congruence
modulo n in terms of the remainders on dividing by n, as given by the
following.
8
Conversely, suppose that a ≡ b (mod n), so that a − b = kn, for some integer
k. Let b have remainder r when divided by n, so that b = nq + r for some
integer q. Then,
a = b + kn = nq + r + kn = (q + k)n + r,
shows that a has the same remainder, r, as does b.
Problem 1.3
Write down the set of least positive residues modulo n, and the set of least
absolute residues modulo n, for (a) n = 10, and (b) n = 11.
Problem 1.4
Determine whether or not each of the following sets is a complete set of
residues modulo 11.
(a) {6, 2, −3, 22, 23, −7, 7, 9, 43, −8, 16};
(b) {02 , 12 , 22 , 32 , 42 , 52 , 62 , 72 , 82 , 92 , 102 };
(c) {0, 1, 2, 22, 23 , 24 , 25 , 26 , 27 , 28 , 29 }.
Properties (d) and (e) of Theorem 1.1 are of great importance. In essence
they say that the residue class to which a sum a + c, or a product ac, belongs
does not depend so much on the individual numbers a and c but rather on
the residue classes to which they belong. To qualify this remark, let us
denote by [r] the residue class modulo n to which the integer r belongs. So
[r] = {. . . , r − 2n, r − n, r, r + n, r + 2n, . . .}.
9
This will mean that residue classes are denoted in many different ways; for
example, taking n = 5, [−1] = [4] = [19] since −1 ≡ 4 ≡ 19 (mod 5). In this
notation properties (d) and (e) can be restated as follows.
(d) If [a] = [b] and [c] = [d] then [a + c] = [b + d].
(e) If [a] = [b] and [c] = [d] then [ac] = [bd].
These two facts amount to saying that the operations defined on the set of
residue classes modulo n by
[a] + [c] = [a + c] and [a] × [c] = [ac]
are unambiguous. Whatever numbers are chosen to represent the two
residue classes, the sum of the numbers will always belong to the same class,
as will the product of the numbers.
Let
Zn = {[0], [1], [2], . . . , [n − 1]}
be the set of all residue classes modulo n. Together with the operations of
addition and multiplication defined above we have an arithmetic on Zn . For
example, taking n = 4 we have the tables
+ [0] [1] [2] [3] × [0] [1] [2] [3]
[0] [0] [1] [2] [3] [0] [0] [0] [0] [0]
[1] [1] [2] [3] [0] [1] [0] [1] [2] [3]
[2] [2] [3] [0] [1] [2] [0] [2] [0] [2]
[3] [3] [0] [1] [2] [3] [0] [3] [2] [1]
where, for example, [3] × [2] = [2] is obtained from the definition
[3] × [2] = [3 × 2] = [6]
and the fact that [6] = [2] since 6 ≡ 2 (mod 4).
Problem 1.5
Working in Z10 , determine [6] + [8] and [6] × [8] and find all [b] such that
[6] × [b] = [8].
Repeat the above, this time working in Z11 .
Diversion
1×8 + 1 = 9
12 × 8 + 2 = 98
123 × 8 + 3 = 987
1234 × 8 + 4 = 9876
12345 × 8 + 5 = 98765
123456 × 8 + 6 = 987654
1234567 × 8 + 7 = 9876543
12345678 × 8 + 8 = 98765432
123456789 × 8 + 9 = 987654321
10
Example 1.2
Show that 13 + 23 + 33 + · · · + 603 is divisible by 5.
In terms of congruence we are asked to show that 13 + 23 + 33 + · · · + 603 is
congruent modulo 5 to 0. Now each of the terms r3 is congruent modulo 5
to one of 0, 1, 2, 3 or 4, and so one line of attack would be to evaluate the
least positive residue modulo 5 of each of these cubes and add up. However,
a considerable short-cut is provided by Theorem 1.1(f), which tells us that if
two numbers are congruent modulo 5 then their cubes are also congruent
modulo 5. So, since 1 ≡ 6 ≡ 11 ≡ · · · ≡ 56 (mod 5), we have
13 ≡ 63 ≡ 113 ≡ · · · ≡ 563 (mod 5) .
Similarly
23 ≡ 73 ≡ 123 ≡ · · · ≡ 573 (mod 5) ;
33 ≡ 83 ≡ 133 ≡ · · · ≡ 583 (mod 5) ;
43 ≡ 93 ≡ 143 ≡ · · · ≡ 593 (mod 5) ;
53 ≡ 103 ≡ 153 ≡ · · · ≡ 603 (mod 5) .
Therefore,
13 + 23 + 33 + · · · + 603 ≡ 12 × (13 + 23 + 33 + 43 + 53 ) (mod 5) . There are simpler ways of solving
Example 1.2. For instance, you
Now, may be familiar with the formula
&
n # %2
23 ≡ 3, 33 = 27 ≡ 2, 43 = 64 ≡ 4 and 53 ≡ 03 ≡ 0 (mod 5) , r3 =
n(n + 1)
2
and so r=1
in which case, putting n = 60, the
13 + 23 + 33 + · · · + 603 ≡ 12 × (1 + 3 + 2 + 4 + 0) = 120 ≡ 0 (mod 5) , result drops out. Our solution here
intentionally illustrates the use of
as claimed. " the properties of congruence.
Example 1.3
Show that there do not exist integers x and y such that x2 + y 2 = 999.
At first glance it might be difficult to see what this question has to do with
congruence. In fact, it is a particular case of a general result concerning the
possible values that a sum of two squares can take modulo 4.
Any integer x is congruent modulo 4 to one of the integers 0, 1, 2 or 3.
Theorem 1.1(f) tells us that x2 is therefore congruent modulo 4 to one of the
numbers 02 , 12 , 22 or 32 . That is, x2 is congruent modulo 4 to either 0 or 1
(since 22 ≡ 0 (mod 4) and 32 ≡ 1 (mod 4)). Similarly, for any integer y, y 2
is congruent modulo 4 to either 0 or 1. Theorem 1.1(d) now gives
x2 + y 2 ≡ 0, 1 or 2 (mod 4)
(as 0, 1 and 2 are the possible results of adding either 0 or 1 to either 0 or 1).
This argument tells us that any integer which is congruent modulo 4 to 3
cannot be written as the sum of two squares. Now 999 ≡ 3 (mod 4) is such
an integer, and so the equation
x2 + y 2 = 999
cannot have a solution in integers. "
Problem 1.6
What is the remainder when 1! + 2! + 3! + · · · + 1000! is divided by 7?
Problem 1.7
Let a be an integer which is not divisible by either 2 or 3. Prove that a2 − 1
is divisible by 24. Hint : Show a2 ≡ 1 (mod 24).
11
1.3 Further properties
There is a property of congruence which, although it is no more than a
re-expression of an established divisibility property, will be used so often
that it merits the status of a theorem.
Theorem 1.3
If a ≡ b (mod m) and a ≡ b (mod n), then
a ≡ b (mod lcm(m, n)) .
Notice how much simpler Problem 1.7 would have been with the benefit of
Theorem 1.3. To show that a2 ≡ 1 (mod 24) it is sufficient to show that
a2 ≡ 1 (mod 8) and a2 ≡ 1 (mod 3). Both these separate parts are quickly
confirmed from congruence ideas:
(1) a odd implies a ≡ 1, 3, 5 or 7 (mod 8), and squaring,
a2 ≡ 1 (mod 8) in all cases;
(2) a not divisible by 3 implies a ≡ 1 or 2 (mod 3), and squaring,
a2 ≡ 1 (mod 3) in each case.
We have seen that if a ≡ b (mod n) then ca ≡ cb (mod n), for any integer c.
What about the converse of this result? If ca ≡ cb (mod n) can we
legitimately cancel the c’s to recover a ≡ b (mod n)? In fact we cannot, as
this simple counter-example shows:
2 ≡ 8 (mod 6) but 1 *≡ 4 (mod 6) .
Here, cancellation of the common divisor 2 has produced a contradiction.
12
Common divisors on two sides of a congruence can always be cancelled, but
in doing so the modulus has to be adjusted according to the following rule.
In fact the two congruences in Theorem 1.4 are ‘equivalent’ because the
reverse implication also holds. That is,
" n$
if a ≡ b mod then ca ≡ cb (mod n) , where d = gcd(c, n).
d
" n$
To justify this remark, suppose that a ≡ b mod . Then there is an
d
integer k such that
n
a−b=k .
d
Multiplying by c:
kc
ca − cb = n,
d
c
so that ca ≡ cb (mod n), since is an integer.
d
We shall make use of the symbol ↔ to indicate that two congruences are
equivalent. For example, after cancellation of the common divisor 6 in the
following,
12x ≡ 18 (mod 27) ↔ 2x ≡ 3 (mod 9) .
Problem 1.8
Use an appropriate cancellation to simplify each of the following
congruences:
(a) 6x ≡ 18 (mod 30);
(b) 20x ≡ 30 (mod 45);
(c) 52x ≡ 39 (mod 60).
13
Before we leave this area of congruence properties there is one final result
which merits our attention. Euclid’s Lemma for the case of a prime divisor p
showed that if p divides ab, then either p divides a or p divides b. When this
is expressed in congruence notation we have the result which follows. We
shall have numerous occasions to refer to this result so, to ease identification
of the reference, we shall continue to call it Euclid’s Lemma for prime
divisors.
2 DIVISIBILITY TESTS
Given any integer written in our familiar decimal representation, we can tell
at a glance whether or not it is divisible by 2 or 5. To test divisibility by 5,
for example, we simply look to see whether or not the units digit is 0 or 5.
Though not quite so immediate, there are also fairly simple tests for
divisibility by 3, 4, 8, 9 and 11. All these divisibility tests can be derived
from congruence ideas.
Historically, the most significant divisibility test is that for division by 9.
A positive integer is divisible by 9 if, and only if, the sum of its digits is
divisible by 9.
In fact this is a special case of a stronger result which we shall prove shortly.
A positive integer is congruent modulo 9 to the sum of its digits.
For example, if N = 974 064 then
N ≡ 9 + 7 + 4 + 0 + 6 + 4 = 30 ≡ 3 (mod 9) .
This fact led to a method of checking calculations, known as ‘casting out
nines’ which, over the years, has been much used by book-keepers. The
method amounts to reworking the calculations in the residue class
arithmetic Z9 . As an illustration, consider the multiplication shown in
Figure 2.1. On the left the multiplication is carried out fully, whilst on the
right the same calculation is carried out modulo 9.
1489 1 + 4 + 8 + 9 = 22 ≡ 4 (mod 9)
× 753 7 + 5 + 3 = 15 ≡ 6 (mod 9)
1042300 4 × 6 = 24 ≡ 6 (mod 9)
74450
4467
1121217 Check: 1 + 1 + 2 + 1 + 2 + 1 + 7 = 15 ≡ 6 (mod 9)
The fact that the two answers agree modulo 9 is far from being conclusive
proof that the calculation is correct. However, there is a good chance that a
mistake in carrying out the calculation would have shown up during this
check.
14
We shall prove the results giving divisibility tests for 9 and 11 together in
the following theorem.
In the congruences of parts (a) and (b) of Theorem 2.1, and in their proofs,
we have unnecessarily used the digits of N in reverse order, starting at the
units digit a0 . It will be helpful to use formula (b) in this way, starting at
the positive units digit and then alternating the signs. But in using (a) we
shall often, as we did in Figure 2.1 above, add the digits in their naturally
occurring order.
Diversion
987654321 × 9 = 8888888889
987654321 × 18 = 17777777778
987654321 × 27 = 26666666667
987654321 × 36 = 35555555556
987654321 × 45 = 44444444445
987654321 × 54 = 53333333334
987654321 × 63 = 62222222223
987654321 × 72 = 71111111112
987654321 × 81 = 80000000001
Problem 2.1
Let N = 9723 and M = 18 056.
(a) Determine the remainders when each of the numbers N , M , N + M and
N − M are divided by (i) 9 and (ii) 11.
(b) Determine the missing digit (?) in the product
N × M = 9723 × 18 056 = 175 (?)58 488
without using a calculator.
15
Problem 2.2
An integer N has an even number of digits. A second integer M is formed
by moving the last digit of N to the front. (For example, if N = 588 471
the 1 is moved to the front giving M = 158 847.) Show that 9 divides
N − M , 11 divides N + M and 99 divides N 2 − M 2 .
3 LINEAR CONGRUENCES
Theorem 3.1
Let P (x) be an integral polynomial. If a ≡ b (mod n) then
P (a) ≡ P (b) (mod n). In particular, a is a solution of the polynomial
congruence P (x) ≡ 0 (mod n) if, and only if, b is a solution.
16
Proof of Theorem 3.1
Let P (x) = cm xm + cm−1 xm−1 + · · · + c1 x + c0 . Since a ≡ b (mod n),
properties (e) and (f) of Theorem 1.1 tell us that cr ar ≡ cr br (mod n), for
each integer r ≥ 1. Property (d) of Theorem 1.1 then gives
P (a) = cm am + cm−1 am−1 + · · · + c1 a + c0
≡ cm bm + cm−1 bm−1 + · · · + c1 b + c0 ≡ P (b) (mod n) .
In particular, P (a) ≡ 0 (mod n) if, and only if, P (b) ≡ 0 (mod n). That is, a
is a solution of the congruence P (x) ≡ 0 (mod n) if, and only if, b is a
solution.
Here is an example.
Example 3.1
Solve the polynomial congruence x2 − x ≡ 0 (mod 6).
There are six residue classes modulo 6 and each may be a solution of the
congruence. We choose the least positive residues, 0, 1, 2, 3, 4 and 5 and
test each one in turn.
02 − 0 ≡ 0 (mod 6)
12 − 1 ≡ 0 (mod 6)
22 − 2 ≡ 2 (mod 6)
32 − 3 ≡ 0 (mod 6)
42 − 4 ≡ 0 (mod 6)
52 − 5 ≡ 2 (mod 6)
We see that 0, 1, 3 and 4 are solutions of the congruence and therefore so
too is any integer congruent modulo 6 to one of 0, 1, 3 or 4. On the other
hand any integer which is congruent modulo 6 to either 2 or 5 does not
satisfy the congruence. The congruence has four solutions:
x ≡ 0, 1, 3, 4 (mod 6) . "
Problem 3.1
Solve the following polynomial congruences.
(a) P1 (x) = x2 + 3x + 4 ≡ 0 (mod 7)
(b) P2 (x) = x4 − 1 ≡ 0 (mod 5)
17
3.2 Linear congruences
We have quickly found an algorithmic method for solving polynomial This method of solving a problem
congruences, namely, substitute for x, in turn, each value from any complete by checking every possible
set of residues and record the resulting zeros. This is all well and good when candidate is called solution by
exhaustion.
the modulus in question is reasonably small and the degree of the
polynomial is not too large. For more awkward polynomials the amount of
computation involved in this sledgehammer attack quickly renders it
impractical, and we must look around for something more subtle. In Unit 4
we shall return to the problem of solving general polynomial congruences.
There we shall discover ways of simplifying polynomial congruences and we
shall be able to predict how many solutions a polynomial congruence will
have. In Unit 6 we shall be very much concerned with quadratic
congruences and their solutions. For the remainder of this unit we shall
confine our attention to the linear congruence
ax ≡ b (mod n) .
This, the simplest of all polynomial congruences, crops up naturally in a
variety of situations in number theory.
Suppose that x0 is an integer such that ax0 ≡ b (mod n). This means that
n divides ax0 − b or, put another way, there exists an integer y0 such that
ax0 − b = ny0 .
Rearranging, this equation tells us that x = x0 , y = y0 is a solution of the
linear Diophantine equation ax − ny = b. On the other hand if x = x0 ,
y = y0 is any solution of ax − ny = b then it is certainly the case that
ax0 ≡ b (mod n). Thus the problem of finding all integers satisfying the
linear congruence ax ≡ b (mod n) is precisely the same problem as finding
all x-values in solutions of the linear Diophantine equation ax − ny = b. As
we have already solved the latter problem in Theorem 5.1 of Unit 1, our
principal result on linear congruences is little more than a re-expression of
that earlier theorem.
18
(c) If gcd(a, n) = d and d divides b then
a b $ n%
ax ≡ b (mod n) ↔ x ≡ mod .
d d d
$a n%
But gcd , = 1, and so the right-hand congruence has a unique
d d
n
solution modulo , say
d
$ n%
x ≡ x1 mod .
d
Hence the integers x which satisfy ax ≡ b (mod n) are precisely those of
n
the form x = x1 + k , for some integer k.
d
Consider the set of d integers
" n n n#
x1 , x1 + , x1 + 2 , . . . , x1 + (d − 1) .
d d d
Certainly no two of these integers are congruent modulo n because they
are distinct and no two differ by as much as n. We claim further that,
n
for any integer k, x1 + k is congruent modulo n to one of them. To see
d
why that is so, write k = dq + r, where 0 ≤ r < d, as given by the
Division Algorithm. Then
n n n
x1 + k = x1 + (dq + r) = x1 + nq + r
d d d
n
≡ x1 + r (mod n) .
d
So these are the d solutions of ax ≡ b (mod n).
Problem 3.2
How many solutions does each of the following linear congruences have?
(a) 5x ≡ 13 (mod 10)
(b) 5x ≡ 10 (mod 13)
(c) 10x ≡ 5 (mod 30)
(d) 27x ≡ 318 (mod 24)
Diversion
Some squares containing the nine non-zero digits. There are 83 such squares in all.
118262 = 139854276 255722 = 653927184
125432 = 157326849 159632 = 254817369
242372 = 587432169 290342 = 842973156
244412 = 597362481 303842 = 923187456
19
3.3 Solving linear congruences
It is nice to have a theoretical result telling us that solutions exist but it is
more important to be able to find those solutions.
Example 3.2
Solve the linear congruence 30x ≡ 15 (mod 33).
As gcd(30, 33) = 3 and 3 divides 15 Theorem 3.2 guarantees that the
congruence has three solutions modulo 33. Failing all else we know that we
could find these solutions by substituting for x each of the values
0, 1, 2, 3, . . . , 32 and recording which are solutions. But this last resort can
usually be avoided, and can here, as we shall illustrate.
For a start we can use the cancellation laws to reduce the modulus. By the
cancellation rule, Theorem 1.4, the common divisor 3 in both coefficients
and modulus can be cancelled to give the equivalent congruence The congruences are ‘equivalent’ in
the sense that an integer x is a
10x ≡ 5 (mod 11) . solution of one congruence if, and
only if, it is a solution of the other.
As gcd(10, 11) = 1 we know, by Theorem 3.2(b), that this congruence has a
unique solution modulo 11.
Next we can cancel further. By the cancellation rule the common divisor 5
in the coefficients can be cancelled, this time the modulus remaining
unchanged:
2x ≡ 1 (mod 11) .
There are a number of ways of determining the unique solution modulo 11
from here. For example, we could replace the number 1 on the right-hand
side of the congruence by 12, since 1 ≡ 12 (mod 11):
2x ≡ 12 (mod 11) .
Finally cancellation of the common divisor 2 of the coefficients yields the
solution:
x ≡ 6 (mod 11) .
Alternatively we could have multiplied through the congruence
2x ≡ 1 (mod 11) by 6, obtaining
12x ≡ 6 (mod 11) ,
whereupon replacement of the coefficient 12 by the congruent number 1
yields the same solution
x ≡ 6 (mod 11) .
We noted that the original congruence had three solutions modulo 33 and
we have ended with a unique solution modulo 11. There is no contradiction
here, for in the set of least positive residues modulo 33 there are three
numbers, namely 6, 17 and 28, which are congruent to 6 modulo 11.
Consequently the unique solution x ≡ 6 (mod 11) is equivalent to the three
solutions
x ≡ 6, 17, 28 (mod 33) ,
for both determine the same set of integers, namely,
{. . . , −38, −27, −16, −5, 6, 17, 28, 39, 50, . . .}.
So either form can be taken as the answer here. Normally, except when the
context of the problem demands otherwise, we shall always give the
solution(s) in terms of the original modulus. "
20
Linear congruences, like the one we have just tackled, can all be solved using
the following strategy.
Example 3.3
Solve 9x ≡ 15 (mod 26).
As gcd(9, 26) = 1, Step 1 tells us that 9x ≡ 15 (mod 26) has a unique
solution modulo 26, and Step 2 is not applicable.
9x ≡ 15 (mod 26) ↔ 3x ≡ 5 (mod 26) , by Step 3,
↔ 27x ≡ 45 (mod 26) , by Step 5, multiplying by 9,
↔ x ≡ 45 (mod 26) , by Step 4,
↔ x ≡ 19 (mod 26) , by Step 4. "
21
The steps that we followed in this example are certainly not unique. There
are many ways of solving the congruence, but, of course, all must lead to the
same conclusion.
Problem 3.3
Solve the following linear congruences.
(a) 28x ≡ 49 (mod 53)
(b) 34x ≡ 19 (mod 52)
(c) 137x ≡ 96 (mod 19)
(d) 51x ≡ 8 (mod 53)
(e) 18x ≡ 39 (mod 69)
4 SIMULTANEOUS LINEAR
CONGRUENCES
Example 4.1
Find a number which leaves remainders 2, 3 and 2 when divided by 3, 5 and
7 respectively.
In congruence notation the problem is asking for a simultaneous solution of By ‘simultaneous solution’ we
the system mean an x which satisfies all the
congruences.
x ≡ 2 (mod 3) ; x ≡ 3 (mod 5) ; x ≡ 2 (mod 7) .
We can solve this problem as follows. To satisfy the first congruence x must
be of the form 3r + 2. To satisfy the second congruence as well requires
3r + 2 ≡ 3 (mod 5) , i.e. 3r ≡ 1 (mod 5) .
This has the unique solution r ≡ 2 (mod 5), i.e. r = 5s + 2 for some integer
s. Therefore
x = 3r + 2 = 3(5s + 2) + 2 = 15s + 8.
This number has to satisfy the third and final congruence.
15s + 8 ≡ 2 (mod 7) ↔ 1s + 1 ≡ 2 (mod 7)
This has the unique solution s ≡ 1 (mod 7). So s = 7t + 1 for some integer t
and, substituting in the expression for x,
x = 15(7t + 1) + 8 = 105t + 23.
Any integer x of this form satisfies all three congruences. The least positive
solution is 23 (corresponding to t = 0) and the complete solution is
x ≡ 23 (mod 105). "
22
For an integer x to be a simultaneous solution of the system it must be a
solution of each of the r individual congruences, and consequently a
necessary condition for a solution is that
gcd(ai , ni ) divides bi , for each i = 1, 2, . . . , r.
Assuming that this condition holds, a first step in solving the simultaneous
system is to solve each individual congruence, finding its unique solution to
the appropriate modulus. From then on we can confine attention to solving
simultaneous systems of the form
x ≡ b1 (mod n1 ) ; x ≡ b2 (mod n2 ) ; ... ; x ≡ br (mod nr )
as in Sun Tsu’s problem.
The fact that each congruence is solvable is not sufficient on its own for the
simultaneous system to have a solution. For example, consider the following
system.
x ≡ 1 (mod 2) ; x ≡ 2 (mod 4)
No even integer satisfies the first congruence and no odd integer satisfies the
second; hence the simultaneous system has no solutions. Inconsistencies,
such as the one illustrated here, can arise when two linear congruences have
moduli which are not relatively prime. However, if we restrict ourselves to
systems in which every pair of moduli are relatively prime, it turns out that
simultaneous solutions always exist. In honour of their early contributions in
this area, this result is known as the Chinese Remainder Theorem.
23
It remains to show that the discovered solution is unique modulo the
product n1 n2 . . . nr . To this end suppose that x" is a second simultaneous
solution of the system, that is,
x0 ≡ x" ≡ bk (mod nk ) , for each k = 1, 2, . . . , r.
This implies that each nk divides x" − x0 , whereupon the fact that the
moduli are pairwise relatively prime gives us that
n1 n2 . . . nr divides x" − x0 .
This amounts to
x" ≡ x0 (mod n1 n2 . . . nr )
exactly as required.
To illustrate the proof of the Chinese Remainder Theorem we trace its steps
in an example.
Example 4.2
Solve the system of simultaneous linear congruences
x ≡ 5 (mod 6) ; x ≡ 4 (mod 11) ; x ≡ 3 (mod 17) .
The given values of the variables in the proof are:
coefficients: b1 = 5, b2 = 4, b3 = 3;
moduli: n1 = 6, n2 = 11, n3 = 17.
The calculated values are:
N = 6 × 11 × 17 = 1122; N1 = 11 × 17 = 187;
N2 = 6 × 17 = 102; N3 = 6 × 11 = 66.
The values xi are obtained by solving the linear
congruences Ni x ≡ 1 (mod ni ).
N1 x ≡ 1 (mod n1 ) ↔ 187x ≡ 1 (mod 6)
↔ x ≡ 1 (mod 6) ; so x1 = 1.
N2 x ≡ 1 (mod n2 ) ↔ 102x ≡ 1 (mod 11)
↔ 3x ≡ 1 (mod 11)
↔ x ≡ 4 (mod 11) ; so x2 = 4.
N3 x ≡ 1 (mod n3 ) ↔ 66x ≡ 1 (mod 17)
↔ −2x ≡ −16 (mod 17)
↔ x ≡ 8 (mod 17) ; so x3 = 8.
Therefore
x0 = 5 × 187 × 1 + 4 × 102 × 4 + 3 × 66 × 8 = 4151
≡ 785 (mod 1122) . "
Problem 4.1
Find the least positive integer n such that 32 divides 2n + 3, 42 divides
3n + 4 and 52 divides 4n + 5.
24
and the system
Example 4.3
Solve the linear congruence 3x ≡ 5 (mod 1001).
Observing that 1001 = 7 × 11 × 13, we seek the simultaneous solution of
3x ≡ 5 (mod 7) ; 3x ≡ 5 (mod 11) ; 3x ≡ 5 (mod 13) .
That is, (having first solved each of these congruences individually),
x ≡ 4 (mod 7) ; x ≡ 9 (mod 11) ; x ≡ 6 (mod 13) .
The positive integers x which satisfy the congruence x ≡ 6 (mod 13) are
x = 6, 19, 32, 45, 58, 71, 84, 97, . . ..
Now 97 is the first of these integers which is congruent modulo 11 to 9, and
consequently, x ≡ 97 (mod 11 × 13) is the unique solution of the final pair of
congruences of the system. The positive integers in this solution set are
x = 97, 240, 383, 526, 669, . . ..
Now 669 is the first of these which is also congruent modulo 7 to 4, and
hence is the smallest positive integer satisfying all three congruences. Hence
x ≡ 669 (mod 7 × 11 × 13)
is the unique solution of the congruence.
Increase by 13 until a
solution of the second
congruence is found.
Increase by 11 x 13 until
a solution of the third
congruence is found. We use the symbol → as a
shorthand for the word ‘implies’.
Plus any multiple
of 7 x 11 x 13.
25
Problem 4.2
Solve the linear congruence 7x ≡ 9 (mod 165).
There remains one loose end to tidy up. We have seen that when a system
of linear congruences has moduli which are not pairwise relatively prime the
system may be inconsistent and have no solutions. But this is not
necessarily the case. For instance, the system
x ≡ 2 (mod 6) ; x ≡ 5 (mod 9)
involves moduli which are not pairwise relatively prime. However, x = 14
certainly satisfies both congruences, so solutions do exist.
Theorem 4.2
The system of linear congruences
x ≡ b1 (mod n1 ) ; x ≡ b2 (mod n2 )
has a simultaneous solution if, and only if, gcd(n1 , n2 ) divides b2 − b1 .
If a solution exists then it is unique modulo lcm(n1 , n2 ).
26
The result of Theorem 4.2 can be generalized to cover any number of
congruences. A proof using mathematical induction is readily available but
is omitted here as the details are somewhat tedious.
Corollary
The system of linear congruences
x ≡ b1 (mod n1 ) ; x ≡ b2 (mod n2 ) ; ... ; x ≡ br (mod nr )
has a simultaneous solution if, and only if, gcd(ni , nj ) divides bj − bi
for each pair i, j of suffixes. If a solution exists it is unique modulo
lcm(n1 , n2 , . . . , nr ).
Problem 4.3
For each of the following systems of simultaneous linear congruences decide
whether or not it has solutions and if so solve the system.
(a) x ≡ 7 (mod 12) ; x ≡ 11 (mod 18) ; x ≡ 1 (mod 23)
(b) x ≡ 4 (mod 12) ; x ≡ 10 (mod 18) ; x ≡ 3 (mod 7)
ADDITIONAL EXERCISES
Section 1
1 Determine the least positive residue and the least absolute residue of
1997
(a) modulo 7;
(b) modulo 17;
(c) modulo 101.
3 (a) Give an example to show that ak ≡ bk (mod n) need not imply that
a ≡ b (mod n).
(b) Give an example to show that ak ≡ bk (mod n) and k ≡ j (mod n)
both being true does not necessarily imply that aj ≡ bj (mod n) is
true.
27
6 What is the remainder when 1111 is divided by
(a) 7;
(b) 17;
(c) 19.
Section 2
1 Without carrying out the multiplication find the missing digit (?) in
each of the following products.
(a) 108 × 371 = 40 0(?)8
(b) 1578 × 34 971 = 55 18(?) 238
(c) 4473 × 3(?)9 = 1 426 887 Hint : 11 divides 1 426 887.
2 A and B are two different 7-digit numbers each involving all seven of
the digits 1, 2, 3, 4, 5, 6 and 7. Prove that A does not divide B.
3 Let N > M be two 10-digit numbers formed from the same 10 digits
but in different orders. If X is the sum of the digits of N − M , show
that the sum of the digits of X is 9.
4 Show that 2n divides an integer N if, and only if, 2n divides the
number made up of the last n digits of N .
28
Section 3
1 Solve the following linear congruences.
(a) 8x ≡ 12 (mod 60)
(b) 21x ≡ 35 (mod 47)
(c) 6x ≡ 5 (mod 41)
(d) 5x ≡ 1 (mod 93)
Section 4
1 Solve the following system of congruences by following the steps in the
proof of the Chinese Remainder Theorem.
x ≡ 1 (mod 4); x ≡ 3 (mod 5); x ≡ 0 (mod 7) .
29
Challenge Problems
1 Let A = 44444444. If B is the sum of the digits of A, C is the sum of
the digits of B and D is the sum of the digits of C, what is D?
4 Let N be any integer. How can you construct from the digits of N a
number M of at most 3 digits such that N ≡ M (mod 37).
Solution 1.2
Since a ≡ b (mod n), let k be the integer such that a − b = kn.
(a) m divides n means that n = mr for some integer r. Therefore
a − b = kn = k(mr) = (kr)m,
which confirms that a ≡ b (mod m).
(b) Multiplying by m:
ma − mb = mkn = k(mn), confirming ma ≡ mb (mod mn),
= (mk)n, confirming ma ≡ mb (mod n).
(c) Dividing by d:
a b n a b " n% a b n
− = k , which implies that ≡ mod . Note that , and are integers.
d d d d d d d d d
(d) Let gcd(a, n) = d1 and gcd(b, n) = d2 . Since d1 divides a, and d1 divides
n, it follows that d1 divides a − kn; that is d1 divides b. But then d1 is a
common divisor of b and n, and so d1 ≤ d2 .
On the other hand, d2 divides b, and d2 divides n, giving d2 divides
b + kn, that is, d2 divides a. So d2 is a common divisor of a and n, and
so d2 ≤ d1 . Hence the equality d1 = d2 follows.
30
Solutions to the Problems
Solution 1.3
(a) The set of least positive residues modulo 10 is
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}.
The set of least absolute residues modulo 10 is
{−4, −3, −2, −1, 0, 1, 2, 3, 4, 5}.
(b) The set of least positive residues modulo 11 is
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}.
The set of least absolute residues modulo 11 is
{−5, −4, −3, −2, −1, 0, 1, 2, 3, 4, 5}.
Solution 1.4
(a) Replacing each of the numbers by the least positive residue to which it
is congruent modulo 11, (for instance −3 ≡ 8, 22 ≡ 0, etc), we obtain When there is no ambiguity over
which modulus is involved we shall
{6, 2, −3, 22, 23, −7, 7, 9, 43, −8, 16} ≡ {6, 2, 8, 0, 1, 4, 7, 9, 10, 3, 5}. occasionally, as in this solution, use
the ≡ symbol without its
As the latter is the set of least positive residues modulo 11 the former is accompanying (mod n).
a complete set of residues modulo 11.
(b) As 102 = 100 ≡ 1 and 12 ≡ 1 (mod 11) the eleven numbers do not form
a complete set of residues. In fact only six residue classes are
represented in this set, as 92 ≡ 22 , 82 ≡ 32 , 72 ≡ 42 and 62 ≡ 52 .
(c) Starting from 1, each subsequent number is obtained by doubling. To
avoid calculation of high powers of 2 we can write down the least
positive residue for each of the numbers by systematically ‘doubling
modulo 11’. The given eleven numbers are congruent modulo 11, in
order, to the following:
0, 1, 2, 4, 8, 16 ≡ 5, 10, 20 ≡ 9, 18 ≡ 7, 14 ≡ 3 and 6. Each time 11 is exceeded the
number is replaced by the least
As these numbers form the set of least positive residues modulo 11, the positive residue and doubling
given set is a complete set of residues. begins again.
Solution 1.5
In Z10 :
[6] + [8] = [6 + 8] = [14] = [4], since 14 ≡ 4 (mod 10) .
[6] × [8] = [6 × 8] = [48] = [8], since 48 ≡ 8 (mod 10) .
Allowing b to take each of the values 0, 1, 2, . . . , 8 and 9 in turn we find that
the corresponding values of [6] × [b] are [0], [6], [2], [8], [4], [0], [6], [2], [8],
and [4]. So [6] × [b] = [8] has the two solutions [b] = [3] and [b] = [8].
Repeating in Z11 :
[6] + [8] = [14] = [3], since 14 ≡ 3 (mod 11) .
[6] × [8] = [48] = [4], since 48 ≡ 4 (mod 11) .
[6] × [b] = [8] has the unique solution [b] = [5].
31
Solutions to the Problems
Solution 1.6
We first note that if n ≥ 7 then 7 divides n! and so n! ≡ 0 (mod 7).
Therefore we have the simplification:
1! + 2! + 3! + · · · + 1000! ≡ 1! + 2! + 3! + · · · + 6! (mod 7)
(which removes all fear of the problem!) Now, working modulo 7, 1! = 1,
2! = 2, 3! = 6, 4! = 24 ≡ 3, 5! = 5 × 4! ≡ 5 × 3 ≡ 1 and
6! = 6 × 5! ≡ 6 × 1 = 6. And so,
1! + 2! + 3! + · · · + 1000! ≡ 1 + 2 + 6 + 3 + 1 + 6 = 19 ≡ 5 (mod 7) ,
and the remainder on dividing by 7 is 5.
Solution 1.7
a2 − 1 is divisible by 24 precisely when a2 − 1 ≡ 0 (mod 24) or equivalently,
adding 1 to both sides and appealing to Theorem 1.1(d), when
a2 ≡ 1 (mod 24). So our task is to show that any integer, a, which is
divisible neither by 2 nor by 3 must satisfy a2 ≡ 1 (mod 24).
The Division Algorithm tells us that a can be written as
a = 24q + r, where 0 ≤ r ≤ 23.
But, written in this way, a is divisible by 2 when r is even, and is divisible
by 3 when r is divisible by 3. There are just eight values of r which are not
divisible by either 2 or 3, namely r = 1, 5, 7, 11, 13, 17, 19 and 23. For a to
be not divisible by either 2 or 3 it must be congruent modulo 24 to one of
these eight values. Thus we have, replacing each of the last four listed values
by its least absolute residue,
a ≡ ±1, ±5, ±7, ±11 (mod 24) .
Now appealing to Theorem 1.1(f),
a2 ≡ 1, 25, 49 or 121 (mod 24) .
But each of these numbers has remainder 1 when divided by 24, and the
result follows.
Solution 1.8
(a) We wish to cancel the common divisor 6. As gcd(6, 30) = 6, we also
divide the modulus by 6:
6x ≡ 18 (mod 30) ↔ x ≡ 3 (mod 5) .
(b) In order to cancel the common divisor 10, the modulus has to be divided
by gcd(10, 45) = 5. So,
20x ≡ 30 (mod 45) ↔ 2x ≡ 3 (mod 9) .
(c) The common divisor 13 can be cancelled without adjustment to the
modulus, since gcd(13, 60) = 1. So
52x ≡ 39 (mod 60) ↔ 4x ≡ 3 (mod 60) .
Solution 2.1
(a) (i) N ≡ 9 + 7 + 2 + 3 ≡ 3 (mod 9) ;
M ≡ 1 + 8 + 0 + 5 + 6 ≡ 2 (mod 9) ;
N + M ≡ 3 + 2 ≡ 5 (mod 9) ;
N − M ≡ 3 − 2 ≡ 1 (mod 9) .
Hence the required remainders are 3, 2, 5 and 1 respectively.
32
Solutions to the Problems
Solution 2.2
Let N = a2m−1 a2m−2 . . . a2 a1 a0 so that M = a0 a2m−1 a2m−2 . . . a2 a1 . Since
N and M comprise the same 2m digits, the 9-test gives
N ≡ M ≡ a0 + a1 + a2 + · · · + a2m−2 + a2m−1 (mod 9) ,
and so N − M ≡ 0 (mod 9), that is, 9 divides N − M .
Applying the 11-test:
N ≡ a0 − a1 + a2 − · · · + a2m−2 − a2m−1 (mod 11)
whilst
M ≡ a1 − a2 + a3 · · · − a2m−2 + a2m−1 − a0 (mod 11) .
So N + M ≡ 0 (mod 11). That is, 11 divides N + M .
Finally, since N 2 − M 2 = (N − M )(N + M ) we have that 9 divides
N 2 − M 2 and 11 divides N 2 − M 2 . As gcd(9, 11) = 1, the Corollary to
Theorem 1.3 allows us to conclude that 99 divides N 2 − M 2 .
Solution 3.1
(a) We evaluate P1 (x) for each of the least positive residues modulo 7,
namely x = 0, 1, 2, 3, 4, 5 and 6.
02 + 3 × 0 + 4 = 4 ≡ 4 (mod 7)
12 + 3 × 1 + 4 = 8 ≡ 1 (mod 7)
22 + 3 × 2 + 4 = 14 ≡ 0 (mod 7)
32 + 3 × 3 + 4 = 22 ≡ 1 (mod 7)
42 + 3 × 4 + 4 = 32 ≡ 4 (mod 7)
52 + 3 × 5 + 4 = 44 ≡ 2 (mod 7)
62 + 3 × 6 + 4 = 58 ≡ 2 (mod 7)
So P1 (x) ≡ 0 (mod 7) has the one solution x ≡ 2 (mod 7).
(b) We need to evaluate P2 (x) on a complete set of residues. This time we The fact that P (a) = P (−a)
shall choose the least absolute residues modulo 5, namely influences the use of the least
x = −2, −1, 0, 1 and 2. absolute residues for, as you see, it
effectively reduces the number of
P2 (0) = −1 ≡ 4 (mod 5) residues to be checked.
P2 (1) = P2 (−1) = 1 − 1 ≡ 0 (mod 5)
P2 (2) = P2 (−2) = 16 − 1 ≡ 0 (mod 5)
P2 (x) ≡ 0 (mod 5) has the four solutions x ≡ 1, 2, −2 and −1 (mod 5).
That is, alternatively, x ≡ 1, 2, 3 and 4 (modulo 5).
33
Solutions to the Problems
Solution 3.2
(a) Since gcd(5, 10) = 5 and 5 does not divide 13, this congruence has no
solutions.
(b) Since gcd(5, 13) = 1, this congruence has a unique solution.
(c) Since gcd(10, 30) = 10 and 10 does not divide 5, this congruence has no
solutions.
(d) Since gcd(27, 24) = 3 and 3 divides 318, this congruence has three
solutions.
Solution 3.3
(a) The congruence has a unique solution modulo 53.
28x ≡ 49 (mod 53) ↔ 4x ≡ 7 (mod 53) Step 3
↔ 4x ≡ 60 (mod 53) Step 4
↔ x ≡ 15 (mod 53) Step 3
(b) gcd(34, 52) = 2 and 2 does not divide 19 so the congruence has no
solutions.
(c) The congruence has a unique solution modulo 19.
137x ≡ 96 (mod 19) ↔ 4x ≡ 1 (mod 19) Step 4 137 ≡ 4 (mod 19) and
↔ 4x ≡ 20 (mod 19) Step 4 96 ≡ 1 (mod 19).
34
Solution 4.2
As 165 = 3 × 5 × 11 we begin by solving the linear congruence to each of the
moduli 3, 5 and 11.
7x ≡ 9 (mod 3) ↔ x ≡ 0 (mod 3)
7x ≡ 9 (mod 5) ↔ x ≡ 2 (mod 5)
7x ≡ 9 (mod 11) ↔ x ≡ 6 (mod 11)
Our task is now to solve the three congruences on the right-hand side
simultaneously.
x ≡ 6 (mod 11) =⇒ x = 6, 17, . . . ,
increasing in steps of 11 until we reach a solution of the second congruence.
x ≡ 2 (mod 5) =⇒ x = 17, 72, . . . ,
increasing in steps of 11 × 5 = 55 until we reach a solution of the remaining
congruence.
x ≡ 0 (mod 3) =⇒ x ≡ 72 (mod 165) .
Solution 4.3
(a) This system has no solutions since gcd(12, 18) = 6 and 6 does not divide
11 − 7 = 4.
(b) This system has solutions since gcd(12, 18) divides 10 − 4, gcd(7, 12) = 1
(which divides all integers) and gcd(7, 18) = 1.
x ≡ 10 (mod 18) → x = 10, 28, . . . ,
x ≡ 4 (mod 12) → x = 28, 64, 100, 136, . . . ,
increasing in steps of lcm(12, 18) = 36,
x ≡ 3 (mod 7) → x ≡ 136, 388, 640, . . . ,
increasing in steps of 7 × 36 = 252.
The solution x ≡ 136 (mod 252) is unique.
SOLUTIONS TO ADDITIONAL
EXERCISES
Section 1
1 (a) Since 1997 = 7 × 285 + 2,
the least positive residue is 2, and
the least absolute residue is 2.
(b) Since 1997 = 17 × 117 + 8,
the least positive residue is 8, and
the least absolute residue is 8.
(c) Since 1997 = 101 × 19 + 78,
the least positive residue is 78, and
the least absolute residue is 78 − 101 = −23.
35
2 If k ≡ 1 (mod 12) then k = 12r + 1, for some integer r. Hence
6k + 5 = 72r + 11.
(a) As 4 divides 72, we have 6k + 5 ≡ 11 ≡ 3 (mod 4), and so 3 is the
required least positive residue.
(b) As 9 divides 72, we have 6k + 5 ≡ 11 ≡ 2 (mod 9), and so 2 is the
required least positive residue.
(c) As 12 divides 72, we have 6k + 5 ≡ 11 (mod 12), and so 11 is the
required least positive residue.
36
(c) 1111 ≡ (−8)11 ≡ ((−8)2 )5 × (−8) ≡ 75 × (−8) (mod 19)
≡ 72 × 72 × 7 × (−8) ≡ 11 × 11 × (−56) (mod 19)
≡ (−8)2 × 1 ≡ 64 ≡ 7 (mod 19) .
So the remainder is 7.
Section 2
1 (a) As 108 is divisible by 9, the right-hand side must be divisible by 9.
Hence, by adding up the digits, 4 + 0 + 0 + (?) + 8 ≡ 0 (mod 9) and
the only value of the digit (?) which renders this possible is 6.
(b) Checking the calculation modulo 9,
1578 × 34 971 ≡ 3 × 6 ≡ 0 (mod 9) ,
and so the sum of the digits on the right-hand side must be
divisible by 9. Thus
5 + 5 + 1 + 8 + (?) + 2 + 3 + 8 ≡ 32 + (?) ≡ 5 + (?) ≡ 0 (mod 9) ,
giving (?) = 4.
(c) The right-hand side is divisible by 11 and so the left-hand side must
be divisible by 11. Now 4473 is not divisible by 11, and so 3(?)9
must be. Hence (?) = 1 is the only possibility.
37
3 The key here is to note that, as M and N have the same collection of
digits, N ≡ M (mod 9) or, what amounts to the same thing,
N − M ≡ 0 (mod 9). But X is the sum of the digits of N − M and so
X ≡ 0 (mod 9). Now N − M is a number with ten (or fewer) digits and
so X ≤ 90. Of all numbers not exceeding 90, the maximum sum of the
digits is 17 (achieved by the number 89). X cannot be equal to 0 as
that would happen if, and only if, N = M .
Let Y be the sum of the digits of X. Then
Y ≡ X ≡ 0 (mod 9) , where 0 < Y < 18.
Thus the only possibility is Y = 9.
4 Dividing N , by 10n , the Division Algorithm gives integers q and r such For example, to extract the final
that three digits from 1 234 567 we write
1 234 567 = 1234 × 103 + 567.
N = 10n q + r, 0 ≤ r < 10n .
Because of the restriction on r, it follows that r is the number made up
of the last n digits of N .
Now 2n divides 10n and so, taking congruence modulo 2n ,
N ≡ r (mod 2n ) .
Thus N ≡ 0 (mod 2n ) if, and only if, r ≡ 0 (mod 2n ), that is, 2n
divides N if, and only if, 2n divides r, the number made up of the last
n digits of N .
38
Section 3
1 (a) 8x ≡ 12 (mod 60) ↔ 2x ≡ 3 (mod 15)
↔ 2x ≡ 18 (mod 15)
↔ x ≡ 9 (mod 15)
↔ x ≡ 9, 24, 39, 54 (mod 60)
(b) 21x ≡ 35 (mod 47) ↔ 3x ≡ 5 (mod 47)
↔ 3x ≡ −42 (mod 47)
↔ x ≡ −14 ≡ 33 (mod 47)
(c) 6x ≡ 5 (mod 41) ↔ 42x ≡ 35 (mod 41)
↔ x ≡ 35 (mod 41)
(d) 5x ≡ 1 (mod 93) ↔ 95x ≡ 19 (mod 93)
↔ 2x ≡ 112 (mod 93)
↔ x ≡ 56 (mod 93)
39
4 Take the uniqueness first. The congruence ax ≡ b (mod 20) has a
unique solution if, and only if, gcd(a, 20) = 1; that is, when
a = 1, 3, 7, 9, 11, 13, 17 and 19. For each of these eight values of a there
are twenty values of b, making 160 congruences in total for which the
solution is unique.
The congruence has gcd(a, 20) solutions whenever gcd(a, 20) divides b.
So consider the possible values of gcd(a, 20) in turn.
gcd(a, 20) = 1 leads to 160 solvable congruences, as already seen.
gcd(a, 20) = 2 when a = 2, 6, 14 and 18. For each of these four values of
a the congruence is solvable provided b takes one of the ten even values
0, 2, 4, 6, 8, 10, 12, 14, 16 or 18. Hence there are 40 congruences with
solutions.
gcd(a, 20) = 4 when a = 4, 8, 12 and 16. For each of these four values of
a the congruence has solutions when b takes one of the five values 0, 4,
8, 12 or 16 making 20 congruences in all.
gcd(a, 20) = 5 when a = 5 or 15. For each of these two values of a the
congruence has solutions if b takes one of the values 0, 5, 10 or 15
making 8 congruences in all.
gcd(a, 20) = 10 when a = 10. In this case the congruence is solvable
when b = 0 or 10, making 2 congruences in all.
In all there are 230 congruences which have solutions.
Section 4
1 Following the proof of the Chinese Remainder Theorem, the variables
are: n1 = 4, n2 = 5, n3 = 7, N = 4 × 5 × 7 = 140, N1 = 35, N2 = 28,
N3 = 20, b1 = 1, b2 = 3, b3 = 0.
N1 x1 ≡ 1 (mod n1 ) ↔ 35x1 ≡ 1 (mod 4)
↔ 3x1 ≡ 1 (mod 4) , so x1 = 3.
N2 x2 ≡ 1 (mod n2 ) ↔ 28x2 ≡ 1 (mod 5)
↔ 3x2 ≡ 1 (mod 5) , so x2 = 2.
N3 x3 ≡ 1 (mod n3 ) ↔ 20x3 ≡ 1 (mod 7)
↔ −1x3 ≡ 1 (mod 7) , so x3 = 6.
The solution is
x0 ≡ 1 × 35 × 3 + 3 × 28 × 2 + 0 × 20 × 6 ≡ 273 ≡ 133 (mod 140) .
The smallest positive integer solution is 133.
40
(b) As the moduli are not pairwise relatively prime a little more care
must be taken with this one.
x ≡ 1 (mod 4) and x ≡ 3 (mod 6) have a unique simultaneous
solution modulo 12 (the least common multiple of 4 and 6), since
gcd(4, 6) = 2 divides the difference 3 − 1. By inspection this
solution is x ≡ 9 (mod 12).
x ≡ 9 (mod 12) and x ≡ 3 (mod 9) have a unique simultaneous
solution modulo 36 (the least common multiple of 12 and 9), since
gcd(12, 9) = 3 divides the difference 9 − 3.
x ≡ 9 (mod 12) → x = 9, 21, . . . ,
and
x ≡ 3 (mod 9) → x ≡ 21 (mod 36) .
41
5 The arithmetic progression comprises numbers of the form 11k + 7, so
three consecutive terms of the sequence are 11n + 7, 11n + 18 and
11n + 29. Our task is therefore to solve, for n, the system of linear
congruences:
11n + 7 ≡ 0 (mod 2) ; 11n + 18 ≡ 0 (mod 3) ; 11n + 29 ≡ 0 (mod 5) ,
which, after simplification becomes
n ≡ 1 (mod 2) ; n ≡ 0 (mod 3) ; n ≡ 1 (mod 5) .
The first and third of these congruences require that n ≡ 1 (mod 10), so
n = 1, 11, 21, . . . .
The first number in this sequence to satisfy the remaining congruence,
n ≡ 0 (mod 3), is n = 21. The three numbers in the arithmetic
sequence are therefore 238, 249 and 260.
42
INDEX
Z 10
Zn 10 incongruent modulo n 6
≡, *≡ 6 integral polynomial 16
‘equivalent to’ symbol, ↔ 13
‘implies’ symbol, → 32 least absolute residues 9
least positive residues 9
cancellation rule 13 linear congruence 18
casting out nines 14
Chinese Remainder Theorem 23 number of solutions of a polynomial congruence 17
complete set of residues 9
congruence class 9 polynomial congruence 16
congruent modulo n 6 properties of congruence 7
43