UniMaths
Free chapterTry everything here: cards, proofs and practice. Sign up free to save your progress and unlock all 4 chapters.Sign up free
NUMTH · 1

Orders and primitive roots

13 concepts · 29 questions

Multiplicative order, the totient sum, Lagrange's theorem on polynomial roots, primitive roots modulo primes and prime powers, Hensel lifting, the structure of the unit group, and discrete logarithms.

Overview 1The plan of this section

Euler's theorem says aφ(n)≡1a^{\varphi(n)}\equiv1. The finer question is the least such exponent, and whether some aa achieves the maximum φ(n)\varphi(n): then (Z/n)×(\mathbb{Z}/n)^\times is cyclic.

  1. Order (Def. 1.1, Lemma 1.2, Prop. 1.3) and the totient sum (Lemma 1.4).
  2. Lagrange's theorem on roots (Thm 1.5) and primitive roots modulo pp (Thm 1.6), with a test (Prop. 1.7).
  3. Hensel's lemma (Thm 1.8), primitive roots modulo pkp^k (Thm 1.9) and the structure of (Z/n)×(\mathbb{Z}/n)^\times (Cor. 1.10).
  4. Discrete logarithms (Example 1.11).

(Z/p)×(\mathbb{Z}/p)^\times is cyclic: every unit is a power of a primitive root. Hensel lifts this to pkp^k.

Definition 1.1Multiplicative order

For gcd⁡(a,n)=1\gcd(a, n) = 1, the order ord⁡n(a)\operatorname{ord}_n(a) is the least k≥1k\ge1 with ak≡1(modn)a^k\equiv1\pmod n. It exists by Euler's theorem, and it is the order of aa in the group (Z/n)×(\mathbb{Z}/n)^\times. A primitive root mod nn is an aa with ord⁡n(a)=φ(n)\operatorname{ord}_n(a) = \varphi(n).

ord⁡n(a)\operatorname{ord}_n(a): least kk with ak≡1a^k\equiv1. Primitive root: order φ(n)\varphi(n).

Lemma 1.2Orders divide exponents

am≡1(modn)a^m\equiv1\pmod n if and only if ord⁡n(a)∣m\operatorname{ord}_n(a)\mid m. In particular ord⁡n(a)∣φ(n)\operatorname{ord}_n(a)\mid\varphi(n), and ai≡aja^i\equiv a^j iff i≡j(modord⁡n(a))i\equiv j\pmod{\operatorname{ord}_n(a)}.

am≡1a^m\equiv1 ⇔ ord⁡(a)∣m\operatorname{ord}(a)\mid m; so orders divide φ(n)\varphi(n).

Proof

Proposition 1.3The order of a power

If ord⁡n(a)=d\operatorname{ord}_n(a) = d then ord⁡n(ak)=dgcd⁡(d,k)\operatorname{ord}_n(a^k) = \frac d{\gcd(d, k)}. In particular if gg is a primitive root mod nn, then gkg^k is a primitive root iff gcd⁡(k,φ(n))=1\gcd(k, \varphi(n)) = 1, so there are φ(φ(n))\varphi(\varphi(n)) primitive roots.

ord⁡(ak)=d/gcd⁡(d,k)\operatorname{ord}(a^k) = d/\gcd(d, k); there are φ(φ(n))\varphi(\varphi(n)) primitive roots when one exists.

Proof

Lemma 1.4The totient sum

For every n≥1n\ge1, ∑d∣nφ(d)=n\displaystyle\sum_{d\mid n}\varphi(d) = n.

∑d∣nφ(d)=n\sum_{d\mid n}\varphi(d) = n: sort kn\frac kn by reduced denominator.

Proof

Theorem 1.5Lagrange's theorem on polynomial congruences

A non-zero polynomial of degree dd over Z/p\mathbb{Z}/p has at most dd roots mod pp. Consequently, if d∣p−1d\mid p - 1 then xd−1x^d - 1 has exactly dd roots mod pp.

Degree dd ⇒ at most dd roots mod pp; xd−1x^d - 1 has exactly dd roots when d∣p−1d\mid p - 1. Fails mod composites.

Proof

Theorem 1.6Primitive roots modulo a prime

For every prime pp, (Z/p)×(\mathbb{Z}/p)^\times is cyclic: there is a primitive root gg. More precisely, for each d∣p−1d\mid p - 1 there are exactly φ(d)\varphi(d) elements of order dd.

(Z/p)×≅Cp−1(\mathbb{Z}/p)^\times\cong C_{p-1}: count elements of each order and compare with ∑φ(d)=p−1\sum\varphi(d) = p - 1.

Proof

