Primitive Roots
Statement
An element is a primitive root mod (a generator) if every element of is a power of , i.e.\ the multiplicative order of equals .
Theorem. For every prime , the group is cyclic, so primitive roots exist.
In Mathlib the cyclicity is an instance: IsCyclic (ZMod p)ˣ, proved via ZMod.isCyclic_units_prime. IsCyclic.exists_generator then yields a concrete generator.
Visualization
Primitive roots mod 11 (the full group has order 10):
| Powers | Generator? | |
|---|---|---|
| 2 | 2,4,8,5,10,9,7,3,6,1 | Yes |
| 3 | 3,9,5,4,1,… | No (order 5) |
| 6 | 6,3,7,9,10,5,8,4,2,1 | Yes |
| 7 | 7,5,2,3,10,4,6,9,8,1 | Yes |
Primitive roots mod 11: — there are of them.
Primitive roots mod 13 (order 12):
Primitive roots: — there are of them.
Primitive roots mod 17 (order 16):
Primitive roots: — there are of them.
In general, if primitive roots exist mod , there are exactly of them.
Proof Sketch
- is a finite abelian group of order .
- By the structure theorem for finite abelian groups, it decomposes into cyclic factors. One shows (using the polynomial having at most roots in ) that the group is cyclic.
- Any generator is a primitive root. Since generates a cyclic group of order , every element appears among .
- The number of generators of a cyclic group of order is by Euler's Totient FunctionEuler's Totient Functionφ(n) counts integers up to n coprime to n, and governs modular exponentiationRead more →.
Connections
Primitive roots underpin Discrete LogarithmDiscrete LogarithmThe discrete logarithm is the inverse of modular exponentiation: find k such that g^k = a in a finite groupRead more → — the discrete log of base is the unique with . They also appear in the proof of Quadratic ReciprocityQuadratic ReciprocityRelationship between solvability of quadratic congruences for two odd primesRead more → via Gauss sums.
Lean4 Proof
/-- The unit group of ZMod p is cyclic for any prime p.
This is `ZMod.isCyclic_units_prime` in Mathlib. -/
theorem zmod_prime_units_cyclic (p : ℕ) (hp : p.Prime) : IsCyclic (ZMod p)ˣ :=
ZMod.isCyclic_units_prime hp
/-- A cyclic group has a generator. -/
theorem primitive_root_exists (p : ℕ) (hp : p.Prime) :
∃ g : (ZMod p)ˣ, ∀ x : (ZMod p)ˣ, x ∈ Subgroup.zpowers g := by
haveI : IsCyclic (ZMod p)ˣ := ZMod.isCyclic_units_prime hp
obtain ⟨g, hg⟩ := IsCyclic.exists_generator (α := (ZMod p)ˣ)
exact ⟨g, hg⟩Referenced by
- Discrete LogarithmNumber Theory
- Discrete LogarithmNumber Theory
- Order Modulo nNumber Theory
- Legendre SymbolNumber Theory