= Solution
For $p\equiv1\pmod4$, part (i) constructs a solution $a=q!$ to $a^2\equiv-1$. It is nonzero modulo $p$, so $a$ and $-a$ are distinct for odd $p$. Any other solution $x$ obeys
$$
(x-a)(x+a)=x^2-a^2\equiv0\pmod p.
$$
The <Euclid lemma> forces $x\equiv a$ or $-a$. Hence there are exactly two solutions. For $p\equiv3\pmod4$, a solution to $x^2\equiv-1$ would have $x^4\equiv1$, but part (ii) would imply $x^2\equiv1$, impossible because $p$ cannot divide two. Therefore
$$
\boxed{\#\{x\bmod p:x^2\equiv-1\}=\begin{cases}2,&p\equiv1\pmod4,\\0,&p\equiv3\pmod4.\end{cases}}
$$
These two cases exhaust all odd primes.
Back to article page