Residue Classes and Complete Residue Systems

Fix an integer n≥1n \geq 1 and ask a question. How many "fundamentally different" integers are there, modulo nn? Every integer leaves one of exactly nn possible remainders when divided by nn. This simple observation, once made precise, upgrades the arithmetic of congruences. It becomes the arithmetic of a genuine algebraic object. The idea matters because it converts an infinite set — all of Z\mathbb{Z} — into a finite structure, Z/nZ\mathbb{Z}/n\mathbb{Z}. On this structure, addition and multiplication behave exactly as they should. They obey every ring axiom inherited from the integers. This finite ring is where most of elementary number theory actually happens. Fermat's little theorem, Euler's theorem, quadratic reciprocity, and the study of Diophantine equations modulo primes all take place inside Z/nZ\mathbb{Z}/n\mathbb{Z} or its multiplicative substructures. The passage from Z\mathbb{Z} to Z/nZ\mathbb{Z}/n\mathbb{Z} is a first, indispensable example of a quotient construction. This is the same technique that later produces quotient groups, quotient rings, and quotient spaces throughout algebra. The organizing tool for working inside Z/nZ\mathbb{Z}/n\mathbb{Z} is the complete residue system. This is a set of nn integers, one drawn from each congruence class. Such a system is a finite "coordinate chart" on the infinite integers. It lets us replace a statement about all of Z\mathbb{Z} with a finite check over nn representatives. The freedom to choose representatives is itself a recurring and useful trick. These include least nonnegative residues, least absolute residues, or something tailored to a proof. This article gives the precise definitions of congruence classes and Z/nZ\mathbb{Z}/n\mathbb{Z}. It proves that Z/nZ\mathbb{Z}/n\mathbb{Z} is a well-defined commutative ring of order nn. It proves the basic characterization theorem for complete residue systems. It also works through two concrete non-symmetric examples. It closes with the natural next steps: which residues have multiplicative inverses, and the reduced systems that count them via Euler's totient function.

Key takeaways
  • A congruence class [a]n[a]_n is the set of all integers congruent to aa modulo nn; there are exactly nn such classes.
  • These classes form the quotient ring Z/nZ\mathbb{Z}/n\mathbb{Z}, with addition and multiplication well-defined on classes.
  • A complete residue system (CRS) mod nn is any set of nn integers hitting each class exactly once.
  • The standard CRS is {0,1,…,n−1}\{0,1,\dots,n-1\} (least nonnegative residues), but any nn pairwise incongruent integers work.
  • A linear map x↦ax+bx \mapsto ax+b sends a CRS to a CRS precisely when gcd⁡(a,n)=1\gcd(a,n)=1 — the seed of modular inverses.
  • Complete residue systems reduce infinite congruence questions to a finite, checkable list of nn cases.
  • Key idea: modding out by nn turns Z\mathbb{Z} into a finite ring Z/nZ\mathbb{Z}/n\mathbb{Z}, and a complete residue system is exactly one representative chosen from each element of that ring.

Where this lives today

The ring Z/nZ\mathbb{Z}/n\mathbb{Z} and its complete residue systems are the computational backbone of modern cryptography: RSA encryption operates entirely within Z/nZ\mathbb{Z}/n\mathbb{Z} for a large composite nn, and Diffie–Hellman key exchange works inside Z/pZ\mathbb{Z}/p\mathbb{Z} for a large prime pp. Complete residue systems appear whenever an algorithm needs to enumerate "all possible remainders" — for instance, in hash table design, where hashing an object modulo a table size nn implicitly uses a CRS to guarantee every bucket index 0,…,n−10,\dots,n-1 is reachable. In abstract algebra, Z/nZ\mathbb{Z}/n\mathbb{Z} is the first and most important example of a quotient ring, and the constructions here (equivalence classes, well-defined operations on classes) are the prototype for quotient groups, quotient rings, and quotient spaces studied throughout algebra and topology. In combinatorics and analytic number theory, sums and counting arguments over a complete residue system are used to prove results like Fermat's little theorem, Wilson's theorem, and the structure theorems underlying Modular Inverses and the reduced residue system machinery. Physics and engineering use Z/nZ\mathbb{Z}/n\mathbb{Z} implicitly in signal processing (indices modulo the sample length in a discrete Fourier transform) and in error-correcting codes, where arithmetic modulo a fixed nn underlies check-digit and cyclic redundancy schemes. Statistics uses residues modulo small nn in randomized designs and in constructing balanced incomplete block designs. Every one of these applications rests on the fact, proved above, that Z/nZ\mathbb{Z}/n\mathbb{Z} is a bona fide finite commutative ring and that complete residue systems give a faithful finite model of congruence classes.

