In this lecture, we will look at primitive roots of \(p^n\) where \(p\) is prime. In the previous lecture we showed that the only numbers with primitive roots are the numbers

$$ \begin{align*} 1,2,4,p^n, 2p^n \quad \text{where $p$ is an odd prime}. \end{align*} $$

We particularly showed that numbers that didn’t have this form couldn’t have primitive roots. We also showed that \(p^n\) and \(2p^n\) both have primitive roots when \(n\) is \(1\). So the only remaining case is to show that when \(p\) is odd and \(n > 1\), \(p^n\) has primitive roots. In this lecture, we will focus on this case.


Proof that \(p^2\) has a Primitive Root

We want to show that \(p^n\) has a primitive root. We know that since \(p\) is prime, then \(p\) must have a primitive root. So let \(g\) be a primitive root of \(p\). Since it’s a primitive a root, then the order of \(g\) is \(\phi(p)=p-1\). That is

$$ \begin{align*} g^{p-1} \equiv 1 \pmod{p} \end{align*} $$

We’re interested in the order of \(g \pmod{p^2}\). First, observe that \(\phi(p^2)=p(p-1)\).

Why? We know \(p\) is prime so \(p^2\) can only have \(p\) as a prime divisor. The non-coprime divisors are just multiples of \(p\). So \(p, 2 \cdot p, 3 \cdot p, \cdots, p \cdot p\). Therefore, there are exactly \(p\) numbers not coprime with \(p^2\). Then, \(\phi(p^2) = p^2 - p = p(p-1)\).

Now, suppose that the order of \(g \pmod{p^2}\) is \(d\). Then by definition we have

$$ \begin{align*} g^{d} \equiv 1 \pmod{p^2} \end{align*} $$

This implies that \(p^2 \mid g^d - 1\). Recall that if \(ab \mid m\), then \(a \mid m\) and \(b \mid m\). Therefore, \(p \mid g^d - 1\). That is

$$ \begin{align*} g^{d} \equiv 1 \pmod{p} \end{align*} $$

But we already know that the order of \(g \pmod{p}\) is exactly \(p-1\). Therefore, we must have that \(p-1 \mid d\). Moreover, we also know that \(\phi(p^2) = p(p-1)\). Then we can also conclude that \(d \mid p(p-1)\). So now we have the following two facts

  1. \(d \mid p(p-1)\)
  2. \(p-1 \mid d\)

From (2), we see that \(d\) must be a multiple of \(p-1\). From (1), it must either be \(p-1\) or \(p(p-1)\).
Now, if the order is \(p(p-1)\), then \(g\) is a primitive root of \(p^2\) and we are order. So suppose that the order is \(p-1\). That is

$$ \begin{align*} g^{p-1} \equiv 1 \pmod{p^2} \end{align*} $$

Now, consider \((g+p)^{p-1}\). We can expand this to see that

$$ \begin{align*} (g+p)^{p-1} &\equiv \sum_{k=0}^{p-1} \binom{p-1}{k} g^{p-1-k}p^k \\ &\equiv g^{p-1} + \binom{p-1}{1}g^{p-2}p + \binom{p-1}{2}g^{p-3}p^2 + \cdots \end{align*} $$

Any term that has \(p^2\) or greater will vanish modulo \(p^2\). So

$$ \begin{align*} (g+p)^{p-1} &\equiv g^{p-1} + (p-1)g^{p-2}p \pmod{p^2} \end{align*} $$

We know the order of \(g\) is \(p-1\). So \(g^{p-1} \equiv 1 \pmod{p^2}\). Therefore,

$$ \begin{align*} (g+p)^{p-1} &\equiv 1 + (p-1)g^{p-2}p \pmod{p^2} \end{align*} $$

Observe now that

$$ \begin{align*} (p-1)g^{p-2}p &\not\equiv 0 \pmod{p^2} \end{align*} $$

why? to have \([(p-1)g^{p-2}]p\) be divisible by \(p^2\), we need \((p-1)g^{p-2}\) to be divisible by \(p\). This can’t happen because

  1. \(p \not\mid p - 1\)
  2. \(g\) is a primitive root of \(p\). So \(g^1,g^2,\cdots,g^{p-1}\) all produce non-zero residue classes modulo \(p\). So \(g^{p-2} \not\equiv 0 \pmod{p}\)

Therefore,

$$ \begin{align*} (g+p)^{p-1} &\not\equiv 1 \pmod{p^2} \end{align*} $$

Then, \(g+p\) doesn’t have order \(p-1\). Therefore, it must have order \(p(p-1)\). This shows that either \(g\) is a primitive root modulo \(p^2\) or \(g+p\) is a primitive root modulo \(p^2\) (or both).


Higher Powers of \(p\)

So now what about when \(n \geq 3\)?. We notice that \(2^3\) has no primitive roots. So why does \(2\) behaves differently from all the odd primes? For this we have a theorem

If \(g\) is a primitive root modulo \(p^2\) and \(p\) is an odd prime, then \(g\) is a primitive root modulo \(p^n\) for \(n \geq 1\).

Proof

By induction on \(n\).
Base Case: when \(n = 1\), then this is true by the previous lecture.
Inductive Case: Suppose \(g\) is a primitive root of \(p^{n-1}\). We want to show that \(g\) is a primitive root modulo \(p^{n}\). Recall that \(\phi(p^2) = p(p-1)\). Then, \(\phi(p^{n-1}) = p^{n-2}(p-1)\). Since \(g\) is a primitive root modulo \(p^{n-1}\). Then we must have

