Primitive Roots and Discrete Logarithms
7.1 The Order of an Element
Section titled “7.1 The Order of an Element”Definition. The order of modulo () is the smallest positive with . It always exists (Fermat/Euler bound it by , ) and divides every exponent that kills : if then .
Proof of the division fact. Write , . Then ; minimality of forces .
Worked example. Powers of 3 mod 7: ; order 6 = .
7.2 Primitive Roots
Section titled “7.2 Primitive Roots”Definition. is a primitive root modulo if the order of is , i.e. the powers of run through all units:
Equivalently generates the group of units, and every unit is for exactly one .
Theorem (Gauss). possesses a primitive root if and only if for odd primes .
So primitive roots exist for every odd prime power (and 2, 4), but not for (squares of odd units are ) nor for most even moduli.
Example. Mod 7, the order of 3 is 6 = , so 3 is a primitive root; every unit is a power of 3. Mod 7, 2 has order 3 (); not a primitive root.
7.3 Indices (Discrete Logarithms)
Section titled “7.3 Indices (Discrete Logarithms)”If is a primitive root mod and , the index of (base ) is the unique with ; the discrete logarithm. Indices turn multiplication into addition, exactly like logarithms:
They are the computational engine of old-style power-congruence problems, and their one-way hardness (computing from ) underlies Diffie–Hellman key exchange; see Number Theory and Cryptography.
7.4 Finding Primitive Roots
Section titled “7.4 Finding Primitive Roots”The order of any unit divides ; is primitive iff for every prime . Testing the prime factors only is the standard shortcut.
Example. Mod 31, . Test 3: (compute) , , : order 30; 3 is a primitive root mod 31.
The number of primitive roots mod is , and they are exactly for .
7.5 Consequences
Section titled “7.5 Consequences”- Power equation solvability: (with a primitive root and ) reduces to the linear congruence in indices; solvable iff .
- Quadratic residues are exactly the even-index powers: see Quadratic Residues.
- Products of two squares and related characterisations fall out of the index parity.
7.6 Common Pitfalls
Section titled “7.6 Common Pitfalls”- Checking only does not prove is primitive; all prime factors of must be excluded.
- Primitive roots exist only for : there is no primitive root mod 8 or mod 15; “find a primitive root mod 15” is a trick question.
- values live modulo , and the discrete log of a sum is not the sum of discrete logs.
See Also
Section titled “See Also”7.x Index Arithmetic in Action
Section titled “7.x Index Arithmetic in Action”Solve using index tables base 3: and , so ; the linear-congruence method from the CRT page.
Index arithmetic converts multiplication problems into linear congruences. To compute when 3 has order 6: reduce the exponent 17 modulo 6 to 5, and read off from the power table. State the order reduction step explicitly.
Index arithmetic converts multiplication problems into linear congruences. To compute when 3 has order 6: reduce the exponent 17 modulo 6 to 5, and read off from the power table. State the order reduction step explicitly.