Ask the tutor: Why does a complete residue system need exactly nn pairwise incongruent elements, and what breaks if that count is off by one?

DefinitionCongruence classes, Z/nZ\mathbb{Z}/n\mathbb{Z}, and complete residue systems

Let nn be a positive integer. Two integers a,ba,b are congruent modulo nn, written a≡b(modn)a \equiv b \pmod n, if n∣(a−b)n \mid (a-b). For a∈Za \in \mathbb{Z}, the residue class (or congruence class) of aa modulo nn is the set

[a]n={ x∈Z:x≡a(modn) }={ a+kn:k∈Z }.[a]_n = \{\, x \in \mathbb{Z} : x \equiv a \pmod n \,\} = \{\, a + kn : k \in \mathbb{Z} \,\}.

The set of all residue classes modulo nn is denoted

Z/nZ={ [0]n,[1]n,…,[n−1]n },\mathbb{Z}/n\mathbb{Z} = \{\, [0]_n, [1]_n, \dots, [n-1]_n \,\},

equipped with the operations

[a]n+[b]n:=[a+b]n,[a]n⋅[b]n:=[ab]n.[a]_n + [b]_n := [a+b]_n, \qquad [a]_n \cdot [b]_n := [ab]_n .

A complete residue system modulo nn (CRS mod nn) is a set {r1,r2,…,rn}\{r_1, r_2, \dots, r_n\} of nn integers such that every integer is congruent modulo nn to exactly one rir_i; equivalently, the classes [r1]n,…,[rn]n[r_1]_n, \dots, [r_n]_n are the nn distinct elements of Z/nZ\mathbb{Z}/n\mathbb{Z}, each occurring once.

Intuition

Think of the integers wrapped around a circle with nn marked positions, like hours on a clock with nn ticks instead of 1212. Every integer, no matter how large or negative, lands on exactly one tick when you walk around the circle by steps of length 11 and wrap at nn. The tick it lands on is its residue class. Two integers are congruent mod nn exactly when they land on the same tick, and there are exactly nn ticks — hence exactly nn residue classes. A complete residue system is simply a choice of one representative integer per tick — a labeling of the clock. The most natural labeling uses 0,1,…,n−10,1,\dots,n-1, but nothing stops us from using −5,1,2,10,23,…-5, 1, 2, 10, 23,\dots as labels, as long as no two labels land on the same tick and every tick gets one. This flexibility is exactly what makes CRS's a useful proof tool: we can pick representatives adapted to the problem (e.g. symmetric ones like −2,−1,0,1,2-2,-1,0,1,2 modulo 55) instead of being stuck with 0,…,n−10,\dots,n-1. The second figure below shows why multiplying every label by a fixed integer aa and shifting by bb can permute the ticks (when gcd⁡(a,n)=1\gcd(a,n)=1) or collapse several distinct ticks onto one (when gcd⁡(a,n)>1\gcd(a,n) > 1) — the geometric heart of the theorem proved below.

Figure
The clock with n=7n=7: integers wrap onto 7 residue classes
0 1 2 3 4 5 6 14 ≡ 0 22 ≡ 1 -5 ≡ 2 17 ≡ 3 -3 ≡ 4 12 ≡ 5 -1 ≡ 6
Figure
Multiplying labels by aa: a permutation when gcd(a,n)=1, a collapse otherwise, n=6
n = 6 residues: 0 1 2 3 4 5 a=5 (gcd(5,6)=1): 0→0 1→5 2→4 3→3 4→2 5→1 → {0,5,4,3,2,1} is again a full CRS mod 6 a=2 (gcd(2,6)=2): 0→0 1→2 2→4 3→0 4→2 5→4 → only {0,2,4} appear — NOT a CRS mod 6
TheoremThe ring Z/nZ\mathbb{Z}/n\mathbb{Z} and the characterization of complete residue systems

Let n≥1n \geq 1 be an integer. Then:

(1) Congruence modulo nn is an equivalence relation on Z\mathbb{Z}, and it has exactly nn equivalence classes, namely [0]n,[1]n,…,[n−1]n[0]_n, [1]_n, \dots, [n-1]_n, which are pairwise disjoint and whose union is Z\mathbb{Z}.

(2) The operations

[a]n+[b]n:=[a+b]n,[a]n⋅[b]n:=[ab]n[a]_n + [b]_n := [a+b]_n, \qquad [a]_n \cdot [b]_n := [ab]_n

are well-defined (independent of the chosen representatives a,ba, b), and (Z/nZ,+,⋅)\big(\mathbb{Z}/n\mathbb{Z}, +, \cdot\big) is a commutative ring with identity [1]n[1]_n and zero [0]n[0]_n, having exactly nn elements.