$$ \begin{align*} g^{(p-1)p^{n-2}} \equiv 1 \pmod{p^{n-1}} \end{align*} $$

We can re-write this as

$$ \begin{align*} g^{(p-1)p^{n-2}} = 1 + tp^{n-1} \quad \text{ for some $t \in \mathbb{Z}$ } \end{align*} $$

Now, consider raising \(g^{(p-1)p^{n-2}}\) to the power \(p\) so,

$$ \begin{align*} (g^{(p-1)p^{n-2}})^p &= g^{(p-1)p^{n-1}} = (1 + tp^{n-1})^p \end{align*} $$

Then, we can expand \((1 + tp^{n-1})^p\) using the binomial theorem with

$$ \begin{align*} g^{(p-1)p^{n-1}} &= (1 + tp^{n-1})^p \\ &= 1 + \binom{p}{1} (tp^{n-1})^1 + \binom{p}{2} (tp^{n-1})^2 + \cdots + (tp^{n-1})^p \end{align*} $$

If we take this modulo \(p^n\), then any term with a higher power than \(p^n\) will vanish. (Note here that if \(p = 2\), then the third term doesn’t vanish! So that’s why the theorem doesn’t work for \(p=2\)) So we are left with

$$ \begin{align*} g^{(p-1)p^{n-1}} &\equiv 1 + tp^n \pmod{p^n} \end{align*} $$

If \(t\) is divisible by \(p\), then

$$ \begin{align*} g^{(p-1)p^{n-1}} \equiv 1 \pmod{p^n} \end{align*} $$

This implies that \(p^n \mid g^{(p-1)p^{n-1}} - 1\) but \(p^n = p\cdot p^{n-1}\) so \(p^{n-1}\) must also divide \(g^{(p-1)p^{n-1}} - 1\). That is

$$ \begin{align*} g^{(p-1)p^{n-1}} \equiv 1 \pmod{p^{n-1}} \end{align*} $$

But, by the induction hypothesis, we know that the order of \(g \pmod{p^{n-1}}\) is \((p-1)p^{n-2}\). This means that we must have

$$ \begin{align*} (p-1)p^{n-2} \mid (p-1)p^{n-1} \end{align*} $$

In general, if we let \(o_{p^n}(g)\) be the order of \(g \pmod p^n\) and if we let \(o_{p^{n-1}}(g)\) be the order of \(g \pmod{p^{n-1}}\), then we must have

$$ \begin{align*} o_{p^{n-1}}(g) \mid o_{p^{n}}(g) \end{align*} $$
Why? let \(m = o_{p^n}(g)\). We know by the previous argument that since \(g^m \equiv 1 \pmod{p^{n}}\), then we must also have that \(g^m \equiv 1 \pmod{p^{n-1}}\). But this also means that \(o_{p^{n-1}}(g)\) must divide \(m\) which is the order of \(g \pmod{p^{n}}\). Therefore, \(o_{p^{n-1}}(g) \mid o_{p^{n}}(g)\)

So now we have three facts

  1. \(o_{p^{n-1}}(g) \mid o_{p^{n}}(g)\)
  2. \(o_{p^{n-1}}(g) = (p-1)p^{n-2}\)
  3. \(o_{p^{n}}(g) \mid (p-1)p^{n-1} = p(p-1)p^{n-2}\)

From this \(o_{p^{n}}(g)\) is a multiple of \((p-1)p^{n-2}\) that also divides \(p(p-1)p^{n-2}\). So the only two possibilities for this order are:

  1. \(o_{p^{n}}(g) = (p-1)p^{n-2}\)
  2. Or \( o_{p^{n}}(g) = p(p-1)p^{n-2}\)

But then this forces the order to be \((p-1)p^{n-2}\) in this case (WHY?). The second case is when \(p \mid t\). Here we see that the order must be \((p-1)p^{n-1}\). Therefore, \(g\) is a primitive root of \(p^n\). [TODO … complete the proof]


Example

Find primitive roots of \(3^7\).

We in the previous lecture that

$$ \begin{align*} 2^2 \equiv 1 \pmod{3} \end{align*} $$

Which means that \(2 = -1 \pmod{3}\) is a primitive root of \(3\). But \(-1\) isn’t a primitive root of \(3^2\). So this means that \(-1 + 3 = 2\) is a primitive root of \(3^2\). So \(2\) is a primitive modulo \(3^7\).


Summary

So let’s summarize what we did so far. The following is equivalent.

  1. \(m\) has a primitive root.
  2. \(m\) has \(\varphi(\varphi(m))\) primitive roots.
  3. \(m = 1,2,4,p^n,2p^n\) where \(p\) is an odd prime.
  4. \(x^2 \equiv 1 \pmod{m}\) implies that \(x \equiv \pm 1 \pmod{m}\). That is we have two solutions only.
  5. Wilson's theorems holds. So \(\prod_{a \pmod{m}, (a,m)=1} a \equiv -1 \pmod{m}\)

Primitive Roots of \(2^n\)

[TODO]

NEW LECTURE

Lecture 25: Quadratic Equations modulo (p).

We looked at linear congruences and now we want to look at congruences of the form

$$ \begin{align*} ax^2 + bx + c \equiv 0 \pmod{p} \end{align*} $$

If we complete the square then we get

$$ \begin{align*} a(x + b/2)^2 \equiv \frac{b^2 - 4ac}{4a} \pmod{p} \end{align*} $$

References