MATH 308 — Lec 15 — Congruence mod n; Z_n
Math 308 · November 6, 2026
Lecture 15 — Congruence Modulo n and the Integers mod n
MATH 308 Bridge to Advanced Mathematics Chartrand §9.5–9.6
Goals for today. By the end of this lecture you should be able to:
-
name the n residue classes [0],[1],…,[n−1] and describe the set Zn of integers modulo n;
-
explain why the rules [a]+[b]=[a+b] and [a]⋅[b]=[ab] are well-defined — independent of representatives — and prove it;
-
build and read the addition and multiplication tables of Zn for small n;
-
recognize Zn as your first ring, and spot it on a clock, a calendar, a parity bit, and a check digit.
Residue classes and the set Zn (§9.5)
Fix an integer n≥2. In Lecture 14 we proved that congruence modulo n,
a≡b(modn)⇔n∣(a−b),is an equivalence relation on Z (recall n∣m from Lecture 7 means m=nk for some k∈Z). Its equivalence classes are called residue classes, and today they become objects we can compute with.
Definition 1. For a∈Z, the residue class (or congruence class) of a modulo n is
[a]={x∈Z:x≡a(modn)}={a+nk:k∈Z}.Any b∈[a] is a representative of the class; by Lecture 14, [a]=[b]⇔a≡b(modn).
By the Division Algorithm, every integer leaves exactly one remainder r∈{0,1,…,n−1} on division by n, and [a]=[r] for that r. So there are exactly n distinct classes, one per remainder.
Definition 2. The integers modulo n is the set of all residue classes,
Zn={[0],[1],[2],…,[n−1]},∣Zn∣=n.(This is the set Z/≡ of Lecture 14, also written Z/nZ.)
Example 1. For n=4 there are four classes, each an arithmetic progression of step 4:
[0]={…,−4,0,4,8,…}, [1]={…,−3,1,5,9,…}, [2]={…,−2,2,6,10,…}, [3]={…,−1,3,7,11,…}.So Z4={[0],[1],[2],[3]}. Note [4]=[0], [5]=[1], and [−1]=[3]: many labels, four classes. As in Lecture 2, the four classes partition Z — they cover it and are pairwise disjoint.
The passage a↦[a] folds the whole number line onto n points: it is a function Z→Zn, the reduction mod n map (we make “function” precise in Lecture 16). Figure [fig:fold] shows the fold for n=4.
Reduction mod 4 folds Z onto four classes. Each integer is routed to its residue class; different representatives (e.g. 1, 5, −3) land in the same box [1]. This is exactly why arithmetic on the boxes will be well-defined.
Adding and multiplying classes: well-definedness (§9.6)
We would like to add and multiply classes, not just integers. The natural rule is to add representatives:
[a]+[b]=?[a+b],[a]⋅[b]=?[ab].There is a genuine worry hiding in the question marks. A class has many names — [1]=[5] in Z4 — so the recipe “pick a representative, add, take the class” might give different answers for different choices. If it did, the operation would be nonsense. We must check the answer depends only on the classes, not on the representatives chosen. This is the notion of a well-defined operation, and it is exactly what Lecture 7 set us up to prove.
Theorem 1 (Addition and multiplication on Zn are well-defined). *Let n≥2. Suppose [a]=[a′] and [b]=[b′] in Zn. Then
[a+b]=[a′+b′]and[ab]=[a′b′].Consequently the rules [a]+[b]:=[a+b] and [a]⋅[b]:=[ab] define operations on Zn that do not depend on the chosen representatives.*
Proof. By Lecture 14, [a]=[a′] means a≡a′(modn), and [b]=[b′] means b≡b′(modn). By the theorem of Lecture 7 (congruence is preserved by + and ×),
a+b≡a′+b′(modn)andab≡a′b′(modn).Translating back to classes (again x≡y⇔[x]=[y]) gives [a+b]=[a′+b′] and [ab]=[a′b′], as claimed. ◻
Remark 1. This is the payoff of the humble computation in Lecture 7. “Congruence respects + and ×” looked like a convenience for finding remainders; here it is precisely the fact that lets a whole new number system exist. Well-definedness is the recurring question behind every quotient construction we will meet.
Example 2 (Reducing before you compute). In Z4, compute [2]+[3] and [3]⋅[3]. Add/multiply representatives, then reduce:
[2]+[3]=[5]=[1],[3]⋅[3]=[9]=[1].By Theorem 1 we may also replace [3] by its friendlier name [−1] first: [3]⋅[3]=[−1]⋅[−1]=[1] — same answer, less arithmetic.
Because the operations are well-defined, we can tabulate them once and for all. Figure [fig:cayley] is the addition table of Z5; entry in row [i], column [j] is [i+j], i.e. (i+j)mod5.
The addition table (a Cayley table) of Z5: cell (i,j) holds (i+j)mod5. The diagonal color-bands are the residue classes wrapping around — add 1 and every entry steps to the next shade, looping from [4] back to [0].
Zn as a number system
The operations satisfy the same structural laws as ordinary integer arithmetic, inherited class-by-class from Z.
Proposition 2 (Identities and additive inverses). *In Zn, for every class [a]:
[a]+[0]=[a],[a]⋅[1]=[a],[a]+[n−a]=[0].Moreover addition and multiplication are commutative and associative, and multiplication distributes over addition.*
Proof. The first two are immediate: [a]+[0]=[a+0]=[a] and [a]⋅[1]=[a⋅1]=[a] by the definitions of the operations. For the additive inverse, [a]+[n−a]=[a+(n−a)]=[n]=[0], since n≡0(modn). The remaining laws transfer directly from Z: for commutativity of addition, [a]+[b]=[a+b]=[b+a]=[b]+[a], using a+b=b+a in Z; associativity and distributivity are identical, each following from the corresponding law for integers applied to representatives. ◻
A set with a well-behaved addition and multiplication obeying exactly these laws — two identities, additive inverses, commutativity, associativity, distributivity — is called a commutative ring. Proposition 2 says Zn is one; it is the first ring in this course other than Z itself.
Example 3 (Multiplication in Z4 vs. Z5: a surprise). The multiplication tables (entry = productmodn) reveal that Zn can behave unlike Z:
⋅[0][1][2][3][0]0000[1]0123[2]0202[3]0321⋅[0][1][2][3][4][0]00000[1]01234[2]02413[3]03142[4]04321In Z4, [2]⋅[2]=[0]: two nonzero classes multiply to zero. Such an [a]=[0] is called a zero divisor — impossible in Z, where ab=0 forces a=0 or b=0. In Z5, by contrast, every nonzero row is a permutation of [1],…,[4]: each nonzero class has a multiplicative inverse (e.g. [2]⋅[3]=[6]=[1], so [2]−1=[3]). That happens exactly when n is prime, and makes Zp a field — a number system where you can also divide. We will not prove that here, but the tables already let you see it.
Finally, the “wheel” picture from Lecture 7 is now literally the diagram of (Zn,+): adding [1] rotates the wheel one notch, and after n steps you return to [0].
(Z6,+) as a 6-point wheel: adding [1] steps one node clockwise. Reading [5]+[3]: start at [5], step 3 notches →[2], matching [5+3]=[8]=[2].
Homework problems
-
List the elements (five each) of the three classes of Z3, and confirm they partition Z.
-
In Z7 compute [4]+[5], [3]⋅[6], and [6]⋅[6], reducing each to a representative in {0,…,6}.
-
Build the full addition table of Z4. Circle the additive inverse of each class.
-
Well-definedness in action. Verify [2]⋅[3]=[7]⋅[8] in Z5 by computing both sides. Which theorem guarantees they must agree?
-
Find every zero divisor in Z6 (classes [a]=[0] with [a][b]=[0] for some [b]=[0]). Which classes have a multiplicative inverse instead?
-
Using Z9 and the fact that 10≡1(mod9), prove the “casting out nines” rule: an integer is ≡ (the sum of its base-10 digits) (mod9). (Hint: dk10k≡dk(mod9).)
Suggested textbook exercises (Chartrand §9.5–9.6): 9.36, 9.38, 9.40, 9.44, 9.48, 9.52.