Professional Documents
Culture Documents
Chapter3 12
Chapter3 12
Chapter 3:
Congruences and the Chinese Remainder
Theorem
1. Congruence modulo m
(Note: Since 13 ≡ 1 (mod 6), this is also the list of numbers which are con-
gruent to 1 modulo 6; i.e. this is the list of numbers which leave remainder
1 on division by 6.)
1
2
This theorem says that when doing algebra ‘modulo m’, at any stage we
can replace a number a with another (usually smaller) number a0 whenever
a ≡ a0 (mod m).
n=1 22 + 5 = 9 = 3 · 3
n=2 24 + 5 = 21 = 3 · 7
n=3 28 + 5 = 261 = 3 · 87 . . .
After this the numbers grow too fast. However, based on our evidence so far
we might guess that these numbers are always divisible by 3 (and hence are
not prime).
n n
Thus, our guess is 3|22 + 5 for all n ≥ 1. This can be rewritten 22 + 5 ≡ 0
n
(mod 3) or 22 ≡ −5 ≡ 1 (mod 3).
n
So we must prove that 22 ≡ 1 (mod 3) for all n:
n n
But 2 ≡ −1 (mod 3) =⇒ 22 ≡ (−1)2 ≡ 1 (mod 3) for all n (since 2n is
even).
Solution: Note that numbers of the form 3y + 2 are precisely the numbers
which are congruent to 2 modulo 3.
Thus we are required to show that the congruence x2 ≡ 2 (mod 3) has no
solutions.
Now x leaves either remainder 0, 1 or 2 on division by 3. So x ≡ 0, 1 or 2
(mod 3). We consider each of these possibilities in turn:
If x ≡ 0 (mod 3) then x2 ≡ 02 ≡ 0 (mod 3), and so x2 6≡ 2 (mod 3).
If x ≡ 1 (mod 3) then x2 ≡ 1 (mod 3), and so x2 6≡ 2 (mod 3).
If x ≡ 2 (mod 3) then x2 ≡ 22 ≡ 1 (mod 3), and so x2 6≡ 2 (mod 3).
Example 2.8. Show that no number of the form 4t + 3 (t ∈ Z) can be
written as a sum of two squares.
Solution: The numbers of the form 4t + 3 are precisely the numbers con-
gruent to 3 modulo 4. So we are required to prove that the congruence
x2 + y 2 ≡ 3 (mod 4) has no solutions.
Now, for n ∈ Z, n ≡ 0, 1, 2 or 3 (mod 4) and so n2 ≡ 0, 1, 0, 1 (mod 4). So
any square is congruent either to 0 or 1 modulo 4.
Thus x2 , y 2 ≡ 0 or 1 (mod 4) and hence
x2 + y 2 ≡ 0 + 0, 0 + 1, 1 + 0, 1 + 1 (mod 4).
Thus x2 + y 2 ≡ 0, 1 or 2 (mod 4), and hence x2 + y 2 6≡ 3 (mod 4).
Example 2.9. Show that the equation x2 − 2y 2 = 10 has no integer solu-
tions.
Solution: The strategy here is the following. Note that if a, b ∈ Z then
a = b =⇒ a ≡ b (mod m) for any modulus m: To prove that a 6= b it is
enough to find a modulus m for which a 6≡ b (mod m).
Thus we attempt to find a modulus m for which x2 − 2y 2 ≡ 10 (mod m)
has no solutions. There is no golden rule for choosing such a modulus;
in general it may require some experimentation. However, one possibility
worth exploring is the divisors of the numbers of coefficients occurring in
the equation. Since 10 = 2 · 5 it is worth trying m = 2 or m = 5.
If we try m = 2, we obtain the congruence x2 ≡ 0 (mod 2) which has
solutions (take x to be any even number), so this is inconclusive.
If we try m = 5 we get the congruence x2 − 2y 2 ≡ 0 (mod 5). Now if n is
any integer then n ≡ 0, 1, 2, 3 or 4 (mod 5) and hence n2 ≡ 0, 1, 4 ≡ 0, 1, −1
(mod 5).
If 5 6 |x, y then x2 , y 2 ≡ ±1 (mod 5) and x2 − 2y 2 ≡ (±1) − 2(±1) 6≡ 0
(mod 5). This shows there are no solutions to the congruence (and hence
to the original equation) satisfying 5 6 |x, y.
6
So if there is a solution, we must have 5|x or 5|y, and hence 5|x and 5|y
(since 5|10). Modulo 5 we then get 0 ≡ 0 (mod 5), which does not tell us
anything about the solvability of the original equation.
However, observe that if 5|x, y then 52 |x2 , y 2 and hence 25 = 52 |x2 − 2y 2 .
Since 25 6 |10 the equation x2 − 2y 2 = 10 has no solutions in this case either.
3. Decomposing moduli
Proof. =⇒: If mn|a then a = mnt = m(nt) = n(mt) for some integer t,
and thus a is a multiple of m and of n.
⇐=: Since m|a we have a = mb for some integer b. Since n|mb and (n, m) =
1 we have n|b. Thus b = nc for some integer c and hence a = mb = mnc.
Remark 3.2. Of course, the hypothesis (m, n) = 1 is crucial here. For
example 6|60 and 4|60 but 6 · 4 6 |60.
The best that can be said in general is that if m|a and n|a then the least
common multiple of m and n must divide a (see last problem on Homework
2.)
7
We can generalize this useful result to the situation where the modulus is a
product of three or more (relatively prime) factors:
First we need the following observation.
Lemma 3.6. Suppose that m1 , . . . , mt , m are nonzero integers with (m, mi ) =
1 for i = 1, . . . , t. Then (m, m1 · · · mt ) = 1.
If a, b ∈ Z, then
a ≡ b (mod m) ⇐⇒ a ≡ b (mod mi ) for all i = 1, . . . , t.
Proof. =⇒ is clear.
⇐=: We’ll proceed by induction on t ≥ 2.
When t = 2 this is just Corollary 3.3.
Suppose the result is known for t, and that we are given m1 , . . . , mt , mt+1
pairwise relatively prime.
Let m = m1 · · · mt · mt+1 . Since (mt+1 , mi ) = 1 for i = 1, . . . , t it follows
that (mt+1 , m1 · · · mt ) = 1 by Lemma 3.6. Now m = (m1 · · · mt ) · mt+1 and
therefore
a ≡ b (mod m)
⇐⇒ a ≡ b (mod m1 · · · mt ) and a ≡ b (mod mt+1 )(by the case t = 2)
⇐⇒ a ≡ b (mod mi ) for all i ≤ t and a ≡ b (mod mt+1 ) (by ind. hyp.)
⇐⇒ a ≡ b (mod mi ) for all i ≤ t + 1.
Corollary 3.8. Let m > 1 and suppose that m = pa11 · · · pat t is the prime
factorization of m. If a, b ∈ Z we have
a≡b (mod m) ⇐⇒ a ≡ b (mod pai i ) for all i = 1, . . . , t.
Example 3.9. Let n be any integer not divisible by 2, 3 or 5. Prove that
n4 ≡ 1 (mod 30) (i.e. 30|n4 − 1).
Solution: Since 30 = 2 · 3 · 5 we just have to prove that n4 ≡ 1 (mod m)
for m = 2, 3 and 5.
Now n ≡ 1 (mod 2) =⇒ n4 ≡ 1 (mod 2).
Also n ≡ ±1 (mod 3) =⇒ n4 ≡ (±1)4 ≡ 1 (mod 3).
Finally n ≡ ±1, ±2 (mod 5). So n4 ≡ (±1)4 or (±2)4 (mod 5) =⇒ n4 ≡ 1
(mod 5).
Remark 3.10. Lemma 3.7 requires that the moduli are pairwise relatively
prime.
For example, the three numbers 6, 10, 15 satisfy (6, 10, 15) = 1 but no pair
of them is relatively prime.
Not that 31 ≡ 1 (mod 6), 31 ≡ 1 (mod 10) and 31 ≡ 1 (mod 15) but
31 6≡ 1 (mod 6 · 10 · 15).
So the conclusion of Lemma 3.7 does not hold in this case.
9
4. Solving ax ≡ b (mod m)
Solution: First (111, 69) = 3 and 3|9, so the congruence has solutions. We
divide across by 3 to get the simpler congruence 37x ≡ 3 (mod 23) (which
has exactly the same solutions by our arguments above).
By Euclid’s algorithm we find 1 = 37 · 5 + 23 · (−8) and so 3 = 37 · 15 + 23 ·
(−24). Thus s = 15 is a solution of the congruence. The general solution
is
x = 15 + 23k, k ∈ Z
(i.e. the congruence class of 15mod23).
(Caution: The moduli are not pairwise relatively prime here: (110, 135) 6=
1.)
To find b1 , solve 77x ≡ 1 (mod 5); i.e. 2x ≡ 1 (mod 5). So we can take
b1 = 3.
To find b2 , solve 55x ≡ 1 (mod 7); i.e. −x ≡ 1 (mod 7) (since 55 ≡ −1
(mod 7)). So we can take b2 = −1.
To find b3 , solve 35 ≡ 1 (mod 11); i.e. 2x ≡ 1 (mod 11). So we can take
b3 = 6.
Then a solution of our simultaneous congruences is
c = a1 n1 b1 + a2 n2 b2 + a3 n3 b3
= 77 · 3 · 3 + 55 · 5 · (−1) + 35 · 7 · 6
= 693 − 275 + 1470 = 1888.
This is the congruence class of 1888 modulo 385. Since 1888 ≡ 348 (mod 385),
this is the same as
x = 348 + 385t, t ∈ Z
Note that it follows 348 is the smallest positive solution of the simultaneous
congruences; i.e. 348 is the smallest positive number which leaves remainder
3 on division by 5, 5 on division by 7 and 7 on division by 11.
Example 5.5. We’ll solve the thirteenth century Chinese problem above.
The problem is to find the smallest positive integer solution of the simulta-
neous congruences
x ≡ 32 (mod 83), x ≡ 70 (mod 110), x ≡ 30 (mod 135).
We begin by recalling that the moduli in this problem are not pairwise rela-
tively prime – since (110, 135) = 5 – so we cannot yet apply the procedure
of the last example.
First, we have to decompose the moduli. Since 110 = 5 · 22 the second
congruence is equivalent to
x≡0 (mod 5) and x ≡ 4 (mod 22)
and the third congruence is equivalent to
x≡0 (mod 5) and x ≡ 3 (mod 27).
To find b1 , solve 110x ≡ 1 (mod 9); i.e. 2x ≡ 1 (mod 9). We can take
b1 = 5.
14