Math 2.0

Number theory Proof

Proof of the primitive root theorem

Builds on Primitive root modulo nMultiplicative orderExistence of primitive roots modulo a primeDivision algorithmEuler's theoremEuler's totient functionTotient of a prime powerTotient of a primeMultiplicativity of the totient functionBinomial theoremFactorial formula for binomial coefficientsEuclid's lemmaFermat's little theoremChinese remainder theoremFundamental theorem of arithmeticCoprime integersCongruence is compatible with powers

Proof

We prove existence for n=2,4,pk,2pkn = 2, 4, p^k, 2p^k, and then nonexistence for every other n≥2n \ge 2. Throughout, φ\varphi is Euler's totient function and ord⁡n(x)\operatorname{ord}_n(x) is the multiplicative order of an integer xx coprime to nn. A primitive root modulo nn is such an xx with ord⁡n(x)=φ(n)\operatorname{ord}_n(x) = \varphi(n).

  1. Let e=ord⁡n(x)e = \operatorname{ord}_n(x) and let m≥0m \ge 0 with xm≡1(modn)x^m \equiv 1 \pmod n. By the division algorithm, m=qe+rm = qe + r with q≥0q \ge 0 and 0≤r<e0 \le r < e. Then 1≡xm=(xe)qxr≡xr(modn)1 \equiv x^m = (x^e)^q x^r \equiv x^r \pmod n, using powers of congruences. Minimality of ee forces r=0r = 0. So e∣me \mid m.
  2. By Euler's theorem, xφ(n)≡1(modn)x^{\varphi(n)} \equiv 1 \pmod n. So ord⁡n(x)∣φ(n)\operatorname{ord}_n(x) \mid \varphi(n) by step 1, and in particular ord⁡n(x)≤φ(n)\operatorname{ord}_n(x) \le \varphi(n).

