A First Course in Number Theory
2.1 The Ring of Congruence Classes
Letmbe a positive integer. Ifaandbare integers such thata−bis divisible bym, then we say thataandb arecongruent modulom, and write
a≡b (modm).
Integersaandbare calledincongruent modulomif they are not congruent modulo m. For example, −12 ≡ 43 (mod 5) and −12 ≡ 43 (mod 11), but −12 ≡43 (mod 7). Every even integer is congruent to 0 modulo 2, and every odd integer is congruent to 1 modulo 2. If xis not divisible by 3, thenx2≡1 (mod 3).
Congruence modulo m is an equivalence relation, since for all integers a, b,andc we have
(i) Reflexivity: a≡a (mod m),
(ii) Symmetry: Ifa≡b (mod m), thenb≡a (modm), and
(iii) Transitivity: If a ≡ b (mod m) and b ≡ c (modm), then a ≡ c (modm).
Properties (i) and (ii) follow immediately from the definition of congruence.
To prove (iii), we observe that if a ≡b (mod m) and b ≡c (modm), then there exist integers xand y such thata−b=mx and b−c =my.
Since
a−c= (a−b) + (b−c) =mx+my=m(x+y),
46 2. Congruences
it follows thata≡c (modm). The equivalence class of an integeraunder this relation is called the congruence class of a modulo m, and written a+mZ. Thus,a+mZis the set of all integersbsuch thatb≡a (modm), that is, the set of all integers of the form a+mx for some integer x. If (a+mZ)∩(b+mZ)=∅, then a+mZ=b+mZ. We denote byZ/mZ the set of all congruence classes modulom.
A congruence class modulomis also called aresidue classmodulom.
By the division algorithm, we can write every integer a in the form a=mq+r, where q and r are integers and 0≤r≤ m−1. Then a≡r (mod m), andris called theleast nonnegative residueofamodulom.
Ifa≡0 (modm) and |a|< m, thena= 0, since 0 is the only integral multiple of m in the open interval (−m, m). This implies that if a ≡ b (mod m) and|a−b|< m, thena=b. In particular, ifr1, r2∈ {0,1, . . . , m−
1} and if a ≡r1 (modm) and a ≡ r2 (mod m), then r1 = r2. Thus, every integer belongs to a unique congruence class of the form r+mZ, where 0≤r≤m−1, and so
Z/mZ={mZ,1 +mZ, . . . ,(m−1) +mZ}.
The integers 0,1, . . . , m−1 are pairwise incongruent modulom.
A set of integers R ={r1, . . . , rm} is called a complete set of residues modulom ifr1, . . . , rm are pairwise incongruent modulo mand every in- teger x is congruent modulo m to some integerri ∈R. For example, the set {0,2,4,6,8,10,12} is a complete set of residues modulo 7. The set {0,3,6,9,12,15,18,21} is a complete set of residues modulo 8. The set {0,1,2, . . . , m−1} is a complete set of residues modulomfor every posi- tive integerm.
There is a natural way to define addition, subtraction, and multiplication of congruence classes. If
a1≡a2 (mod m) and
b1≡b2 (modm), then
a1+b1≡a2+b2 (mod m), a1−b1≡a2−b2 (mod m), and
a1b1≡a2b2 (mod m).
These statements are consequences of the identities
(a1+b1)−(a2+b2) = (a1−a2) + (b1−b2)≡0 (modm), (a1−b1)−(a2−b2) = (a1−a2)−(b1−b2)≡0 (modm)
and
a1b1−a2b2=a1(b1−b2) + (a1−a2)b2≡0 (modm).
Addition, subtraction, and multiplication inZ/mZare well-defined if we define the sum, difference, and product of congruence classes modulomby
(a+mZ) + (b+mZ) = (a+b) +mZ, (a+mZ)−(b+mZ) = (a−b) +mZ, and
(a+mZ)·(b+mZ) =ab+mZ.
Addition of congruence classes is associative and commutative, since ((a+mZ) + (b+mZ)) + (c+mZ)
= ((a+b) +mZ) + (c+mZ)
= ((a+b) +c) +mZ
= (a+ (b+c)) +mZ
= (a+mZ) + ((b+c) +mZ)
= (a+mZ) + ((b+mZ) + (c+mZ)) and
(a+mZ) + (b+mZ) = (a+b) +mZ
= (b+a) +mZ
= (b+mZ) + (a+mZ).
The congruence classmZis a zero element for addition, since mZ+ (a+ mZ) = a+mZ for all a+mZ ∈Z/mZ, and the additive inverse of the congruence classa+mZis−a+mZ, since
(a+mZ) + (−a+mZ) = (a−a) +mZ=mZ.
From these identities we see that the set of congruence classes modulo m is an abelian group under addition.
We have also defined multiplication inZ/mZ. Multiplication is associa- tive and commutative, since
((a+mZ)(b+mZ))(c+mZ) = (ab)c+mZ
= a(bc) +mZ
= (a+mZ)((b+mZ)(c+mZ)) and
(a+mZ)(b+mZ) =ab+mZ=ba+mZ= (b+mZ)(a+mZ).
48 2. Congruences
The congruence class 1 +mZis an identity for multiplication, since (1 +mZ)(a+mZ) =a+mZ
for all a+mZ ∈ Z/mZ. Finally, multiplication of congruence classes is distributive with respect to additionin the sense that
(a+mZ)((b+mZ) + (c+mZ))
= a(b+c) +mZ)
= (ab+mZ) + (ac+mZ)
= (a+mZ)(b+mZ) + (a+mZ)(c+mZ) for alla+mZ, b+mZ, c+mZ∈Z/mZ.
Aringis a setRwith two binary operations, addition and multiplication, such that R is an abelian group under addition with additive identity 0, and multiplication satisfies the following axioms:
(i) Associativity: For all x, y, z∈R,
(xy)z=x(yz).
(ii) Identity element: There exists an element 1 ∈ R such that for all x∈R,
1·x=x·1 =x.
The element 1 is called themultiplicative identityof the ring.
(iii) Distributivity: For allx, y, z∈R,
x(y+z) =xy+xz.
The ringRiscommutativeif multiplication also satisfies the axiom (iv) Commutativity: For all x, y∈R,
xy=yx.
The integers, rational numbers, real numbers, and complex numbers are examples of commutative rings. The set M2(C) of 2×2 matrices with complex coefficients and the usual matrix addition and multiplication is a noncommutative ring.
Let R and S be rings with multiplicative identities 1R and 1S, respec- tively. A map f : R → S is called a ring homomorphism if f(x+y) = f(x) +f(y) andf(xy) =f(x)f(y) for allx, y∈R, andf(1R) = 1S.
An element a in the ring R is called a unit if there exists an element x∈R such thatax=xa= 1. Ifais a unit inRandx∈R andy∈Rare both inverses of a, thenx=x(ay) = (xa)y =y, and so the inverse ofais
unique. We denote the inverse ofabya−1. The setR× of all units inRis a multiplicative group, called thegroup of unitsin the ring R. A fieldis a commutative ring in which every nonzero element is a unit. For example, the rational, real, and complex numbers are fields. The integers form a ring but not a field, and the only units in the ring of integers are±1.
The various properties of sums and products of congruence classes that we proved in this section are equivalent to the following statement.
Theorem 2.1 For every integer m ≥ 2, the set Z/mZ of congruence classes modulo mis a commutative ring.
Exercises
1. Compute the least nonnegative residue of 10k+ 1 modulo 13 fork= 1,2,3,4.
2. Compute the least nonnegative residue of 522 modulo 23.
3. Construct the multiplication table for the ring Z/5Z.
4. Construct the multiplication table for the ring Z/6Z.
5. Prove that every integer is congruent modulo 9 to one of the even integers 0,2,4,6, . . . ,16.
6. Letmbe an odd positive integer. Prove that every integer is congru- ent modulom to one of the even integers 0,2,4,6, . . . ,2m−2.
7. Prove that every integer is congruent modulo 9 to a unique integerr such that−4≤r≤4.
8. Let m= 2q+ 1 be an odd positive integer. Prove that every integer is congruent modulom to a unique integerrsuch that −q≤r≤q.
9. Let m= 2q be an even positive integer. Prove that every integer is congruent modulomto a unique integerrsuch that−(q−1)≤r≤q.
10. Prove thata3≡a (mod 6) for every integera.
11. Prove thata4≡1 (mod 5) for every integera that is not divisible by 5.
12. Prove that ifais an odd integer, thena2≡1 (mod 8).
13. Let dbe a positive integer that is a common divisor of a, b,and m.
Prove that
a≡b (mod m) if and only if
a d ≡ b
d (mod m d).
50 2. Congruences
14. Prove that ifx, y, zare integers such thatx2+y2=z2, thenxyz≡0 (mod 60).
15. Prove that a1 ≡ a2 (mod m) implies ak1 ≡ ak2 (mod m) for all k≥1. Prove that iff(x) is a polynomial with integer coefficients and a1≡a2 (modm), thenf(a1)≡f(a2) (mod m).
16. (A criterion for divisibility by 9.) Prove that a positive integer nis divisible by 9 if and only if the sum of its decimal digits is divisible by 9. (For example, the sum of the decimal digits of 567 is 5+6+7 = 18.) Hint:Prove that 10k≡1 (mod 9) for every nonnegative integerk.
17. (A criterion for divisibility by 11.) Prove that a positive integernis divisible by 11 if and only if the alternating sum of its decimal digits is divisible by 11. (For example, the alternating sum of the decimal digits of 80,729 is−9 + 2−7 + 0−8 =−22.)
Hint:Prove that 10k≡(−1)k (mod 11) for every nonnegative inte- gerk.
18. Prove that if x1, . . . , xm is a sequence of m not necessarily distinct integers, then there is a subsequence of consecutive terms whose sum is divisible bym, that is, there exist integers 1 ≤k ≤ ≤ m such that
i=k
xi≡0 (modm).
Hint:Consider them+ 1 integers 0, x1, x1+x2, x1+x2+x3, . . . , x1+ x2+· · ·+xm.
19. Let m ≥2 and let d be a positive divisor of m−1. Letn = a0+ a1m+· · ·+akmkbe them-adic representation ofn.Prove thatn≡0 (modd) if and only ifa0+a1+· · ·+ak ≡0 (modd).
20. Let nbe a positive integer such thatn≡3 (mod 4). Prove thatn cannot be written as the sum of two squares.
21. Prove that every integer belongs to at least one of the following 6 congruence classes:
0 (mod 2) 0 (mod 3) 1 (mod 4) 3 (mod 8) 7 (mod 12) 23 (mod 24).
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.