A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Primitive Roots and Cyclic Groups Mod p

Graduate Depth 80 in the knowledge graph ☐ I know this ☆ Set as goal
26topics build on this
387prerequisites beneath it
See this on the map →
Euler's Totient FunctionFermat's Little Theorem+3 more→→Discrete Logarithms
primitive-roots cyclic-groups generators

Core Idea

A primitive root mod p is an integer g whose powers g1, g2, ..., gp-1 exhaust all nonzero residues mod p. Equivalently, g has order p-1. Every prime p has primitive roots, making (Z/pZ)* cyclic of order p-1.

Explainer

Fermat's Little Theorem tells you that every nonzero residue a mod p satisfies ap-1 ≡ 1 (mod p), but it doesn't reveal the *smallest* exponent with this property. The order of a mod p is the smallest positive integer d such that ad ≡ 1 (mod p). Because ap-1 ≡ 1, the order d must divide p-1. Some elements have small order — for instance, 1 always has order 1, and if p-1 is even then −1 has order 2 — but the question is whether any element achieves the maximum possible order p-1. Such an element is a primitive root mod p.

When g is a primitive root, the p-1 powers g, g2, ..., gp-1 are all distinct (if gi ≡ gj with i < j, then gj-i ≡ 1, contradicting the minimality of p-1). Since there are exactly p-1 nonzero residues mod p and the powers produce p-1 distinct values, every nonzero residue appears exactly once. The group (Z/pZ)* is cyclic: it is generated by a single element, exactly as the integers mod n under addition are generated by 1. This is a structural fact about primes — non-prime moduli don't always have primitive roots.

The existence of primitive roots mod every prime is a theorem, not obvious. The count is given by Euler's totient function: exactly φ(p-1) of the p-1 nonzero residues are primitive roots. For p = 7, p-1 = 6 and φ(6) = 2, so exactly two primitive roots exist — they are 3 and 5. Verify: 31=3, 32=2, 33=6, 34=4, 35=5, 36=1 (mod 7) — all six residues appear. Once you find one primitive root g, the others are exactly the powers gk where gcd(k, p-1) = 1.

Primitive roots are the key to defining discrete logarithms: if g is a primitive root mod p and a is any nonzero residue, there is a unique x in {0, 1, ..., p-2} with gx ≡ a (mod p). This x is the discrete logarithm of a to base g, written log_g(a). Computing discrete logarithms — given g, p, and a, find x — is believed to be computationally hard for large primes. The security of Diffie-Hellman key exchange and ElGamal encryption rests on this hardness. The cyclic structure you've built here is precisely the algebraic foundation these cryptographic protocols exploit.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → The Distributive Property → Variables and Expressions Review → Introduction to Polynomials → Adding and Subtracting Polynomials → Multiplying Polynomials → Factorial → Permutations → Combinations → Counting Principles: Addition and Multiplication Rules → Introduction to Graph Theory → Propositional Logic Foundations → Logical Equivalences → Set Operations: Union, Intersection, and Complement → Proof by Cases → Proving by Cases and Exhaustion → Vacuous Truth and Trivial Cases → Proof by Cases (Proof by Exhaustion) → Mathematical Induction → Divisibility and Greatest Common Divisor → The Fundamental Theorem of Arithmetic → Divisibility Theory (Formal Treatment) → Fundamental Theorem of Arithmetic (Rigorous Proof) → Arithmetic Functions and Multiplicativity → Euler's Totient Function → Primitive Roots and Cyclic Groups Mod p

Longest path: 81 steps · 387 total prerequisite topics

Prerequisites (5)

Leads To (1)