Existence.

  1. For n=2n = 2: φ(2)=1\varphi(2) = 1, and x=1x = 1 has order 11. For n=4n = 4: φ(4)=2\varphi(4) = 2, and 3≢13 \not\equiv 1 while 32=9≡1(mod4)3^2 = 9 \equiv 1 \pmod 4. So 33 has order 22.
  2. Let pp be an odd prime and k≥1k \ge 1. By the existence of primitive roots modulo a prime, there is gg with ord⁡p(g)=p−1\operatorname{ord}_p(g) = p - 1. Then p∤gp \nmid g.
  3. Suppose gp−1≡1(modp2)g^{p-1} \equiv 1 \pmod{p^2}. By the binomial theorem, (g+p)p−1=gp−1+(p−1)gp−2p+p2s(g + p)^{p-1} = g^{p-1} + (p-1) g^{p-2} p + p^2 s for an integer ss.
  4. So (g+p)p−1≡1+p2gp−2−pgp−2≡1−pgp−2(modp2)(g+p)^{p-1} \equiv 1 + p^2 g^{p-2} - p g^{p-2} \equiv 1 - p g^{p-2} \pmod{p^2}. By Euclid's lemma, p∤gp−2p \nmid g^{p-2}, so p2∤pgp−2p^2 \nmid p g^{p-2}. Hence (g+p)p−1≢1(modp2)(g+p)^{p-1} \not\equiv 1 \pmod{p^2}.
  5. Also g+p≡g(modp)g + p \equiv g \pmod p, so all powers agree modulo pp and ord⁡p(g+p)=p−1\operatorname{ord}_p(g + p) = p - 1. Replacing gg by g+pg + p if needed, we may assume gp−1≢1(modp2)g^{p-1} \not\equiv 1 \pmod{p^2}.
  6. By Fermat's little theorem, gp−1≡1(modp)g^{p-1} \equiv 1 \pmod p. So gp−1=1+pt1g^{p-1} = 1 + p t_1 with t1t_1 an integer, and p∤t1p \nmid t_1 by step 7.
  7. For 1≤i≤p−11 \le i \le p - 1, we have p∣(pi)p \mid \binom{p}{i}. Indeed, (pi) i! (p−i)!=p!\binom{p}{i} \, i! \, (p-i)! = p! by the factorial formula. Here p∣p!p \mid p!, but p∤i! (p−i)!p \nmid i! \, (p-i)! by Euclid's lemma, since all factors are less than pp. So Euclid's lemma gives p∣(pi)p \mid \binom{p}{i}.
  8. Claim: for each j≥1j \ge 1, gpj−1(p−1)=1+pjtjg^{p^{j-1}(p-1)} = 1 + p^j t_j with tjt_j an integer and p∤tjp \nmid t_j. We argue by induction on jj. Step 8 is the case j=1j = 1.
  9. Assume the claim for jj and write t=tjt = t_j. By the binomial theorem, gpj(p−1)=(1+pjt)p=1+pj+1t+∑i=2p−1(pi)pijti+ppjtpg^{p^j (p-1)} = (1 + p^j t)^p = 1 + p^{j+1} t + \sum_{i=2}^{p-1} \binom{p}{i} p^{ij} t^i + p^{pj} t^p.
  10. For 2≤i≤p−12 \le i \le p - 1, the term is divisible by p⋅p2jp \cdot p^{2j} by step 9, and 2j+1≥j+22j + 1 \ge j + 2. The last term is divisible by ppjp^{pj}, and pj≥3j≥j+2pj \ge 3j \ge j + 2.
  11. So gpj(p−1)=1+pj+1(t+pu)g^{p^j(p-1)} = 1 + p^{j+1}(t + p u) for an integer uu. Set tj+1=t+put_{j+1} = t + pu. Since p∤tp \nmid t, also p∤tj+1p \nmid t_{j+1}. This proves the claim.
  12. Now let e=ord⁡pk(g)e = \operatorname{ord}_{p^k}(g), which is defined since p∤gp \nmid g. By step 2 and the totient of a prime power, e∣pk−1(p−1)e \mid p^{k-1}(p-1).
  13. From ge≡1(modpk)g^e \equiv 1 \pmod{p^k} we get ge≡1(modp)g^e \equiv 1 \pmod p. By step 1 with modulus pp, (p−1)∣e(p - 1) \mid e. Write e=(p−1)ce = (p-1) c. Then c∣pk−1c \mid p^{k-1}.
  14. By the fundamental theorem of arithmetic, c=pic = p^i with 0≤i≤k−10 \le i \le k - 1.
  15. Suppose i≤k−2i \le k - 2; this needs k≥2k \ge 2. Then e∣pk−2(p−1)e \mid p^{k-2}(p-1), so gpk−2(p−1)≡1(modpk)g^{p^{k-2}(p-1)} \equiv 1 \pmod{p^k}.
  16. But step 10 with j=k−1j = k - 1 gives gpk−2(p−1)=1+pk−1tk−1g^{p^{k-2}(p-1)} = 1 + p^{k-1} t_{k-1} with p∤tk−1p \nmid t_{k-1}. So pkp^k does not divide gpk−2(p−1)−1g^{p^{k-2}(p-1)} - 1, a contradiction.
  17. Hence i=k−1i = k - 1 and e=pk−1(p−1)=φ(pk)e = p^{k-1}(p-1) = \varphi(p^k). So gg is a primitive root modulo pkp^k.
  18. Let n=2pkn = 2p^k. Put h=gh = g if gg is odd, and h=g+pkh = g + p^k if gg is even. Since pkp^k is odd, hh is odd.
  19. As h≡g(modpk)h \equiv g \pmod{p^k}, all powers of hh and gg agree modulo pkp^k. So ord⁡pk(h)=φ(pk)\operatorname{ord}_{p^k}(h) = \varphi(p^k).
  20. A prime that divides both hh and 2pk2p^k is 22 or pp. But hh is odd and p∤hp \nmid h. So hh is coprime to 2pk2p^k.
  21. By the multiplicativity of the totient and the totient of a prime, φ(2pk)=φ(2)φ(pk)=φ(pk)\varphi(2p^k) = \varphi(2)\varphi(p^k) = \varphi(p^k).
  22. Let e=ord⁡2pk(h)e = \operatorname{ord}_{2p^k}(h). From he≡1(modpk)h^e \equiv 1 \pmod{p^k} and step 1, φ(pk)∣e\varphi(p^k) \mid e, so e≥φ(pk)e \ge \varphi(p^k). By step 2, e≤φ(2pk)=φ(pk)e \le \varphi(2p^k) = \varphi(p^k). So hh is a primitive root modulo 2pk2p^k.

