Prove that $p$ is a primitive root of $q$ if and only if $\frac{x^q-1}{x-1}$ is an irreducible polynomial on $\mathbb{F}_p$ Let $p,q$ be two odd primes. Prove that $p$ is a primitive root of $q$ if and only if $\frac{x^q-1}{x-1}$ is an irreducible polynomial on $\mathbb{F}_p$
This is a middle school competition, I want to have pure competition method, here is an advanced method, I do not seem to understand, there is no simpler content to deal with this problem  links
Second, does this seem to be a famous result?
PS:Middle school=High school
 A: Here is a "fake" elementary proof, as it is essentially a translation of some results on finite fields (as will any answer probably be). A "real proof" is attached at the end.

The "fake" proof.
Let $f(x) \in \Bbb F_p[x]$ be any irreducible factor of $\frac{x^q - 1}{x - 1}$. We prove two preparatory results.

*

*$\prod_{i = 0}^{q - 1}(x - t^i) \equiv x^q - 1\mod f(t)$ in $\Bbb F_p[x, t]$.


Consider the polynomial $H(x, t) = x^q - 1 - \prod_{i = 0}^{q - 1}(x - t^i) \in \Bbb Z[x, t]$.
Write $\zeta = e^{\frac{2\pi i}q} \in \Bbb C$. We have $H(x, \zeta^i) = 0$ for all $0 \leq i < q$, which implies that $t^q - 1 \mid H(x, t)$ (as polynomials over $\Bbb Z$, by Euclidean division). After mod $p$, we get the result we want.



*For $i \not\equiv j \mod q$, we have $t^i \not\equiv t^j \mod f(t)$ in $\Bbb F_p[x, t]$.


In 1, We take formal derivative with respect to $x$: $$f(t) \mid qx^{q - 1} - \sum_{i = 0}^{q - 1}\prod_{j \neq i}(x - t^j) =: D(x, t).$$
If there existed $i \neq j$ such that $t^i\equiv t^j \mod f(t)$, then every summand in the expression $D(t^i, t)$ would be divisible by $f(t)$, as it would have either the factor $(t^i - t^i)$ or the factor $(t^i - t^j)$.
Consequently, we would have $f(t) \mid qt^{i(q - 1)}$. As $f(t)$ is irreducible, this leads to $f(t) = t$, which is impossible.


First assume that $p^r \equiv 1\mod q$ for some $r < q - 1$. We want to show that $\frac{x^q - 1}{x - 1}$ is reducible over $\Bbb F_p$.
For every nonnegative integer $d$, we consider the polynomial $G_d(x, t) = \prod_{i = 0}^{r - 1} (x - t^{dp^i}) \in \Bbb F_p[x, t]$.
I claim that there exists a polynomial $g_d(x) \in \Bbb F_p[x]$ such that $G_d(x, t) \equiv g_d(x) \mod f(t)$.

Note that $q \mid p^r - 1$ implies that $t^{dp^r}\equiv t^d \mod f(t)$. Consequently, $G_d(x, t^p) = \prod_{i = 1}^r(x - t^{dp^i}) \equiv G_d(x, t)\mod f(t)$.
On the other hand, if we write $G_d(x, t) = \sum_{i = 0}^r a_i(t)x^i$ with polynomials $a_i(t) \in \Bbb F_p[t]$, then we have $$G_d(x, t^p) = \sum_{i = 0}^r a_i(t^p) x^i = \sum_{i = 0}^r a_i(t)^p x^i$$ and hence $a_i(t)^p \equiv a_i(t) \mod f(t)$.
This can be rewritten as $\prod_{s \in \Bbb F_p}(a_i(t) - s) \equiv 0 \mod f(t)$. Since $f$ is irreducible, there exists $s_i \in \Bbb F_p$ such that $a_i(t) - s_i \equiv 0\mod f(t)$.
Putting $g_d(x) = \sum_{i = 0}^rs_i x^i$ gives us $G_d(x, t) \equiv g_d(x) \mod f(t)$.

We note that in the definition of $G_d(x, t)$, we may replace $dp^i$ with any integer that is congruent to $dp^i$ mod $q$, because $t^q \equiv 1\mod f(t)$.
We may partition all the nonzero residue classes mod $q$ into subsets of the form $S_d = \{d, dp, \dots, dp^{r - 1}\} \subseteq \Bbb F_q^\times$, say $\Bbb F_q^\times = \bigsqcup_{j = 1}^n S_{d_j}$, with $n = \frac{q - 1}r > 1$. It follows that $$\prod_{j = 1}^n g_{d_j}(x) \equiv \prod_{j = 1}^nG_{d_j}(x, t)\equiv \prod_{i = 1}^{q - 1} (x - t^i) \mod f(t).$$
Since $p, q$ are different, $x - 1$ must be prime to $f$ and hence $\prod_{i = 1}^{q - 1}(x - t^i)\equiv \frac{x^q - 1}{x - 1} \mod f(t)$.
It follows that $\prod_{j = 1}^n g_{d_i}(x) \equiv \frac{x^q - 1}{x - 1}\mod f(t)$. As both sides don't involve $t$, it is in fact an equality in $\Bbb F_p[x]$, and we have shown that $\frac{x^q - 1}{x - 1}$ is reducible.

