[Math] Show $p − a$ is a quadratic residue $\bmod p$ if $p ≡ 1 \pmod 4$ and a quadratic nonresidue $\bmod p$ if $p ≡ 3 \pmod 4$.

number theory

Let a be a quadratic residue mod p. Show that $p − a$ is a quadratic residue $\bmod p$ if $p ≡ 1 \pmod 4$ and a quadratic non-residue $mod p$ if $p ≡ 3 \pmod 4.$

I know that a theorem exists saying "if $p$ is an odd prime, then there are exactly $\frac{p-1}{2}$ quadratic residues $mod p$ and exactly $\frac{p-1}{2}$ non-residues $\bmod p$."

So I want to force $p$ to be the given congruences according to how many there are. And, I know $p$ can either be 1 or 3, right? (Am I on the right track?)

Best Answer

If $p$ is an odd prime, $-1$ is a quadratic residue iff $p\equiv 1\pmod{4}$, since $$\left(\frac{-1}{p}\right) \equiv (-1)^{\frac{p-1}{2}}\pmod{p}. $$

On the other hand the Legendre symbol is multiplicative, hence if $p$ is an odd prime and $a$ is a quadratic residue $\!\!\pmod{p}$ we have $$\left(\frac{p-a}{p}\right)=\left(\frac{-a}{p}\right)=\left(\frac{-1}{p}\right)\left(\frac{a}{p}\right)=\left(\frac{-1}{p}\right).$$