Nonexistence.

  1. Let k≥3k \ge 3. Claim: every odd aa satisfies a2k−2≡1(mod2k)a^{2^{k-2}} \equiv 1 \pmod{2^k}. We argue by induction on kk.
  2. For k=3k = 3, write a=2b+1a = 2b + 1. Then a2=4b(b+1)+1a^2 = 4b(b+1) + 1. One of bb and b+1b + 1 is even, so 8∣a2−18 \mid a^2 - 1.
  3. If a2k−2=1+2ksa^{2^{k-2}} = 1 + 2^k s with ss an integer, then a2k−1=1+2k+1s+22ks2a^{2^{k-1}} = 1 + 2^{k+1} s + 2^{2k} s^2. Since 2k≥k+12k \ge k + 1, this is 11 modulo 2k+12^{k+1}. This proves the claim.
  4. The integers coprime to 2k2^k are the odd ones. By step 27 and step 1, each has order at most 2k−22^{k-2}. This is less than 2k−1=φ(2k)2^{k-1} = \varphi(2^k), so there is no primitive root modulo 2k2^k.
  5. Claim: φ(c)\varphi(c) is even for every integer c≥3c \ge 3. Let SS be the set of xx with 1≤x≤c1 \le x \le c and gcd⁡(x,c)=1\gcd(x, c) = 1. Then c∉Sc \notin S.
  6. For x∈Sx \in S, we have 1≤c−x≤c−11 \le c - x \le c - 1, and gcd⁡(c−x,c)=gcd⁡(x,c)=1\gcd(c - x, c) = \gcd(x, c) = 1, since xx and c−xc - x have the same common divisors with cc. So x↦c−xx \mapsto c - x maps SS to itself, and applying it twice gives xx.
  7. If x=c−xx = c - x, then c=2xc = 2x and gcd⁡(x,c)=x\gcd(x, c) = x, so x=1x = 1 and c=2c = 2. This is excluded. So SS splits into pairs {x,c−x}\set{x, c - x}, and φ(c)=∣S∣\varphi(c) = \abs{S} is even.
  8. Claim: if n=abn = ab with a,b≥3a, b \ge 3 coprime, then there is no primitive root modulo nn. Let xx be coprime to nn. Then xx is coprime to aa and to bb.
  9. Let L=φ(a)φ(b)/2L = \varphi(a)\varphi(b)/2. It is an integer, and L=φ(a)⋅(φ(b)/2)=φ(b)⋅(φ(a)/2)L = \varphi(a) \cdot (\varphi(b)/2) = \varphi(b) \cdot (\varphi(a)/2) with integer factors, by step 31.
  10. By Euler's theorem, xL=(xφ(a))φ(b)/2≡1(moda)x^L = (x^{\varphi(a)})^{\varphi(b)/2} \equiv 1 \pmod a and xL=(xφ(b))φ(a)/2≡1(modb)x^L = (x^{\varphi(b)})^{\varphi(a)/2} \equiv 1 \pmod b.
  11. Both xLx^L and 11 are congruent to 11 modulo aa and modulo bb. By the Chinese remainder theorem, xL≡1(modab)x^L \equiv 1 \pmod{ab}.
  12. So ord⁡n(x)≤L<φ(a)φ(b)=φ(n)\operatorname{ord}_n(x) \le L < \varphi(a)\varphi(b) = \varphi(n), by multiplicativity of the totient. This proves the claim.
  13. Now let n≥2n \ge 2 not be of the form 2,4,pk,2pk2, 4, p^k, 2p^k. Write n=2jmn = 2^j m with j≥0j \ge 0 and mm odd. If m=1m = 1, then n=2jn = 2^j with j≥3j \ge 3, and step 28 applies.
  14. If mm has two distinct prime factors, let qq be one of them and qfq^f the exact power of qq in mm. Then m=qfm′m = q^f m' with q∤m′q \nmid m'. The other prime factor of mm divides m′m', so m′m' is odd and m′≥3m' \ge 3. Take a=qfa = q^f and b=2jm′b = 2^j m'.
  15. Then a,b≥3a, b \ge 3, and q∤bq \nmid b by Euclid's lemma. So aa and bb are coprime, and step 36 applies.
  16. If m=qfm = q^f for one odd prime qq, then j≠0j \ne 0 and j≠1j \ne 1 by assumption. So j≥2j \ge 2. Take a=2j≥4a = 2^j \ge 4 and b=qf≥3b = q^f \ge 3, which are coprime. Step 36 applies.
  17. So a primitive root modulo nn exists if and only if n∈{2,4,pk,2pk}n \in \set{2, 4, p^k, 2p^k}.

