Euler's Totient Function
Statement
The Euler totient function counts the integers in that are coprime to :
Euler's theorem says: for any with ,
This generalises Fermat's Little TheoremFermat's Little TheoremFor prime p, a^p is congruent to a mod pRead more → (which is the special case prime, ).
Visualization
Totient values for small :
| Coprime residues | ||
|---|---|---|
| 1 | 1 | |
| 2 | 1 | |
| 4 | 2 | |
| 6 | 2 | |
| 8 | 4 | |
| 9 | 6 | |
| 10 | 4 | |
| 12 | 4 |
Key formulas:
φ(p) = p - 1 (p prime)
φ(p^k) = p^k - p^(k-1) = p^(k-1)(p - 1)
φ(mn) = φ(m)φ(n) if gcd(m,n) = 1 (multiplicativity)
φ(n) = n · ∏_{p | n} (1 - 1/p) (general formula)
Euler's theorem trace for , , :
3^1 = 3 ≡ 3 (mod 10)
3^2 = 9 ≡ 9 (mod 10)
3^3 = 27 ≡ 7 (mod 10)
3^4 = 81 ≡ 1 (mod 10) ← 3^φ(10) ≡ 1 ✓
Group structure: the units form a group of order . Euler's theorem is just Lagrange's theorem applied to in this group.
Proof Sketch
-
The units form a group. is a multiplicative group of order (closure under multiplication uses Bezout's IdentityBezout's IdentityThe gcd of two integers is always an integer linear combination of those integersRead more → to show the product of two coprime-to- elements stays coprime to ).
-
Lagrange's theorem. For any finite group and any , the order of divides . So (identity).
-
Apply to our group. , so for any unit .
-
Multiplicativity. For coprime , the Chinese Remainder TheoremChinese Remainder TheoremSimultaneous congruences with coprime moduli have a unique solution mod their productRead more → gives a ring isomorphism . Passing to units: .
Connections
Euler's theorem is the engine of RSA encryption: a message encrypted as (with ) is decrypted by where (found via Bezout's IdentityBezout's IdentityThe gcd of two integers is always an integer linear combination of those integersRead more →). The special case recovers Fermat's Little TheoremFermat's Little TheoremFor prime p, a^p is congruent to a mod pRead more →. The multiplicativity formula uses the Chinese Remainder TheoremChinese Remainder TheoremSimultaneous congruences with coprime moduli have a unique solution mod their productRead more →. The totient counts units in , linking to Wilson's TheoremWilson's TheoremA natural number p > 1 is prime if and only if (p-1)! ≡ -1 mod pRead more → which identifies when this group has product . Prime counting via the Fundamental Theorem of ArithmeticFundamental Theorem of ArithmeticEvery integer greater than 1 has a unique prime factorizationRead more → gives the inclusion-exclusion formula for .
Lean4 Proof
/-- **Euler's theorem**: every unit of `ZMod n` raised to the `n.totient`-th
power equals 1. Mathlib states this as `ZMod.pow_totient`. -/
theorem euler_theorem {n : ℕ} (x : (ZMod n)ˣ) : x ^ n.totient = 1 :=
ZMod.pow_totient xReferenced by
- RSA CorrectnessCryptography
- Order Modulo nNumber Theory
- Order Modulo nNumber Theory
- Primitive RootsNumber Theory
- Chinese Remainder TheoremNumber Theory
- Bezout's IdentityNumber Theory
- Euclidean AlgorithmNumber Theory
- Wilson's TheoremNumber Theory
- Quadratic ResiduesNumber Theory
- Divisor Function σ(n)Number Theory