(3) A set S={r1,…,rm}S = \{r_1, \dots, r_m\} of integers is a complete residue system modulo nn if and only if m=nm = n and ri≢rj(modn)r_i \not\equiv r_j \pmod n for all i≠ji \neq j.

(4) (Linear transport of CRS's) If {r1,…,rn}\{r_1,\dots,r_n\} is a CRS mod nn and a,ba, b are integers with gcd⁡(a,n)=1\gcd(a,n) = 1, then {ar1+b,…,arn+b}\{ar_1 + b, \dots, ar_n + b\} is again a CRS mod nn. Conversely, if gcd⁡(a,n)>1\gcd(a,n) > 1 then {ar1+b,…,arn+b}\{ar_1+b,\dots,ar_n+b\} is not a CRS mod nn.

Proof

We prove each part using the division algorithm, elementary properties of divisibility, and the definitions above. No part of this proof invokes any result depending on it (no circularity).

(1) Equivalence relation with exactly nn classes. Reflexive: a−a=0=n⋅0a - a = 0 = n \cdot 0, so n∣(a−a)n \mid (a-a), i.e. a≡a(modn)a \equiv a \pmod n. Symmetric: if a≡b(modn)a \equiv b \pmod n then n∣(a−b)n \mid (a-b), so a−b=nka - b = nk for some integer kk; then b−a=n(−k)b - a = n(-k), so n∣(b−a)n \mid (b-a), i.e. b≡a(modn)b \equiv a \pmod n. Transitive: if a≡b(modn)a\equiv b\pmod n and b≡c(modn)b \equiv c \pmod n, write a−b=nka-b = nk and b−c=nlb-c=nl for integers k,lk,l. Then a−c=(a−b)+(b−c)=n(k+l)a - c = (a-b)+(b-c) = n(k+l), so n∣(a−c)n \mid (a-c), giving a≡c(modn)a \equiv c \pmod n. Hence ≡(modn)\equiv \pmod n is an equivalence relation, and its equivalence classes are precisely the sets [a]n[a]_n defined above; they partition Z\mathbb{Z} (standard fact about equivalence classes: any two classes are equal or disjoint, and their union is the whole set). To see there are exactly nn distinct classes, invoke the division algorithm: for any integer aa there exist unique integers q,rq, r with a=qn+ra = qn + r and 0≤r<n0 \le r < n. Then a−r=qna - r = qn, so n∣(a−r)n \mid (a-r), giving a≡r(modn)a \equiv r \pmod n and hence [a]n=[r]n[a]_n = [r]_n with r∈{0,1,…,n−1}r \in \{0,1,\dots,n-1\}. Thus every class equals one of [0]n,…,[n−1]n[0]_n,\dots,[n-1]_n, so there are at most nn classes. These nn classes are pairwise distinct: if 0≤i<j≤n−10 \le i < j \le n-1 and [i]n=[j]n[i]_n = [j]_n, then i≡j(modn)i \equiv j \pmod n, so n∣(j−i)n \mid (j - i); but 0<j−i≤n−1<n0 < j - i \le n-1 < n, so nn cannot divide j−ij-i (a nonzero integer of absolute value less than nn has no positive multiple of nn dividing it, since the smallest positive multiple of nn is nn itself). This contradiction shows [i]n≠[j]n[i]_n \ne [j]_n. Hence there are exactly nn distinct classes.

(2) Well-definedness and ring structure. Suppose [a]n=[a′]n[a]_n = [a']_n and [b]n=[b′]n[b]_n = [b']_n, i.e. a≡a′(modn)a \equiv a' \pmod n and b≡b′(modn)b \equiv b' \pmod n. Write a′=a+kna' = a + kn, b′=b+lnb' = b + ln for integers k,lk, l. Then

a′+b′=(a+b)+(k+l)n≡a+b(modn),a' + b' = (a+b) + (k+l)n \equiv a+b \pmod n,

so [a′+b′]n=[a+b]n[a'+b']_n = [a+b]_n; this shows addition of classes does not depend on the representatives chosen, i.e. it is well-defined. For multiplication,

a′b′=(a+kn)(b+ln)=ab+n(al+bk+kln)≡ab(modn),a'b' = (a+kn)(b+ln) = ab + n(al + bk + kln) \equiv ab \pmod n,

so [a′b′]n=[ab]n[a'b']_n = [ab]_n, and multiplication is likewise well-defined. The ring axioms for (Z/nZ,+,⋅)(\mathbb{Z}/n\mathbb{Z}, +, \cdot) now follow directly from the corresponding axioms in Z\mathbb{Z}, applied to representatives, using well-definedness to know the results do not depend on which representatives were used:

  • Associativity of ++ and ⋅\cdot, commutativity of ++ and ⋅\cdot, and the distributive law all hold because, for representatives a,b,ca,b,c,
([a]n+[b]n)+[c]n=[(a+b)+c]n=[a+(b+c)]n=[a]n+([b]n+[c]n),([a]_n+[b]_n)+[c]_n = [(a+b)+c]_n = [a+(b+c)]_n = [a]_n + ([b]_n+[c]_n),

and similarly for the other identities, each reducing to the corresponding true identity in Z\mathbb{Z} inside the bracket.

  • Additive identity: [0]n+[a]n=[0+a]n=[a]n[0]_n + [a]_n = [0+a]_n = [a]_n.
  • Additive inverse: [a]n+[−a]n=[a+(−a)]n=[0]n[a]_n + [-a]_n = [a + (-a)]_n = [0]_n, so −[a]n:=[−a]n-[a]_n := [-a]_n.
  • Multiplicative identity: [1]n⋅[a]n=[1⋅a]n=[a]n[1]_n \cdot [a]_n = [1\cdot a]_n = [a]_n.

Hence Z/nZ\mathbb{Z}/n\mathbb{Z} is a commutative ring with identity. By part (1) it has exactly nn elements, namely [0]n,…,[n−1]n[0]_n,\dots,[n-1]_n.

(3) Characterization of complete residue systems. (⇒\Rightarrow) Suppose S={r1,…,rm}S = \{r_1,\dots,r_m\} is a CRS mod nn, meaning every integer is congruent to exactly one rir_i. In particular each rir_i is congruent to exactly one element of SS (namely itself), so the rir_i are pairwise incongruent mod nn: if ri≡rj(modn)r_i \equiv r_j \pmod n with i≠ji \ne j then rir_i would be congruent to two different elements of SS (rir_i itself and rjr_j), contradicting "exactly one." Also, by part (1) every integer is congruent to exactly one of 0,1,…,n−10, 1, \dots, n-1, hence to exactly one class among the nn classes; the requirement that every integer is congruent to a unique member of SS forces SS to meet every one of the nn classes (existence) and to contain no two elements from the same class (uniqueness, just shown). Since SS meets all nn classes and has at most one element per class, ∣S∣=m=n|S| = m = n exactly. (⇐\Leftarrow) Suppose m=nm = n and the rir_i are pairwise incongruent mod nn. By part (1), each rir_i lies in some class [ri]n[r_i]_n, and these nn classes are pairwise distinct (pairwise incongruence means precisely [ri]n≠[rj]n[r_i]_n \ne [r_j]_n for i≠ji\ne j). Since there are exactly nn classes total (part 1) and we have exhibited nn pairwise distinct ones, {[r1]n,…,[rn]n}\{[r_1]_n,\dots,[r_n]_n\} is the full set of classes {[0]n,…,[n−1]n}\{[0]_n,\dots,[n-1]_n\}. Hence every integer xx, lying in some class, lies in exactly one [ri]n[r_i]_n (classes are disjoint), i.e. x≡ri(modn)x \equiv r_i \pmod n for exactly one ii. This is exactly the definition of a CRS.

(4) Linear transport. Suppose {r1,…,rn}\{r_1,\dots,r_n\} is a CRS mod nn and gcd⁡(a,n)=1\gcd(a,n) = 1. By part (3) it suffices to show the nn integers ari+bar_i + b are pairwise incongruent mod nn. Suppose ari+b≡arj+b(modn)ar_i + b \equiv ar_j + b \pmod n for some i,ji,j. Subtracting bb from both sides (valid since congruence is preserved under adding/subtracting the same integer, an immediate consequence of the definition: if n∣(x−y)n\mid(x-y) then n∣((x+c)−(y+c))n \mid ((x+c)-(y+c))), we get

ari≡arj(modn),i.e.n∣a(ri−rj).ar_i \equiv ar_j \pmod n, \quad\text{i.e.}\quad n \mid a(r_i - r_j).

Since gcd⁡(a,n)=1\gcd(a,n) = 1, Euclid's lemma in the form "n∣acn \mid ac and gcd⁡(a,n)=1\gcd(a,n)=1 implies n∣cn \mid c" (a standard consequence of Bézout's identity: write 1=ax+ny1 = ax + ny for integers x,yx,y, then c=acx+ncyc = acx + ncy, and nn divides both terms on the right since n∣acn \mid ac by hypothesis and n∣ncyn \mid ncy trivially, so n∣cn \mid c) gives

