Discrete Logarithm
Statement
Let be prime and a primitive root mod . The discrete logarithm of base is the unique integer with satisfying
Because generates (by Primitive RootsPrimitive RootsA primitive root mod p is a generator of the cyclic group (Z/pZ)*, existing for every prime pRead more →), such always exists and is unique mod . The hardness of computing from , , and is the Discrete Logarithm Problem (DLP), the security foundation of Diffie-Hellman and elliptic-curve cryptography.
Visualization
Discrete log table for in :
| 0 | 1 |
| 1 | 2 |
| 2 | 4 |
| 3 | 8 |
| 4 | 5 |
| 5 | 10 |
| 6 | 9 |
| 7 | 7 |
| 8 | 3 |
| 9 | 6 |
Reading the table backwards: , , . Note that 2 hits all 10 nonzero residues, confirming it is a primitive root mod 11.
Proof Sketch
- is cyclic of order , generated by .
- The map (for ) is a group isomorphism from to .
- Therefore every element has a unique preimage — the discrete logarithm.
- The discrete log satisfies , turning multiplication into addition.
Connections
Discrete logarithms exist in any cyclic group; the same concept applies to elliptic curve groups. The existence follows from the Primitive RootsPrimitive RootsA primitive root mod p is a generator of the cyclic group (Z/pZ)*, existing for every prime pRead more → theorem. The analogue over is the ordinary logarithm from the Fundamental Theorem of CalculusFundamental Theorem of CalculusIntegration and differentiation are inverse operationsRead more → viewpoint.
Lean4 Proof
/-- If g generates (ZMod p)ˣ, then every element a has a discrete log. -/
theorem dlog_exists {p : ℕ} [Fact p.Prime]
(g : (ZMod p)ˣ)
(hg : ∀ x : (ZMod p)ˣ, x ∈ Subgroup.zpowers g)
(a : (ZMod p)ˣ) : ∃ n : ℤ, g ^ n = a := by
obtain ⟨n, hn⟩ := hg a
exact ⟨n, hn⟩Referenced by
- Primitive RootsNumber Theory