Proposition 1.7Testing for a primitive root

Let pp be prime and gcd⁡(g,p)=1\gcd(g, p) = 1. Then gg is a primitive root mod pp if and only if g(p−1)/q≢1(modp)g^{(p-1)/q}\not\equiv1\pmod p for every prime q∣p−1q\mid p - 1.

gg is primitive mod pp iff g(p−1)/q≠1g^{(p-1)/q}\ne1 for each prime q∣p−1q\mid p - 1.

Proof

Theorem 1.8Hensel's lemma

Let f∈Z[x]f\in\mathbb{Z}[x], k≥1k\ge1, and f(a)≡0(modpk)f(a)\equiv0\pmod{p^k} with f′(a)≢0(modp)f'(a)\not\equiv0\pmod p. Then there is a unique tt mod pp such that b=a+tpkb = a + tp^k satisfies f(b)≡0(modpk+1)f(b)\equiv0\pmod{p^{k+1}}, namely t≡−f(a)pkf′(a)−1(modp)t\equiv-\frac{f(a)}{p^k}f'(a)^{-1}\pmod p. Iterating, a simple root mod pp lifts uniquely to a root mod every pkp^k.

Newton's method mod pp: a simple root lifts uniquely, b=a−f(a)f′(a)−1b = a - f(a)f'(a)^{-1}.

Proof

Theorem 1.9Which moduli have primitive roots

Primitive roots mod nn exist exactly for n=1,2,4,pkn = 1, 2, 4, p^k and 2pk2p^k (pp an odd prime, k≥1k\ge1). If gg is a primitive root mod pp with gp−1≢1(modp2)g^{p-1}\not\equiv1\pmod{p^2} (replacing gg by g+pg + p if necessary), then gg is a primitive root mod every pkp^k.

Cyclic unit groups: n=1,2,4,pk,2pkn = 1, 2, 4, p^k, 2p^k only. Lift a primitive root mod pp by checking mod p2p^2.

Proof

Corollary 1.10The structure of the unit group

If n=2ep1k1⋯prkrn = 2^ep_1^{k_1}\cdots p_r^{k_r} then (Z/n)×≅(Z/2e)××∏iC(pi−1)piki−1(\mathbb{Z}/n)^\times\cong(\mathbb{Z}/2^e)^\times\times\prod_iC_{(p_i - 1)p_i^{k_i - 1}}, where (Z/2)×(\mathbb{Z}/2)^\times is trivial, (Z/4)×≅C2(\mathbb{Z}/4)^\times\cong C_2, and (Z/2e)×=⟨−1⟩×⟨5⟩≅C2×C2e−2(\mathbb{Z}/2^e)^\times = \langle-1\rangle\times\langle5\rangle\cong C_2\times C_{2^{e-2}} for e≥3e\ge3.

CRT + cyclic odd parts + C2×C2e−2C_2\times C_{2^{e-2}} for 2e2^e.

Proof

Example 1.11Discrete logarithms and power congruences

Fix a primitive root gg mod pp. The index (discrete logarithm) ind⁡g(a)\operatorname{ind}_g(a) is the kk mod p−1p - 1 with gk≡ag^k\equiv a. It turns multiplication into addition: xm≡ax^m\equiv a becomes mind⁡x≡ind⁡a(modp−1)m\operatorname{ind}x\equiv\operatorname{ind}a\pmod{p - 1}, which is solvable iff gcd⁡(m,p−1)∣ind⁡a\gcd(m, p - 1)\mid\operatorname{ind}a, with gcd⁡(m,p−1)\gcd(m, p - 1) solutions. Computing indices is believed hard for large pp, which underlies Diffie–Hellman key exchange: from gag^a and gbg^b both parties compute gabg^{ab}.

Discrete log: xm≡ax^m\equiv a ⇔ mind⁡x≡ind⁡a(modp−1)m\operatorname{ind}x\equiv\operatorname{ind}a\pmod{p - 1}.

Check 1.12Check: orders and primitive roots

  • Orders divide φ(n)\varphi(n): only test divisors.
  • Primitive root mod pp: check g(p−1)/q≠1g^{(p-1)/q}\ne1 for primes q∣p−1q\mid p - 1 (fast by repeated squaring).
  • Modulus has a primitive root only if n=1,2,4,pk,2pkn = 1, 2, 4, p^k, 2p^k.
  • Power congruences mod pp: count solutions with gcd⁡(m,p−1)\gcd(m, p - 1).
  • Lifting to pkp^k: Hensel, if f′(a)≢0f'(a)\not\equiv0.

Test divisors of φ(n)\varphi(n); use the prime-factor test; Hensel for prime powers.