Idea

A primitive root modulo pp lifts to pkp^k once gp−1g^{p-1} is not 11 modulo p2p^2. Then each pp-th power raises the exact power of pp in gpj−1(p−1)−1g^{p^{j-1}(p-1)} - 1 by one, so no smaller exponent works. For other moduli the group splits into two parts of even size, or is a large power of 22, and a common exponent below φ(n)\varphi(n) kills every unit.

Reading path

To understand this page from the ground up, read these 164 pages in order. The foundations come first. The path takes the proofs Proof of Bézout's identity, Proof of cancellation in an integral domain, Proof of the sum of the totient over the divisors, Proof of the generalized Euclid's lemma, Proof of the Chinese remainder theorem, Proof of the commutativity of addition by induction, Proof of Fermat's little theorem by rearrangement, Proof that g to the n equals 1 iff the order divides n, Proof that a composition of injections is injective, Proof of Euclid's lemma, Proof that R[x] is an integral domain iff R is, Proof that a function is bijective iff it has a two-sided inverse, Proof that the order of the group of units of Z/nZ is Euler's totient, Proof of the degree of a product over an integral domain, Proof of strong induction from ordinary induction, Proof of the laws of exponents in a group, Proof of the fundamental theorem of arithmetic, Proof of Euler's theorem by rearrangement, Proof that the integers modulo a prime form a field, Proof of Pascal's rule from the recursive definition, Proof that a composition of surjections is surjective, Proof that congruence is compatible with addition, Proof of the multiplicativity of the totient function, Proof of the existence of prime factorization, Proof that a polynomial over a field has at most as many roots as its degree, Proof of the remainder theorem, Proof of the formula for the totient of a prime, Proof of the factorial formula for binomial coefficients by induction, Proof that congruence is compatible with multiplication, Proof that the order modulo p divides p − 1, Proof of the binomial theorem by induction, Proof of the formula for the order of a power, Proof of the existence of primitive roots modulo a prime by counting elements of each order, Proof of the well-ordering principle from strong induction, Proof of the division algorithm, Proof of the uniqueness of inverses, Proof of the existence of inverses modulo n, Proof that the units of Z/nZ are the residues coprime to n, Proof of the formula for the totient of a prime power, Proof of the bijection principle, Proof of the factor theorem, Proof of the existence of a prime divisor, Proof that congruence is compatible with powers.

  1. Binary operation definition
  2. Binomial coefficient definition
  3. Cardinality of a finite set definition
  4. Definition by recursion concept
  5. Divisibility definition
  6. Element definition
  7. Factorial definition
  8. Group concept
  9. Group of units of Z/nZ object
  10. Mathematical induction concept
  11. Natural numbers object
  12. Peano axioms concept
  13. Proposition concept
  14. Associativity definition
  15. Identity element definition
  16. Proof of Pascal's rule from the recursive definition proof
  17. Congruence modulo n definition
  18. Greatest common divisor definition
  19. Prime number definition
  20. Set definition
  21. Order of a group definition
  22. Ring definition
  23. Subgroup definition
  24. Successor function definition
  25. Implication definition
  26. Predicate definition
  27. Semigroup definition
  28. Inverse element definition
  29. Pascal's rule statement
  30. Modular multiplicative inverse definition
  31. Residue class definition
  32. Proof that congruence is compatible with addition proof
  33. Proof that congruence is compatible with multiplication proof
  34. Coprime integers definition
  35. Prime factorization definition
  36. Ordered pair definition
  37. Addition of natural numbers definition
  38. Commutative ring definition
  39. Polynomial ring definition
  40. Ring homomorphism definition
  41. Unit of a ring definition
  42. Zero divisor definition
  43. The successor function is injective statement
  44. Zero is not a successor statement
  45. Existential quantifier definition
  46. Universal quantifier definition
  47. Monoid definition
  48. Proof of the factorial formula for binomial coefficients by induction proof
  49. Congruence is compatible with addition statement
  50. Proof of the uniqueness of inverses proof
  51. Congruence is compatible with multiplication statement
  52. Euler's totient function definition
  53. Cartesian product definition
  54. Proof of the commutativity of addition by induction proof
  55. Order on the natural numbers definition
  56. Subset definition
  57. Group of units of a ring definition
  58. Divisibility in a commutative ring definition
  59. Degree of a polynomial definition
  60. Polynomial evaluation definition
  61. Field definition
  62. Integral domain definition
  63. Uniqueness quantifier definition
  64. Group of units of a monoid definition
  65. Factorial formula for binomial coefficients statement
  66. Integers modulo n definition
  67. Proof that congruence is compatible with powers proof
  68. Uniqueness of inverses statement
  69. Proof of the formula for the totient of a prime proof
  70. Binary relation definition
  71. Commutativity of addition statement
  72. Proof of cancellation in an integral domain proof
  73. Proof of strong induction from ordinary induction proof
  74. Leading coefficient definition
  75. Evaluation homomorphism definition
  76. Root of a polynomial definition
  77. Congruence is compatible with powers statement
  78. Proof of the binomial theorem by induction proof
  79. Totient of a prime statement
  80. Proof of the laws of exponents in a group proof
  81. Strong induction statement
  82. Monic polynomial definition
  83. Function definition
  84. Cancellation in an integral domain statement
  85. Proof of the remainder theorem proof
  86. Multiplicity of a root definition
  87. Proof of the degree of a product over an integral domain proof
  88. Binomial theorem statement
  89. Laws of exponents in a group statement
  90. Codomain definition
  91. Function composition definition
  92. Identity function definition
  93. Injective function definition
  94. Proof of the well-ordering principle from strong induction proof
  95. Division algorithm for polynomials statement
  96. Degree of a product statement
  97. Left inverse definition
  98. Right inverse definition
  99. Order of an element definition
  100. Proof that a composition of injections is injective proof
  101. Surjective function definition
  102. Cyclic subgroup generated by an element definition
  103. Well-ordering principle statement
  104. Remainder theorem statement
  105. Proof that R[x] is an integral domain iff R is proof
  106. Proof that a composition of surjections is surjective proof
  107. Composition of injections is injective statement
  108. Bijective function definition
  109. Cyclic group definition
  110. Proof of the existence of a prime divisor proof
  111. Proof of the division algorithm proof
  112. Proof of the factor theorem proof
  113. R[x] is an integral domain iff R is statement
  114. Composition of surjections is surjective statement
  115. Proof that a function is bijective iff it has a two-sided inverse proof
  116. Existence of a prime divisor statement
  117. Division algorithm statement
  118. Factor theorem statement
  119. Bijective iff it has a two-sided inverse statement
  120. Proof that g to the n equals 1 iff the order divides n proof
  121. Proof of Bézout's identity proof
  122. Proof of the existence of prime factorization proof
  123. Proof that a polynomial over a field has at most as many roots as its degree proof
  124. Proof of the bijection principle proof
  125. g to the n equals 1 iff the order divides n statement
  126. Bézout's identity statement
  127. Existence of prime factorization statement
  128. A polynomial over a field has at most as many roots as its degree statement
  129. Bijection principle statement
  130. Proof of the existence of inverses modulo n proof
  131. Proof of the generalized Euclid's lemma proof
  132. Proof of the sum of the totient over the divisors proof
  133. Proof that the integers modulo a prime form a field proof
  134. Proof that the units of Z/nZ are the residues coprime to n proof
  135. Existence of inverses modulo n statement
  136. Integers modulo a prime form a field statement
  137. Sum of the totient over the divisors statement
  138. Generalized Euclid's lemma statement
  139. Units of Z/nZ are the residues coprime to n statement
  140. Proof of the formula for the order of a power proof
  141. Proof of the Chinese remainder theorem proof
  142. Proof of Euler's theorem by rearrangement proof
  143. Proof of Euclid's lemma proof
  144. Proof that the order of the group of units of Z/nZ is Euler's totient proof
  145. Order of a power statement
  146. Chinese remainder theorem statement
  147. Euclid's lemma statement
  148. Euler's theorem statement
  149. Order of the group of units of Z/nZ is Euler's totient statement
  150. Proof of the multiplicativity of the totient function proof
  151. Proof of Fermat's little theorem by rearrangement proof
  152. Proof of the formula for the totient of a prime power proof
  153. Multiplicative order definition
  154. Proof of the fundamental theorem of arithmetic proof
  155. Fermat's little theorem statement
  156. Multiplicativity of the totient function statement
  157. Primitive root modulo n definition
  158. Totient of a prime power statement
  159. Fundamental theorem of arithmetic statement
  160. Proof that the order modulo p divides p − 1 proof
  161. The order modulo p divides p − 1 statement
  162. Proof of the existence of primitive roots modulo a prime by counting elements of each order proof
  163. Existence of primitive roots modulo a prime statement
  164. Proof of the primitive root theorem proof

Where this leads

1 page builds on this one.

Further reading

  1. Web https://math.libretexts.org/Bookshelves/Combinatorics_and_Discrete_Mathematics/Elementary_Number_Theory_(Raji)/05%3A_Primitive_Roots_and_Quadratic_Residues/5.03%3A_The_Existence_of_Primitive_Roots
About this page
Tag1PP33DM13N
URIm2://1PP33DM13N
Kindproof
WritingW0 stub
MSC11A07
ProvesPrimitive root theorem
UsesPrimitive root modulo n, Multiplicative order, Existence of primitive roots modulo a prime, Division algorithm, Euler's theorem, Euler's totient function, Totient of a prime power, Totient of a prime, Multiplicativity of the totient function, Binomial theorem, Factorial formula for binomial coefficients, Euclid's lemma, Fermat's little theorem, Chinese remainder theorem, Fundamental theorem of arithmetic, Coprime integers, Congruence is compatible with powers
Changed4 November 2026

Markdown · JSON · Edit on GitHub

What this page needs for W1

  • an inventory row: the row of the inventory that the node accounts for (0 of 1)
  • a source with a locator (0 of 1)

The writing levels say how complete the text of a page is. They do not measure its truth.

What links here

No page links to this page yet.