[Math] Number Theory: Prove that $x^{p-2}+\dots+x^2+x+1\equiv 0\pmod{p}$ has exactly $p-2$ solutions

elementary-number-theorymodular arithmeticpolynomialsprime numbersproof-verification

I just completed this homework problem, but I was wondering if my proof was correct:

If $p$ is an odd prime, then prove that the congruence $x^{p-2}+\dots+x^2+x+1\equiv 0\pmod{p}$ has exactly $p-2$ incongruent solutions, and they are the integers $2,3,\dots,p-1$.

Proof

Let $f(x)=x^{p-2}+\dots+x^2+x+1$ and $g(x)=(x-1)f(x)$.

Note that $f(1)=(p-2)+1=p-1\not\equiv 0\pmod{p}$.

So, $g(x)=(x-1)(x^{p-2}+\dots+x^2+x+1)=x^{p-1}-1$.

Now, $x^{p-1}-1\equiv 0\pmod{p}$ has exactly $p-1$ incongruent solutions modulo $p$ by Lagrange's Theorem.

Note that $g(1)=(1-1)f(1)=0\equiv 0\pmod{p}$, so $1$ is a root of $g(x)$ modulo $p$. Hence, the incongruent roots of $g(x)$ modulo $p$ are $1,2,3,\dots,p-1$.

But every root of $g(x)$ other than $1$ is also a root of $f(x)$ (This is the part I'm concerned about. Is it clear that this is the case?), hence $f(x)$ has exactly $p-2$ incongruent roots modulo $p$, which are $2,3,\dots,p-1$. $\blacksquare$

Best Answer

If $a \in Z_p \setminus \{0,1\}$ and $p$ is prime, then: $$1+a+a^2+\cdots +a^{p-2}=(a^{p-1} - 1)\cdot(a-1)^{-1} = 0,$$because $a^{p-1}=1$.

On the other hand, if $a=1$, then $$1 + a + a^2 + \cdots + a^{p-2} = \underbrace{1+1+ \cdots +1}_{p-1} =(p-1) \ne 0.$$

Finally if $a = 0$, $$1 + a + a^2 + \cdots + a^{p-2} = 1 \ne 0. $$

So the solutions are all $a \ne 0, 1$, which are $p-2$ values.

Related Question