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 moreDiscrete 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 ZeroThe Number ZeroCounting to FiveCounting to 10Counting to 20Counting a Set of Objects Up to 20Cardinality: The Last Number CountedMatching Numerals to QuantitiesSubitizing Small QuantitiesAddition Within 10Number Bonds to 10Addition Within 20Doubles and Near DoublesDoubles Facts Within 10Near Doubles Facts Within 20Mental Math Strategies for AdditionMental Math: Adding and Subtracting TensAddition Within 100Repeated Addition as MultiplicationMultiplication as Equal GroupsMultiplication: ArraysBasic Multiplication Facts (0s, 1s, 2s, 5s, 10s)Multiplication Facts Within 100Division as Equal SharingDivision as Grouping (Measurement Division)Division: Grouping (Repeated Subtraction) ModelDivision: Fair Sharing ModelDivision as Equal SharingDivision as GroupingBasic Division FactsDivision Facts Within 100Multiplication and Division Fact FamiliesRelationship Between Multiplication and DivisionDivision Facts as Inverse of MultiplicationRemainders and Quotients in DivisionDivision Word ProblemsMulti-Step Word ProblemsSolving Multi-Step Word ProblemsMultiplication Word ProblemsDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueIntegers and the Number LineComparing and Ordering IntegersAbsolute ValueAdding IntegersSubtracting IntegersMultiplying IntegersIntroduction to ExponentsOrder of OperationsInteger Order of OperationsVariable ExpressionsThe Distributive PropertyVariables and Expressions ReviewIntroduction to PolynomialsAdding and Subtracting PolynomialsMultiplying PolynomialsFactorialPermutationsCombinationsCounting Principles: Addition and Multiplication RulesIntroduction to Graph TheoryPropositional Logic FoundationsLogical EquivalencesSet Operations: Union, Intersection, and ComplementProof by CasesProving by Cases and ExhaustionVacuous Truth and Trivial CasesProof by Cases (Proof by Exhaustion)Mathematical InductionDivisibility and Greatest Common DivisorThe Fundamental Theorem of ArithmeticDivisibility Theory (Formal Treatment)Fundamental Theorem of Arithmetic (Rigorous Proof)Arithmetic Functions and MultiplicativityEuler's Totient FunctionPrimitive Roots and Cyclic Groups Mod p

Longest path: 81 steps · 387 total prerequisite topics

Prerequisites (5)

Leads To (1)