Skip to content

Congruences

Definition. For integers a,ba, b and n≥1n \geq 1, aa is congruent to bb modulo nn, written a≡b(modn)a \equiv b \pmod n, if n∣a−bn \mid a - b; equivalently, aa and bb leave the same remainder on division by nn.

Congruence is an equivalence relation: reflexive (a−a=0a - a = 0), symmetric, and transitive (if n∣a−bn \mid a-b and n∣b−cn \mid b-c then n∣a−cn \mid a-c). It partitions Z\mathbb{Z} into nn residue classes [0],[1],…,[n−1][0], [1], \ldots, [n-1], each containing all integers with the same remainder.

Congruences respect addition and multiplication: if a≡ba \equiv b and c≡d(modn)c \equiv d \pmod n, then

a+c≡b+d,a−c≡b−d,ac≡bd(modn).a + c \equiv b + d, \qquad a - c \equiv b - d, \qquad ac \equiv bd \pmod n.

Proof. n∣(a−b)+(c−d)=(a+c)−(b+d)n \mid (a-b) + (c-d) = (a+c)-(b+d) and ac−bd=ac−bc+bc−bd=c(a−b)+b(c−d)ac - bd = ac - bc + bc - bd = c(a-b) + b(c-d). ■\blacksquare

Consequences: powers reduce freely; a≡b(modn)⇒ak≡bka \equiv b \pmod n \Rightarrow a^k \equiv b^k; and polynomials with integer coefficients preserve congruence. This is what makes “reduce as you go” legal in exponent calculations.

Warning (division). Congruence does not respect division in general: from ac≡bc(modn)ac \equiv bc \pmod n you can conclude a≡b(modn/gcd⁡(c,n))a \equiv b \pmod{n/\gcd(c,n)}, and only a≡ba \equiv b when gcd⁡(c,n)=1\gcd(c, n) = 1. For example 6≡0(mod3)6 \equiv 0 \pmod 3 and 3≡0(mod3)3 \equiv 0 \pmod 3, but 2≢02 \not\equiv 0.

3.3 The Ring Z/nZ\mathbb{Z}/n\mathbb{Z}

Section titled “3.3 The Ring Z/nZ\mathbb{Z}/n\mathbb{Z}Z/nZ”

The residue classes form a commutative ring with identity [1][1] under class addition and multiplication. A class [a][a] is invertible (a unit) precisely when gcd⁡(a,n)=1\gcd(a, n) = 1, in which case the extended Euclidean algorithm gives ax+ny=1ax + ny = 1, so ax≡1(modn)ax \equiv 1 \pmod n; the inverse is the class of x mod nx \bmod n. The units form a group of order φ(n)\varphi(n); see Arithmetic Functions.

When n=pn = p is prime, every nonzero class is invertible, so Z/pZ\mathbb{Z}/p\mathbb{Z} is a field.

Any power tower collapses modulo nn by reducing the base modulo nn first, and the exponent via Euler/Fermat when the base is invertible:

  • Last digit of 720267^{2026}: 7k(mod10)7^k \pmod{10} cycles 7,9,3,17, 9, 3, 1 with period 4; since 2026≡2(mod4)2026 \equiv 2 \pmod 4, the answer is 99.
  • 210=1024≡24(mod100)2^{10} = 1024 \equiv 24 \pmod{100}, so the last two digits of 220262^{2026} follow from 2026 mod 20=62026 \bmod 20 = 6: 26=642^6 = 64.

Carmichael’s theorem refines the exponent period to λ(n)\lambda(n), and the order of an element divides λ(n)\lambda(n); worth stating in a proof-based answer.

Problem 1. Show that 24n≡1(mod17)2^{4n} \equiv 1 \pmod{17} whenever nn is even.

24=16≡−1(mod17)2^4 = 16 \equiv -1 \pmod{17}, so 24n≡(−1)n2^{4n} \equiv (-1)^n: the claim holds for even nn, while odd nn gives −1-1. In fact 28=256=15⋅17+1≡1(mod17)2^8 = 256 = 15 \cdot 17 + 1 \equiv 1 \pmod{17}, so the order of 2 modulo 17 is exactly 8.

Problem 2. Find the remainder of 31003^{100} on division by 7.

31≡33^1 \equiv 3, 32≡23^2 \equiv 2, 33≡63^3 \equiv 6, 36≡1(mod7)3^6 \equiv 1 \pmod 7 (the order of 3 is 6). Since 100≡4(mod6)100 \equiv 4 \pmod 6: 3100≡34=81≡4(mod7)3^{100} \equiv 3^4 = 81 \equiv 4 \pmod 7.

Problem 3. Prove that no integer of the form 4k+34k + 3 is a sum of two squares.

Squares mod 4 are 0 and 1, so a sum of two squares is 0,10, 1 or 2(mod4)2 \pmod 4; never 3.

  • Subtracting congruences across different moduli: a≡b(mod6)a \equiv b \pmod 6 and a≡b(mod4)a \equiv b \pmod 4 gives a≡b(modlcm(6,4))=(mod12)a \equiv b \pmod{\mathrm{lcm}(6,4)} = \pmod{12}, not mod 3 or 24.
  • Exponent reduction requires gcd⁡(base,n)=1\gcd(\text{base}, n) = 1 (Euler) or knowledge of the element’s order; otherwise reduce only the base.
  • In Z/nZ\mathbb{Z}/n\mathbb{Z} there are zero divisors when nn is composite: [2]⋅[3]=[0][2]\cdot[3] = [0] in Z/6Z\mathbb{Z}/6\mathbb{Z}; products can vanish without a zero factor.

Residue classes are preserved by polynomial evaluation: if a≡b(modn)a \equiv b \pmod n then f(a)≡f(b)(modn)f(a) \equiv f(b) \pmod n for any integer polynomial ff. Verify for f(x)=x2+x+1f(x) = x^2 + x + 1 with a=2a = 2, b=5b = 5, n=3n = 3 before using it in proofs.

a≡b(modn),c≡d(modn)⟹ac≡bd(modn)a \equiv b \pmod n, \quad c \equiv d \pmod n \Longrightarrow ac \equiv bd \pmod n

The multiplicative property is what powers fast exponentiation: reduce the base once, then multiply reduced residues. In exams, reduce after every multiplication to keep numbers small; the marker expects reduced residues, not 30-digit intermediates.

A standard application: divisibility tests. The rule for 11 follows from 10≡−1(mod11)10 \equiv -1 \pmod{11}, so a decimal number alternately sums its digits. Reproduce this derivation once and the rule is yours forever.

A final check worth one mark: reduce every intermediate result immediately, and state the residue class, e.g. “the answer is the class of 4 modulo 7”, rather than only the integer. For multi-step reductions, tabulate powers as you go: the table of aa, a2a^2, a4a^4, a8a^8 modulo nn converts any exponent to its binary form and avoids every overflow risk.

Reduce 1121(mod13)11^{21} \pmod{13}: Fermat gives 1112≡111^{12} \equiv 1, so 1121≡11911^{21} \equiv 11^9. Now 112=121≡411^2 = 121 \equiv 4, 114≡16≡311^4 \equiv 16 \equiv 3, 118≡911^8 \equiv 9, and 119≡9⋅11=99≡8(mod13)11^9 \equiv 9 \cdot 11 = 99 \equiv 8 \pmod{13}.