1 The Group of Units
For a positive integer n, the set of residue classes aˉ∈Z/nZ with gcd(a,n)=1 is denoted (Z/nZ)∗. Under multiplication it forms a group, called the group of units (or the group of reduced residue classes).
Closure: If gcd(a,n)=1 and gcd(b,n)=1, then gcd(ab,n)=1. (Indeed, if a prime p divided both n and ab, then p∣a or p∣b, contradicting coprimality.) Associativity: inherited from integer multiplication. Identity:1ˉ. Inverses: Since gcd(a,n)=1, Béax+ny=1, i.e. ax≡1(modn), so xˉ is the inverse of aˉ. □
2 Euler's Totient Function
For a positive integer n, φ(n)=∣(Z/nZ)∗∣, the number of integers k with 1≤k≤n and gcd(k,n)=1, is called Euler's totient function.
If n=p1e1p2e2⋯pkek, then φ(n)=np∣n∏(1−p1)=i=1∏kpiei−1(pi−1).
We first show φ(pe)=pe−pe−1=pe−1(p−1). Among the integers 1,2,…,pe, the multiples of p are p,2p,…,pe−1⋅p, numbering pe−1 in total. Hence φ(pe)=pe−pe−1. For general n, the Chinese remainder theorem (covered in Chapter 6) yields (Z/nZ)∗≅∏i(Z/pieiZ)∗, from which the multiplicativity of φ follows and the formula is obtained. □
3 Fermat's Little Theorem and Euler's Theorem
If gcd(a,n)=1, then aφ(n)≡1(modn).
Let (Z/nZ)∗={rˉ1,rˉ2,…,rˉφ(n)}. Since gcd(a,n)=1, the map rˉi↦aˉrˉi is a bijection on (Z/nZ)∗ (because aˉ is invertible). It follows that ∏iaˉrˉi=∏irˉi, i.e. aˉφ(n)∏irˉi=∏irˉi. Since ∏irˉi is invertible, we can cancel it from both sides to obtain aˉφ(n)=1ˉ. □
For a prime p and an integer a with p∤a, we have ap−1≡1(modp).
Apply Euler's theorem with φ(p)=p−1. □
4 Wilson's Theorem
An integer p≥2 is prime if and only if (p−1)!≡−1(modp).
(⇒) Since Z/pZ is a field, the equation x2≡1(modp) has only the solutions x≡±1. Among the elements of (Z/pZ)∗={1,2,…,p−1}, only 1 and p−1 are their own inverses; the remaining elements pair off into inverse pairs whose products are each 1. Therefore (p−1)!≡1⋅(p−1)⋅(product of pairs, each 1)≡p−1≡−1(modp).(⇐) We show that (n−1)!≡−1(modn) when n is composite. Write n=ab with 1<a≤b<n. If a=b, then both a and b appear as factors in (n−1)!, so n∣(n−1)! and (n−1)!≡0≡−1. If a=b, then n=a2 with a≥2, so 2a≤n−1, meaning both a and 2a appear as factors in (n−1)!, and the same conclusion holds. □
5 The Order of an Element
For gcd(a,n)=1, the smallest positive integer k satisfying ak≡1(modn) is called the order of a modulo n, and is denoted ordn(a).
If am≡1(modn), then ordn(a)∣m. In particular, ordn(a)∣φ(n).
Write m=ordn(a)⋅q+r with 0≤r<ordn(a). Then ar=am⋅(a−ordn(a))q≡1. Since r<ordn(a) and ordn(a) is the smallest positive exponent giving 1, we must have r=0. □