Order Modulo n
Statement
For , the multiplicative order of modulo is
In Lean this is orderOf a for a : (ZMod n)ˣ.
Theorem (Lagrange). .
In Mathlib: ZMod.pow_totient states for units, and orderOf_dvd_card (from group theory) gives . Since by ZMod.card_units_eq_totient, we get the divisibility.
Visualization
Orders of elements in :
The units mod 12 are (those coprime to 12), so .
| Powers | ||
|---|---|---|
| 1 | 1, 1, 1, 1 | 1 |
| 5 | 5, 1, 5, 1 | 2 |
| 7 | 7, 1, 7, 1 | 2 |
| 11 | 11, 1, 11, 1 | 2 |
All orders (1, 2, 2, 2) divide . Note: no element has order 4, so is not cyclic (it is ).
Contrast with (prime modulus): 2 has order 3, while 3 has order 6 = , so 3 is a primitive root.
Proof Sketch
- The set in the finite group must eventually repeat; the first repetition gives a period .
- The cyclic subgroup has order .
- By Lagrange's theorem, .
- In particular , recovering the Euler–Euler's Totient FunctionEuler's Totient Functionφ(n) counts integers up to n coprime to n, and governs modular exponentiationRead more → theorem.
Connections
The order always divides Euler's Totient FunctionEuler's Totient Functionφ(n) counts integers up to n coprime to n, and governs modular exponentiationRead more → , with equality iff is a primitive root (see Primitive RootsPrimitive RootsA primitive root mod p is a generator of the cyclic group (Z/pZ)*, existing for every prime pRead more →). For prime the divisibility is a corollary of Fermat's Little TheoremFermat's Little TheoremFor prime p, a^p is congruent to a mod pRead more →.
Lean4 Proof
/-- The order of any unit in (ZMod n)ˣ divides the card of the group,
which equals Euler's totient φ(n). -/
theorem order_dvd_totient (n : ℕ) [NeZero n] (a : (ZMod n)ˣ) :
orderOf a ∣ n.totient := by
have h1 : orderOf a ∣ Fintype.card (ZMod n)ˣ := orderOf_dvd_card
rwa [ZMod.card_units_eq_totient] at h1