Three different numbers with x³=x mod p p is a prime greater than 2 and $a \in \mathbb{Z}_p$. Why are there exactly three solutions for a³ = a mod p?
Obviously 0 and 1 are both in $\mathbb{Z}$ and valid solutions, but that still means, there is one element (and only one) missing. I can't figure out which one and neither do I understand why there could not be more valid solutions. Any tips?
Unless otherwise stated, $a$ is any integer representative of an eponymous element of $\mathbb{Z}_p$.
$$\begin{align}
a^3\equiv a\pmod p
&amp;\Longleftrightarrow a^3-a\equiv0\pmod p\\
&amp;\Longleftrightarrow a\cdot(a^2-1)\equiv0\pmod p\\
&amp;\Longleftrightarrow a\cdot(a-1)\cdot(a+1)\equiv0\pmod p\\
&amp;\Longleftrightarrow\begin{cases}
a\equiv0\pmod p&amp;\text{ or}\\
a-1\equiv0\pmod p&amp;\text{ or}\\
a+1\equiv0\pmod p
\end{cases}\end{align}$$
The last step uses that since $p$ is prime, if it divides the product of some integers [here: $a$, $a-1$, and $a+1$ ], then it must divide at least one of these integers. The reverse trivially holds without the hypothesis that $p$ is prime.

Since $p$ is greater than $2$, the three solutions $a\equiv0\pmod p$, $a\equiv1\pmod p$, $a\equiv p-1\pmod p$ are distinct elements of $\mathbb{Z}_p$.

Without the hypothesis that $p$ is prime, there can be additional solutions to $a^3\equiv a\pmod p$; for example, $a^3\equiv a\pmod{15}$ holds for nine out of fiteen elements $a$ of $\mathbb{Z}_{15}$.

Keep in mind that $x\equiv0\pmod p$ means exactly the same as: $p$ divides $x$.

Thanks to CGFoX for having corrected the $a\cdot(a^2-1)$ expression.