Can we describe those prime numbers $p$ for which $p-1$ is a perfect square $\bmod p$.
For example, it is true for $p=2$ and $p=5$.
Can we describe those prime numbers $p$ for which $p-1$ is a perfect square $\bmod p$.
For example, it is true for $p=2$ and $p=5$.
$2$ works, so suppose $p$ is odd. If $a^2 \equiv -1 \pmod{p}$, then $a^4 \equiv 1 \pmod{p}$, so the order of $a$ mod $p$ divides $4$. Since $a \not \equiv 1$ and $a^2 \not \equiv 1$ (since $-1 \not \equiv 1$, since $p > 2$), we must have $ord_p(a) = 4$. Since $a^{p-1} \equiv 1 \pmod{p}$ (Fermat's little theorem), we must have $4 \mid p-1$, i.e., $p \equiv 1 \pmod{4}$.
Now suppose $p \equiv 1 \pmod{4}$. Then $x^4-1$ divides the polynomial $x^{p-1}-1$. Since $x^{p-1}-1$ has exactly $p-1$ roots in $\mathbb{Z}_p$, and since $\frac{x^{p-1}-1}{x^4-1}$ has at most $p-5$ roots (since $\frac{x^{p-1}-1}{x^4-1}$ has degree $p-5$), it must be that $x^4-1$ has exactly $4$ roots. Since $x^2-1$ has exactly $2$ roots, it must be that $x^2+1$ has exactly $2$ roots. So it in particular has a root, which is what we want.