n∣(ri−rj),i.e.ri≡rj(modn).n \mid (r_i - r_j), \quad\text{i.e.}\quad r_i \equiv r_j \pmod n.

Since {r1,…,rn}\{r_1,\dots,r_n\} is a CRS, part (3) says the rir_i are pairwise incongruent, forcing i=ji = j. Hence ar1+b,…,arn+bar_1+b,\dots,ar_n+b are pairwise incongruent mod nn, and there are nn of them, so by part (3) they form a CRS mod nn. For the converse, suppose gcd⁡(a,n)=d>1\gcd(a,n) = d > 1. Consider r1=0r_1 = 0 and choose (using part 3, since {ri}\{r_i\} is a CRS and n/dn/d is an integer with 0≤n/d<n0 \le n/d < n when d>1d>1... more directly) two representatives ri,rjr_i, r_j with ri−rj=n/dr_i - r_j = n/d; such a pair exists among any CRS because n/dn/d is a nonzero residue mod nn (as 0<n/d<n0 < n/d < n since d>1d>1), so it equals ri−rjr_i - r_j for the unique i,ji,j with ri≡(rj+n/d)(modn)r_i \equiv (r_j + n/d) \pmod n, guaranteed to exist and be distinct by part (3) applied to the CRS {r1,…,rn}\{r_1,\ldots,r_n\}. Then

