$x^2 ≡ -a^2 (\mod p)$ if and only if $ p ≡ 1 (\mod 4)$

1.3k Views Asked by At

I need help proving the following:

Let p be an odd prime and a be any integer which is not congruent to 0 modulo p. Prove that the congruence $x^2 ≡ -a^2 (\mod p)$ has solutions if and only if $p ≡ 1 (\mod 4)$.

I am not really sure where to start.

Thanks in advance!

2

There are 2 best solutions below

3
On BEST ANSWER

Well, since you know what I asked in the comments, then

$$x^2=-a^2\pmod p\stackrel{\text{divide in both sides by}\;a}\iff \left(\frac xa\right)^2=-1\pmod p$$

and now complete the argument. (In the above, we certainly assume $\;a\neq0\pmod p\;$, as given... ptherwise it is trivial)

2
On

If you know about the Legendre symbol, here is a simple proof :

Notice that $$ \bigg( \frac{-a^2}{p} \bigg) = \bigg( \frac{-1}{p} \bigg) \bigg( \frac{a^2}{p} \bigg) = \bigg( \frac{-1}{p} \bigg) \cdot 1$$ (since $a^2$ is always a quadratic residue) and that in fact the latter is equal to $1$ if and only if $$\bigg( \frac{-1}{p} \bigg) = 1$$ and this happens if and only if $p\equiv 1 \pmod{4}$.

So, the congruence $x^2 \equiv -a^2 \pmod{p}$ has a solution if and only if $p\equiv 1 \pmod{4}$. $\blacksquare$