# If $a$ and $-a$ are both quadratic residues mod an odd prime $p$, then $p \equiv 1\pmod4$

If $a$ and $-a$ are both quadratic residues modulo an odd prime $p$, for $a \in \mathbb{Z}$ and $p\ \not\mid\ a$, then $p \equiv 1\pmod{4}$.

My guess is that was true and my reasoning was that with$$\left(\frac{a}{b}\right) \equiv a^{\frac{p-1}{2}} \equiv 1 \pmod{p},\quad \left(\frac{-a}{b}\right) \equiv (-a)^{\frac{p-1}{2}} \equiv 1 \pmod{p}$$ both satisfied, we must have $p \equiv 1\pmod{4}$, but I am not too sure about this reasoning.

Would appreciate help!

• What the heck is $b$? – fleablood Mar 24 '18 at 6:14

Just note that $1 \equiv (-a)^{\frac{p-1}{2}} \equiv (-1)^{\frac{p-1}{2}} a^{\frac{p-1}{2}} \equiv (-1)^{\frac{p-1}{2}} \bmod p$.