A First Course in Number Theory
2.4 Chinese Remainder Theorem
6. Prove thatmis prime if and only ifϕ(m) =m−1.
7. Prove thatϕ(m) =ϕ(2m) if and only ifmis odd.
8. Prove that if mdividesn, thenϕ(m) dividesϕ(n).
9. Find all positive integersnsuch thatϕ(n) is not divisible by 4.
10. Find all positive integersnsuch thatϕ(5n) = 5ϕ(n).
11. Letf(n) =ϕ(n)/n. Prove thatϕ(pk) =ϕ(p) for all primespand all positive integersk.
12. This problem gives an alternative proof of Theorem 2.8. Letm≥1, and letS be the set of fractionsk/mwithk= 0,1, . . . , m−1. Write each fraction in lowest terms:k/m=a/d, wheredis a divisor ofm and (a, d) = 1. For example, 0/m= 0/1. Show that for each divisord ofmthere are exactlyϕ(d) fractionsk/m∈Sthat have denominator dwhen reduced to lowest terms. Deduce that
d|mϕ(d) =m.
13. Let Nm(x) denote the number of positive integers not exceeding x that are relatively prime tom. Prove that
x→∞lim Nm(x)
x = ϕ(m) m .
This result can be expressed as follows: The probability that a random integer is prime tomisϕ(m)/m.
62 2. Congruences
Proof. Ifxis a solution of congruence (2.5), thenx=a+mufor some integer u. Ifxis also a solution of congruence (2.6), then
x=a+mu≡b (modn), that is,
a+mu=b+nv for some integerv. It follows that
a−b=nv−mu≡0 (mod (m, n)).
Conversely, ifa−b≡0 (mod (m, n)), then by Theorem 1.15 there exist integersuandv such that
a−b=nv−mu.
Then
x=a+mu=b+nv is a solution of the two congruences.
An integery is another solution of the congruences if and only if y≡a≡x (modm)
and
y≡b≡x (modn),
that is, if and only ifx−yis a common multiple ofmandn, or, equivalently, x−y is divisible by the least common multiple [m, n]. This completes the proof.2
For example, the system of congruences x ≡ 5 (mod 21), x ≡ 19 (mod 56), has a solution, since
(56,21) = 7 and
19≡5 (mod 7).
The integerxis a solution if there exists an integerusuch that x= 5 + 21u≡19 (mod 56),
that is,
21u≡14 (mod 56),
3u≡2 (mod 8), or
u≡6 (mod 8).
Then
x= 5 + 21u= 5 + 21(6 + 8v) = 131 + 168v
is a solution of the system of congruences for any integerv, and so the set of all solutions is the congruence class 131 + 168Z.
Theorem 2.10 (Chinese remainder theorem) Letk≥2. Ifa1, . . . , ak
are integers andm1, . . . , mk are pairwise relatively prime positive integers, then there exists an integerxsuch that
x≡ai (mod mi) for alli= 1, . . . , k.
If xis any solution of this set of congruences, then the integer y is also a solution if and only if
x≡y (modm1· · ·mk).
Proof. We prove the theorem by induction onk. Ifk= 2, then [m1, m2] = m1m2, and this is a special case of Theorem 2.9.
Letk≥3, and assume that the statement is true fork−1 congruences.
Then there exists an integerzsuch thatz≡ai (mod mi) fori= 1, . . . , k− 1. Sincem1, . . . , mk are pairwise relatively prime integers, we have
(m1· · ·mk−1, mk) = 1,
and so, by the casek= 2, there exists an integerxsuch that x ≡ z (modm1· · ·mk−1),
x ≡ ak (mod mk).
Then
x≡z≡ai (modmi) fori= 1, . . . , k−1.
If y is another solution of the system of k congruences, then x−y is divisible bymi for alli= 1, . . . , k. Sincem1, . . . , mk are pairwise relatively prime, it follows that x−y is divisible by m1· · ·mk. This completes the proof.2
For example, the system of congruences x ≡ 2 (mod 3), x ≡ 3 (mod 5), x ≡ 5 (mod 7), x ≡ 7 (mod 11)
64 2. Congruences
has a solution, since the moduli are pairwise relatively prime. The solution to the first two congruences is the congruence class
x≡8 (mod 15).
The solution to the first three congruences is the congruence class x≡68 (mod 105).
The solution to the four congruences is the congruence class x≡1118 (mod 1155).
There is an important application of the Chinese remainder theorem to the problem of solving diophantine equations of the form
f(x1, . . . , xk)≡0 (modm),
wheref(x1, . . . , xk) is a polynomial with integer coefficients in one or sev- eral variables. This equation is solvable modulo m if there exist integers a1, . . . , ak such that
f(a1, . . . , ak)≡0 (modm).
The Chinese remainder theorem allows us to reduce the question of the solvability of this congruence modulomto the special case of prime power modulipr. For simplicity, we consider polynomials in only one variable.
Theorem 2.11 Let
m=pr11· · ·prkk
be the standard factorization of the positive integerm. Letf(x)be a poly- nomial with integral coefficients. The congruence
f(x)≡0 (modm) is solvable if and only if the congruences
f(x)≡0 (mod prii) are solvable for all i= 1, . . . , k.
Proof. Iff(x)≡0 (modm) has a solution in integers, then there exists an integer asuch thatm dividesf(a). Sinceprii dividesm, it follows that prii dividesf(a), and so the congruencesf(x)≡0 (mod prii) are solvable fori= 1, . . . , k.
Conversely, suppose that the congruencesf(x)≡0 (modprii) are solv- able for i= 1, . . . , k. Then for eachithere exists an integerai such that
f(ai)≡0 (mod prii).
Since the prime powerspr11, . . . , prkk are pairwise relatively prime, the Chi- nese remainder theorem tells us that there exists an integerasuch that
a≡ai (mod prii) for alli. Then
f(a)≡f(ai)≡0 (mod prii)
for all i. Sincef(a) is divisible by each of the prime powersprii, it is also divisible by their product m, and sof(a)≡0 (modm). This completes the proof.2
For example, consider the congruence
f(x) =x2−34≡0 (mod 495).
Since 495 = 32·5·11, it suffices to solve the congruences f(x) =x2−34≡x2+ 2≡0 (mod 9), f(x) =x2−34≡x2+ 1≡0 (mod 5), and
f(x) =x2−34≡x2−1≡0 (mod 11).
These congruences have solutions
f(5)≡0 (mod 9), f(2)≡0 (mod 5), and
f(1)≡0 (mod 11).
By the Chinese remainder theorem, there exists an integerasuch that a ≡ 5 (mod 9),
a ≡ 2 (mod 5), a ≡ 1 (mod 11).
Solving these congruences, we obtain
a≡122 (mod 495).
We can check that
f(122) = 1222−34 = 14,850 = 30·495, and so
f(122)≡0 (mod 495).
66 2. Congruences
Exercises
1. Find all solutions of the system of congruences x ≡ 4 (mod 5), x ≡ 5 (mod 6).
2. Find all solutions of the system of congruences x ≡ 5 (mod 12), x ≡ 8 (mod 9).
3. Find all solutions of the system of congruences x ≡5 (mod 12), x ≡8 (mod 10).
4. Find all solutions of the system of congruences 2x ≡1 (mod 5), 3x ≡4 (mod 7).
5. Find all integers that have a remainder of 1 when divided by 3, 5, and 7.
6. Find all integers that have a remainder of 2 when divided by 4 and that have a remainder of 3 when divided by 5.
7. Find all solutions of the congruence
f(x) = 5x3−93≡0 (mod 231).
8. (Bhaskara, sixth century) A basket contains n eggs. If the eggs are removed 2,3,4,5,or 6 at a time, then the number of eggs that remain in the basket is 1,2,3,4, or 5, respectively. If the eggs are removed 7 at a time, then no eggs remain. What is the smallest numbernof eggs that could have been in the basket at the start of this procedure?
Hint:The first condition implies thatn≡1 (mod 2).
9. Letf be a polynomial with integer coefficients. Form≥1, letNf(m) denote the number of pairwise incongruent solutions of f(x) ≡ 0 (modm). Prove that the function Nf(m) is multiplicative, that is, Nf(m1m2) =Nf(m1)Nf(m2) if (m1, m2) = 1.
10. Letm1, . . . , mkbe pairwise relatively prime positive integers andm= m1· · ·mk. Define the map
f : (Z/mZ)×→(Z/m1Z)×× · · · ×(Z/mkZ)× by
f(a+mZ) = (a+m1Z, . . . , a+mkZ).
Use the Chinese remainder theorem to show directly that this map is one-to-one and onto.