a(ri−rj)=a⋅nd=ad⋅n,a(r_i - r_j) = a \cdot \frac{n}{d} = \frac{a}{d}\cdot n,

and since d∣ad \mid a, a/da/d is an integer, so n∣a(ri−rj)n \mid a(r_i-r_j), i.e. ari≡arj(modn)ar_i \equiv ar_j \pmod n, hence ari+b≡arj+b(modn)ar_i + b \equiv ar_j+b \pmod n with ri≠rjr_i \ne r_j so (by pairwise incongruence of the original CRS, part 3) i≠ji \ne j. Two of the transported values are congruent mod nn, so by part (3) the transported set is not a CRS mod nn (it fails pairwise incongruence, and it still has exactly nn elements as a multiset but at most n−1n-1 distinct residues, hence cannot cover all nn classes). ■\blacksquare

∎

Worked examples

Example 1 — Building and verifying a non-standard CRS mod 9. Let n=9n = 9. Consider the nine integers

S={ −14, 1, 20, −6, 4, 32, −1, 89, 71 }.S = \{\,-14,\ 1,\ 20,\ -6,\ 4,\ 32,\ -1,\ 89,\ 71\,\}.

We check whether SS is a complete residue system mod 99 using Theorem part (3): we need ∣S∣=9|S| = 9 (true by inspection, all listed values are distinct as integers) and pairwise incongruence mod 99. Reduce each to its least nonnegative residue mod 99 via the division algorithm:

  • −14=9(−2)+4⇒−14≡4-14 = 9(-2) + 4 \Rightarrow -14 \equiv 4
  • 1=9(0)+1⇒1≡11 = 9(0) + 1 \Rightarrow 1 \equiv 1
  • 20=9(2)+2⇒20≡220 = 9(2) + 2 \Rightarrow 20 \equiv 2
  • −6=9(−1)+3⇒−6≡3-6 = 9(-1) + 3 \Rightarrow -6 \equiv 3
  • 4=9(0)+4⇒4≡44 = 9(0)+4 \Rightarrow 4 \equiv 4
  • 32=9(3)+5⇒32≡532 = 9(3)+5 \Rightarrow 32 \equiv 5
  • −1=9(−1)+8⇒−1≡8-1 = 9(-1)+8 \Rightarrow -1 \equiv 8
  • 89=9(9)+8⇒89≡889 = 9(9)+8 \Rightarrow 89 \equiv 8
  • 71=9(7)+8⇒71≡871 = 9(7)+8 \Rightarrow 71 \equiv 8

The residues obtained are 4,1,2,3,4,5,8,8,84,1,2,3,4,5,8,8,8. We see −14≡4≡4-14 \equiv 4 \equiv 4 (both −14-14 and 44 reduce to residue 44), and −1,89,71-1, 89, 71 all reduce to residue 88. So SS is not a CRS mod 99: three elements collide on residue 88 and two collide on residue 44, while residues 0,6,70, 6, 7 are never hit. To repair this, replace the colliding elements. Keep one representative per achieved residue and supply fresh representatives for the missing residues 0,6,70, 6, 7. A corrected CRS mod 99 is

S′={−14, 1, 20, −6, 32, −1, 9, 15, 25},S' = \{-14,\ 1,\ 20,\ -6,\ 32,\ -1,\ 9,\ 15,\ 25\},

