A First Course in Number Theory
2.2 Linear Congruences
22. Letpbe prime,m≥1, and 0≤k≤p−1. Prove that N =
mp+k p
≡m (modp).
Hint:Consider the integer (p−1)!N modulop.
23. LetGbe the subset ofM2(C) consisting of the four matrices 1 0
0 1
,
0 −1
1 0
,
−1 0 0 −1
,
0 1
−1 0
.
Prove that G is a multiplicative group isomorphic to the additive group of congruence classesZ/4Z.
52 2. Congruences
for some integer z. If d is the greatest common divisor of a and m, then (a/d, m/d) = 1 and a
d
(x−x1) = m
d
z.
By Euclid’s lemma (Theorem 1.7), m/ddividesx1−x, and so x1=x+im
d for some integeri, that is,
x1≡x (mod m d).
Moreover, every integerx1of this form is a solution of (2.1). An integerx1
congruent toxmodulom/d is congruent tox+im/dmodulomfor some integeri= 0,1, . . . d−1, and thedintegersx+im/dwithi= 0,1, . . . , d−1 are pairwise incongruent modulom. Thus, the congruence (2.1) has exactly dpairwise incongruent solutions. This completes the proof.2
Theorem 2.3 Ifpis a prime, then Z/pZis a field.
Proof. If a+pZ ∈ Z/pZ and a+pZ= pZ, thena is an integer not divisible by p. By Theorem 2.2, there exists an integerxsuch that ax≡1 (mod p). This implies that
(a+pZ)(x+pZ) = 1 +pZ,
and so a+pZis invertible. Thus, every nonzero congruence class inZ/pZ is a unit andZ/pZis a field.2
Here are some examples of linear congruences. The congruence 7x≡3 (mod 5)
has a unique solution modulo 5 since (7,5) = 1. The solution is x ≡ 4 (mod 5). The congruence
35x≡ −14 (mod 91) (2.2) is solvable since (35,91) = 7 and
−14≡0 (mod 7).
Congruence (2.2) is equivalent to the congruence
5x≡ −2 (mod 13), (2.3)
which has the unique solution x≡10 (mod 13). Every solution of (2.2) satisfies
x≡10 (mod 13)
and so a complete set of solutions that are pairwise incongruent modulo 91 is{10,23,36,49,62,75,88}.
Lemma 2.1 Letpbe a prime number. Thenx2≡1 (mod p)if and only if x≡ ±1 (mod p).
Proof. Ifx≡ ±1 (modp), thenx2≡1 (modp). Conversely, ifx2≡1 (mod p), thenpdividesx2−1 = (x−1)(x+ 1), and sopmust dividex−1 orx+ 1.2
Theorem 2.4 (Wilson) If pis prime, then (p−1)!≡ −1 (mod p).
Proof. This is true for p = 2 and p = 3, since 1! ≡ −1 (mod 2) and 2! ≡ −1 (mod 3). Let p≥ 5. By Theorem 2.2, to each integer a∈ {1,2, . . . , p−1}there is a unique integer a−1∈ {1,2, . . . , p−1}such that aa−1 ≡1 (modp). By Lemma 2.1, a=a−1 if and only if a= 1 or a= p−1. Therefore, we can partition thep−3 numbers in the set{2,3, . . . , p−2} into (p−3)/2 pairs of integers{ai, a−i 1}such thataia−i1≡1 (mod p) for i= 1, . . . ,(p−3)/2. Then
(p−1)! ≡ 1·2·3· · ·(p−2)(p−1)
≡ (p−1)
(p−3)/2
i=1
aia−i1
≡ p−1
≡ −1 (mod p).
This completes the proof.2
For example,
4!≡24≡ −1 (mod 5) and
6!≡720≡ −1 (mod 7).
The converse of Wilson’s theorem is also true (Exercise 7).
Theorem 2.5 Letmanddbe positive integers such thatddivides m. Ifa is an integer relatively prime tod, then there exists an integera such that a≡a (modd)anda is relatively prime tom.
54 2. Congruences Proof. Letm=k
i=1priiandd=k
i=1psii, whereri ≥1 and 0≤si≤ri
fori= 1, . . . , k. Letm be the product of the prime powers that dividem but notd. Then
m = k
i=1 si=0
prii
and
(m, d) = 1.
By Theorem 2.2, there exists an integer xsuch that dx≡1−a (mod m).
Then
a =a+dx≡1 (mod m) and so
(a, m) = 1.
Also,
a≡a (mod d).
If (a, m)= 1, there exists a primepthat divides botha andm. However, p does not divide m since (a, m) = 1. It follows that p divides d, and so p divides a−dx = a, which is impossible since (a, d) = 1. Therefore, (a, m) = 1.2
Ifa≡b (mod m), thena=b+mxfor some integerx. An integer dis a common divisor ofaandmif and only ifdis a common divisor ofband m, and so (a, m) = (b, m). In particular, ifais relatively prime tom, then every integer in the congruence class of a+mZis relatively prime to m.
A congruence class modulomis calledrelatively prime tomif some (and, consequently, every) integer in the class is relatively prime tom.
We denote byϕ(m) the number of congruence classes inZ/mZthat are relatively prime tom. The functionϕ(m) is called theEuler phi function.
Equivalently, ϕ(m) is the number of integers in the set 0,1,2, . . . , m−1 that are relatively prime to m. The Euler phi function is also called the totient function.
A set of integers{r1, . . . , rϕ(m)}is called areduced set of residuesmodulo m if every integerxsuch that (x, m) = 1 is congruent modulomto some integer ri. For example, the sets {1,2,3,4,5,6} and {2,4,6,8,10,12} are reduced sets of residues modulo 7. The sets{1,3,5,7}and{3,9,15,21}are reduced sets of residues modulo 8.
An integer ais called invertible modulo m or aunit modulo m if there exists an integer xsuch that
ax≡1 (mod m).
By Theorem 2.2,ais invertible modulomif and only ifais relatively prime to m. Moreover, ifa is invertible andax≡1 (modm), then xis unique modulom. The congruence classa+mZis calledinvertibleif there exists a congruence classx+mZsuch that
(a+mZ)(x+mZ) = 1 +mZ.
We denote the inverse of the congruence class a+mZby (a+mZ)−1 = a−1+mZ. The invertible congruence classes are the units in the ringZ/mZ.
We denote the group of units inZ/mZby (Z/mZ)×.
IfR={r1, . . . , rϕ(m)}is a reduced set of residues modulom, then (Z/mZ)×={r+mZ:r∈R}
and (Z/mZ)×=ϕ(m).
For example,
(Z/6Z)×={1 + 6Z,5 + 6Z}
and
(Z/7Z)×={1 + 7Z,2 + 7Z,3 + 7Z,4 + 7Z,5 + 7Z,6 + 7Z}.
If a+mZ is a unit in Z/mZ, then (a, m) = 1 and we can apply the Euclidean algorithm to compute (a+mZ)−1. If we can find integersxand y such that
ax+my= 1, then
(a+mZ)(x+mZ) = 1 +mZ, andx+mZ= (a+mZ)−1.
For example, to find the inverse of 13 + 17Z, we use the Euclidean algo- rithm to obtain
17 = 13·1 + 4, 13 = 4·3 + 1,
4 = 1·4.
This gives
1 = 13−4·3 = 13−(17−13·1)3 = 13·4−17·3, and so
13·4≡1 (mod 17).
Therefore,
(13 + 17Z)−1= 4 + 17Z.
56 2. Congruences
Exercises
1. Find all solutions of the congruence 4x≡9 (mod 11).
2. Find all solutions of the congruence 12x≡3 (mod 45).
3. Find all solutions of the congruence 28x≡35 (mod 42).
4. Find all solutions of the system of congruences 5x+ 7y≡3 (mod 17) 2x+ 3y≡ −2 (mod 17).
5. Find all solutions of the system of congruences 8x+ 5y≡1 (mod 13) 4x+ 3y≡3 (mod 13).
6. Find the inverse of each nonzero congruence class modulo 13.
7. Prove that ifmis composite andm= 4, then (m−1)!≡0 (modm).
This is the converse of Wilson’s theorem.
8. Prove that if p≥5 is an odd prime, then 6(p−4)!≡1 (modp).
9. Let m and a be integers such that m ≥ 1 and (a, m) = 1. Prove that if {r1, . . . , rϕ(m)} is a reduced set of residues modulo m, then {ar1, . . . , arϕ(m)}is also a reduced set of residues modulom.
10. We say that an integerais nilpotent modulomif there exists a pos- itive integerksuch thatak≡0 (mod m). Prove thatais nilpotent modulomif and only ifa≡0 (mod rad(m)).
11. Forn≥1, consider the rational number hn=
n k=1
1 k = un
vn,
whereunandvnare positive integers. Prove that ifpis an odd prime, then the numeratorup−1 ofhp−1 is divisible byp.
Hint:Writehp−1 as a fraction with denominator (p−1)!, and apply Wilson’s theorem.
12. (A criterion for divisibility by 7.) Let n be a positive integer, and letdkdk−1. . . d1d0 be the usual 10-adic representation of n. Define f(n) = dkdk−1. . . d1−2d0. (For example, if n= 203, then d0 = 3, d1= 0,d2= 2, andf(203) = 20−6 = 14.) Prove thatnis divisible by 7 if and only iff(n) is divisible by 7. Use this criterion to determine if 7875 is divisible by 7.
Hint: Prove that 10v+u ≡ 0 (mod 7) if and only if v−2u ≡ 0 (mod 7).
13. Letk≥3. Find all solutions of the congruence x2≡1 (mod 2k).