Now assume that $p$ is a primitive root mod $q$. We want to show that $\frac{x^q - 1}{x - 1}$ is irreducible.
Write $t_i = t^{p^i}$. Since $p$ is a primitive root, we have $p^i \not \equiv p^j \mod q$ for any $0 \leq i < j < q - 1$, which implies $t_i \not \equiv t_j \mod f(t)$ for such $i, j$.
We prove by induction on $k$ that, for each $0 \leq k \leq q - 1$, there exists $f_k(x, t) \in \Bbb F_p[x, t]$ such that $f(x) \equiv f_k(x, t)\prod_{i = 0}^{k - 1}(x - t_i) \mod f(t)$.

For $k = 0$, simply take $f_0(x, t) = f(x)$. Assume it's true for $k$ ($k < q - 1$) and we want to prove it for $k + 1$.
We have $f(x) \equiv f_k(x, t)\prod_{i = 0}^{k - 1}(x - t_i) \mod f(t)$. Putting $x = t_k$ gives $f(t) \mid f_k(t_k, t)\prod_{i = 0}^{k - 1}(t_k - t_i)$, because $f(t_k) = f(t)^{p^k}$.
Since $f(t)$ is irreducible and $t_k - t_i$ is not divisible by $f(t)$, we see that $f(t) \mid f_k(t_k, t)$.
Therefore, choosing $f_{k + 1}(x, t) = \frac{f_k(x, t) - f_k(t_k, t)}{x - t_k}$ (which is a polynomial) will give $f_k(x, t) \equiv f_{k + 1}(x, t)(x - t_k) \mod f(t)$ and hence the willing property.

In particular, for $k = q - 1$, we get $f(x) \equiv f_{q - 1}(x, t) \prod_{i = 0}^{q - 2}(x - t_i) \mod f(t)$.
However, when $i$ runs through $0$ to $q - 2$, the residue class of $p^i$ runs through the whole $\Bbb F_q^\times$, as $p$ is a primitive root.
Therefore $\prod_{i = 0}^{q - 2}(x - t_i) \equiv \prod_{i = 1}^{q - 1}(x - t^i) \equiv \frac{x^q - 1}{x - 1} \mod f(t)$.
It follows that the degree of $f(x)$ is at least $q - 1$, and hence $f = \frac{x^q - 1}{x - 1}$ is irreducible.

If we write $f_{q - 1}(x, t) = \sum b_i(t)x^i$ and let $d$ denote the largest integer such that $f(t) \nmid b_d(t)$, then the coefficient of $x^{d + q - 1}$ in the product $f_{q - 1}(x, t)\cdot \frac{x^q - 1}{x - 1}$ is not divisible by $f(t)$. This forces $\deg f \geq q - 1$.


The real proof.
The only non-elementary thing I use is that there are $q$ different $q$-th roots of unity in some extension field of $\Bbb F_p$.
Let $\zeta$ be one such root of unity, i.e. a root of $\frac{x^q - 1}{x - 1}$ in some extension of $\Bbb F_p$.
First suppose that $p^r \equiv 1\mod q$ for some $r < q - 1$. We form the polynomial $g = \prod_{i = 0}^{r - 1}(x - \zeta^{p^i})$ and notice that it is invariant under the Frobenius, hence is indeed a polynomial in $\Bbb F_p[x]$. Meanwhile it's clear that it is a divisor of $\frac{x^q - 1}{x - 1}$.
Next suppose that $p$ is a primitive root mod $q$. Let $f$ be any factor of $\frac{x^q - 1}{x - 1}$ and suppose without loss of generality that $\zeta$ is a root of $f$.
Applying Frobenius, we see that $\zeta^{p^i}$ is a root of $f$ for every $i$. As $i$ ranges through all integers, the residue class of $p^i$ ranges through all $\Bbb F_q^\times$ and we conclude that $\zeta^i$ for $1 \leq i \leq q - 1$ are all roots of $f$, hence $f = \frac{x^q - 1}{x - 1}$ is irreducible.
A: Just rewrite the solutions above in a simplr way (
This is immediate via considering the corresponding field extensions:
Recall that the multiplicative group of any finite field $\mathbb{F}_{p^k}$ is cyclic (of order $p^k-1$).
In particular, there exists an element of order $q$ in $\mathbb{F}_{p^k}$ iff $q \mid p^k-1$.
Now first suppose that $p$ is not a primitive root modulo $q$. Then $p$ has multiplicative order $k<q-1$ modulo $q$ i.e. $q \mid p^k-1$.
But as explained above, this means that $\mathbb{F}_{p^k}$ has an element of order $q$ i.e. a root $\alpha$ of $\frac{x^q-1}{x-1}=0$.
So the minimal polynomial of $\alpha$ divides $\frac{x^q-1}{x-1}$ but has degree $k<q-1$, hence $\frac{x^q-1}{x-1}$ is not irreducible.
Conversely, suppose that $\frac{x^q-1}{x-1}$ is reducible and hence has some irreducible factor of degree $k<q-1$. Adjoining a root of this polynomial to $\mathbb{F}_p$ we get the field $\mathbb{F}_{p^k}$ in which $\frac{x^q-1}{x-1}$ has a root $\alpha$. But then $\alpha$ has order dividing $q$, hence order either $1$ or $q$. If $\alpha=1$, then $p=q$. If $\alpha$ has order $q$, then $q \mid p^k-1$. In any case, $p$ is not a primitive root modulo $q$.