since 9≡09 \equiv 0, 15≡615 \equiv 6, 25≡725 \equiv 7, and now the nine residues achieved are 4,1,2,3,5,8,0,6,74,1,2,3,5,8,0,6,7 — a permutation of {0,…,8}\{0,\dots,8\}, hence pairwise distinct, hence (Theorem part 3) S′S' is a genuine CRS mod 99. This illustrates the practical content of part (3): checking "CRS-ness" is a finite, mechanical verification — reduce each element mod nn and check the resulting list has no repeats and the right size.

Example 2 — Linear transport with an asymmetric aa, bb, and nn: verifying and using part (4). Let n=11n = 11, and take the CRS {0,1,2,3,4,5,6,7,8,9,10}\{0,1,2,3,4,5,6,7,8,9,10\} (least nonnegative residues). Let a=7a = 7 and b=−20b = -20. Since 1111 is prime and 7≢0(mod11)7 \not\equiv 0 \pmod{11}, gcd⁡(7,11)=1\gcd(7,11)=1, so Theorem part (4) guarantees

T={ 7⋅0−20, 7⋅1−20, 7⋅2−20, …, 7⋅10−20 }T = \{\,7\cdot0-20,\ 7\cdot1-20,\ 7\cdot2-20,\ \dots,\ 7\cdot10-20\,\}

is again a CRS mod 1111. Compute:

T={−20,−13,−6,1,8,15,22,29,36,43,50}.T = \{-20,-13,-6,1,8,15,22,29,36,43,50\}.

Reduce each mod 1111 via division algorithm:

  • −20=11(−2)+2⇒≡2-20 = 11(-2)+2 \Rightarrow \equiv 2
  • −13=11(−2)+9⇒≡9-13 = 11(-2)+9 \Rightarrow \equiv 9
  • −6=11(−1)+5⇒≡5-6 = 11(-1)+5 \Rightarrow \equiv 5
  • 1=11(0)+1⇒≡11 = 11(0)+1 \Rightarrow \equiv 1
  • 8=11(0)+8⇒≡88 = 11(0)+8 \Rightarrow \equiv 8
  • 15=11(1)+4⇒≡415 = 11(1)+4 \Rightarrow \equiv 4
  • 22=11(2)+0⇒≡022 = 11(2)+0 \Rightarrow \equiv 0
  • 29=11(2)+7⇒≡729 = 11(2)+7 \Rightarrow \equiv 7
  • 36=11(3)+3⇒≡336 = 11(3)+3 \Rightarrow \equiv 3
  • 43=11(3)+10⇒≡1043 = 11(3)+10 \Rightarrow \equiv 10
  • 50=11(4)+6⇒≡650 = 11(4)+6 \Rightarrow \equiv 6

The residues obtained, in order, are 2,9,5,1,8,4,0,7,3,10,62,9,5,1,8,4,0,7,3,10,6 — indeed a permutation of {0,1,…,10}\{0,1,\dots,10\} with no repeats, confirming TT is a CRS mod 1111, exactly as guaranteed. Now contrast with a=4a = 4 and n=12n = 12 where gcd⁡(4,12)=4>1\gcd(4,12) = 4 > 1. Take the standard CRS {0,1,…,11}\{0,1,\dots,11\} mod 1212 and b=3b=3. Then

U={3,7,11,15,19,23,27,31,35,39,43,47}.U = \{3,7,11,15,19,23,27,31,35,39,43,47\}.

Reducing mod 1212: 3≡3, 7≡7, 11≡11, 15≡3, 19≡7, 23≡11, 27≡3, 31≡7, 35≡11, 39≡3, 43≡7, 47≡113\equiv3,\ 7\equiv7,\ 11\equiv11,\ 15\equiv3,\ 19\equiv7,\ 23\equiv11,\ 27\equiv3,\ 31\equiv7,\ 35\equiv11,\ 39\equiv3,\ 43\equiv7,\ 47\equiv11. Only the three residues 3,7,113,7,11 ever appear (each four times), so UU misses 99 of the 1212 classes entirely — confirming the converse direction of Theorem part (4): when gcd⁡(a,n)>1\gcd(a,n)>1, transport destroys the CRS property.

CounterexampleDropping gcd⁡(a,n)=1\gcd(a,n)=1 in the linear transport theorem

Theorem part (4) requires gcd⁡(a,n)=1\gcd(a,n) = 1 for x↦ax+bx \mapsto ax+b to send a CRS to a CRS. We exhibit precisely what fails when this hypothesis is dropped, with full arithmetic detail (extending the calculation above). Take n=6n = 6, a=2a = 2 (so gcd⁡(2,6)=2≠1\gcd(2,6) = 2 \ne 1), b=0b = 0, and the standard CRS {0,1,2,3,4,5}\{0,1,2,3,4,5\} mod 66. Applying x↦2xx \mapsto 2x gives

