# Show $a^2+b^2 \equiv 0 \mod p$ has no solutions except $a \equiv b \equiv 0 \mod p \Longleftrightarrow -1$ is a non-square modulo $p$.

I was looking at this question: Field in $\mathbb{F}_3$.

One of the answers states: "So you have to show that $a^2+b^2=0$ has no solutions modulo $7$ besides $a=0=b$ (modulo $7$, of course). Can you show this is equivalent to $−1$ being a nonsquare modulo $7$?"

How do we prove this statement? I tried showing in general:

Let $p$ be a prime. Then $a^2+b^2 \equiv 0 \mod p$ has no solutions except $a \equiv b \equiv 0 \mod p \Longleftrightarrow -1$ is a non-square modulo $p$.

$(\Rightarrow):$ Suppose that $a^2+b^2 \equiv 0 \mod p \Longleftrightarrow a \equiv b \equiv 0 \mod p$. If $-1$ is congruent to a square $\mod p$, then either $a$ or $b$ must be equal to $1$, but we assumed $a \equiv b \equiv 0 \mod p$ to be the only solution, so this can't be the case.

$(\Leftarrow):$ How do we show this direction?

• $(b^{-1} a)^2 \equiv -1 \pmod{p}$ – reuns Jan 11 '16 at 6:10

Prove the contrapositive: if $a^2+b^2\equiv0\pmod p$ does have solutions other than $a\equiv b\equiv 0$, then $-1$ is a square modulo $p$.
So, suppose $a^2+b^2\equiv0\pmod p$ where $a,b$ are not both $0$ modulo $p$. Without loss of generality suppose $b\not\equiv0$; then $b$ has a multiplicative inverse $c$ and we have $$(ac)^2+(bc)^2\equiv0\quad\Rightarrow\quad (ac)^2+1\equiv0$$ so $-1$ is congruent to $(ac)^2$ which is obviously a square.