{0,2,4,6,8,10}.\{0, 2, 4, 6, 8, 10\}.

Reducing mod 66: 0≡0, 2≡2, 4≡4, 6≡0, 8≡2, 10≡40\equiv0,\ 2\equiv2,\ 4\equiv4,\ 6\equiv0,\ 8\equiv2,\ 10\equiv4. The resulting residues are 0,2,4,0,2,40,2,4,0,2,4 — only the three even residues {0,2,4}\{0,2,4\} occur, each exactly twice, while the odd residues 1,3,51,3,5 are never hit. By Theorem part (3), a CRS mod 66 must have exactly 66 elements landing on 66 distinct residues; here we have 66 elements landing on only 33 distinct residues, so the image set is not a CRS mod 66. The mechanism is transparent: if r≡r′(mod6/gcd⁡(2,6))=(mod3)r \equiv r' \pmod{6/\gcd(2,6)} = \pmod 3 (e.g. r=0,r′=3r=0, r'=3), then 2r≡2r′(mod6)2r \equiv 2r' \pmod 6, because 2(r−r′)2(r-r') is automatically a multiple of 66 whenever 3∣(r−r′)3 \mid (r - r'). This collapsing is forced by the shared factor d=gcd⁡(a,n)=2d=\gcd(a,n)=2: multiplication by aa can only produce residues lying in the subgroup dZ/nZd\mathbb{Z}/n\mathbb{Z} of Z/nZ\mathbb{Z}/n\mathbb{Z} (here, the even residues), of size n/d=3n/d = 3, never covering all n=6n=6 classes. This is exactly the phenomenon proved in the converse half of Theorem part (4), now seen numerically: the hypothesis gcd⁡(a,n)=1\gcd(a,n)=1 is not a technical nicety but is necessary for the conclusion.

Scope, edge cases & common traps

SituationWhat holdsWhat can fail
n=1n = 1Z/1Z\mathbb{Z}/1\mathbb{Z} has exactly 11 element; every integer is a CRS mod 11 (trivially, since all integers are congruent mod 11)Nothing to distinguish — this is a degenerate but valid edge case
nn primeEvery a≢0a \not\equiv 0 has gcd⁡(a,n)=1\gcd(a,n)=1, so every nonzero multiplier transports a CRS to a CRSPeople sometimes assume this special convenience holds for all nn
nn compositeOnly multipliers coprime to nn preserve CRS-nessForgetting to check gcd⁡(a,n)=1\gcd(a,n)=1 before transporting a CRS
Choosing representativesAny nn pairwise incongruent integers form a valid CRS (least residues, symmetric residues, arbitrary)Assuming {0,…,n−1}\{0,\dots,n-1\} is the only legitimate CRS
Reduced vs. complete systemsA CRS includes 00 and all non-units; a reduced residue system (a later topic) uses only units mod nnConfusing "complete" (size nn) with "reduced" (size φ(n)\varphi(n))

The mathematician behind it

Origins · 1 minCarl Friedrich Gauss and how this was discovered
CF
Carl Friedrich Gauss
1777–1855 · Göttingen, Germany

Gauss introduced the congruence notation a≡b(modn)a \equiv b \pmod n and systematically developed the arithmetic of residue classes in Disquisitiones Arithmeticae (1801), the foundational text of modern number theory. His treatment of complete and reduced residue systems, and his proofs of results like Fermat's little theorem and the law of quadratic reciprocity using this machinery, established congruences as the central organizing language of the subject — the same language in which Z/nZ\mathbb{Z}/n\mathbb{Z} is now phrased as a ring.

History
- 1801: Gauss publishes Disquisitiones Arithmeticae, introducing congruence notation and residue classes systematically.
- 1830s–1840s: The notion of residue classes modulo nn is gradually recognized as an algebraic structure, prefiguring quotient rings.
- 1870s: Dedekind and others formalize the ring-theoretic viewpoint, expressing Z/nZ\mathbb{Z}/n\mathbb{Z} within the emerging language of abstract algebra.
- 1890s–1900s: The general theory of quotient rings (of which Z/nZ\mathbb{Z}/n\mathbb{Z} is the prototype) is developed by Hilbert, Dedekind, and later Noether, situating congruences inside modern commutative algebra.
- 20th century: Z/nZ\mathbb{Z}/n\mathbb{Z} becomes a standard first example in every abstract algebra course and a computational workhorse in cryptography and coding theory.
What exactly is the difference between a congruence and a residue class?

A congruence, a≡b(modn)a \equiv b \pmod n, is a relation between two specific integers: a true-or-false statement asserting n∣(a−b)n \mid (a-b). A residue class [a]n[a]_n is instead a set: the collection of all integers congruent to aa modulo nn. The congruence relation is what lets us group integers into classes in the first place — it is an equivalence relation (reflexive, symmetric, transitive), and the residue classes are precisely its equivalence classes. So congruences are statements about pairs of integers, while residue classes are the sets those statements carve Z\mathbb{Z} into. There are exactly nn residue classes modulo nn, one for each possible remainder 0,1,…,n−10,1,\dots,n-1 under division by nn.

Is Z/nZ\mathbb{Z}/n\mathbb{Z} always a field?

No. Z/nZ\mathbb{Z}/n\mathbb{Z} is always a commutative ring with identity, but it is a field only when nn is prime. If nn is composite, say n=abn = ab with 1<a,b<n1 < a, b < n, then [a]n⋅[b]n=[ab]n=[n]n=[0]n[a]_n \cdot [b]_n = [ab]_n = [n]_n = [0]_n, so [a]n[a]_n and [b]n[b]_n are nonzero zero divisors: neither has a multiplicative inverse, since a ring element with an inverse cannot be a zero divisor. When n=pn = p is prime, every nonzero class [a]p[a]_p satisfies gcd⁡(a,p)=1\gcd(a,p)=1, which (via Bézout's identity) guarantees a multiplicative inverse exists, making Z/pZ\mathbb{Z}/p\mathbb{Z} a field. This distinction is exactly what motivates the study of Modular Inverses.

Does every complete residue system have to contain 0?

No. A CRS is any set of nn pairwise incongruent integers modulo nn; it need not literally contain the integer 00, though it must contain some integer congruent to 00 modulo nn (that is, some multiple of nn). For example, {n,1,2,…,n−1}\{n, 1, 2, \dots, n-1\} is a perfectly valid CRS mod nn that never uses the symbol 00 itself, since n≡0(modn)n \equiv 0 \pmod n. What matters is coverage of every residue class exactly once, not the specific integers chosen as labels.

How does a complete residue system differ from a reduced residue system?

A complete residue system (CRS) mod nn has exactly nn elements, one from every residue class, including classes like [0]n[0]_n that share a common factor with nn. A reduced residue system, by contrast, takes only those classes [a]n[a]_n with gcd⁡(a,n)=1\gcd(a,n) = 1 — the invertible, or "unit," classes — giving exactly φ(n)\varphi(n) elements, where φ\varphi is Euler's totient function. Every reduced residue system is a subset of some complete residue system, obtained by discarding the non-units. This refinement is the subject of Reduced Residue Systems and the Totient Function.

Why does the proof of well-definedness for + and × need the specific computation with kn and ln?

Because addition and multiplication on residue classes are defined via arbitrary representatives, we must confirm the definition does not secretly depend on which representative was picked — otherwise "[a]n+[b]n[a]_n + [b]_n" would not even be a legitimate single object. Writing a′=a+kna' = a+kn and b′=b+lnb'=b+ln captures the most general possible alternative representatives of the same two classes, and the direct computation shows a′+b′≡a+b(modn)a'+b' \equiv a+b \pmod n and a′b′≡ab(modn)a'b' \equiv ab \pmod n regardless of k,lk,l. This is precisely the well-definedness check required whenever operations are defined on equivalence classes via representatives, a pattern that recurs throughout algebra.

Can a complete residue system contain negative integers?

Yes, and this is often useful. The definition only requires nn pairwise incongruent integers; there is no requirement of non-negativity. A common and useful alternative to {0,1,…,n−1}\{0,1,\dots,n-1\} is the system of least absolute residues, such as {−2,−1,0,1,2}\{-2,-1,0,1,2\} for n=5n=5 or {−3,−2,−1,0,1,2,3}\{-3,-2,-1,0,1,2,3\} together with one endpoint choice for even nn. These symmetric systems are often more convenient for estimating sums or bounding quantities in analytic arguments, since the representatives have the smallest possible absolute value.

What goes wrong if we try to define a CRS using n+1 or fewer than n integers?

By Theorem part (3), a CRS mod nn must have exactly nn elements. If you pick n+1n+1 integers, the pigeonhole principle guarantees at least two of them share a residue class (since there are only nn classes to distribute n+1n+1 integers into), so pairwise incongruence fails and the set cannot be a CRS. If you pick fewer than nn integers, even if they are pairwise incongruent, they cannot cover all nn classes, so some residue class is missed and the "every integer is congruent to some element" condition fails. Exactly nn pairwise incongruent integers is both necessary and sufficient.

Before this

Where this leads