I need help with this question : Prove that for each prime number p there exist $a,b \in Z$ such that $-1\equiv a^{2}+b^{2}\pmod p $
When $p\equiv1\pmod4$ it is easy because -1 is a quadratic residue, I got stuck when $p\equiv3\pmod4$
I need help with this question : Prove that for each prime number p there exist $a,b \in Z$ such that $-1\equiv a^{2}+b^{2}\pmod p $
When $p\equiv1\pmod4$ it is easy because -1 is a quadratic residue, I got stuck when $p\equiv3\pmod4$
Hint: suppose for the sake of contradiction that $-1-a^2$ is not a quadratic residue mod $p$, for any $a \in \{0, 1, 2, \ldots, p-1\}$. Then count how many quadratic nonresidues you get as a result. Use the fact that $x^2 \equiv y^2 \mod p$ if and only if $x \equiv \pm y \mod p$.
If $p\equiv 3\pmod 4$, in the sequence $\{2p-1, 6p-1, 10p-1,\ldots,4np+2p-1,\ldots\}$ there are infinitely many primes (Dirichlet's theorem) and all of them are $\equiv 1\pmod 4$.
Let $q$ be any prime from this sequence. Since $q\equiv 1\pmod 4$, there exists $a$ and $b$ such that $q=a^2+b^2$. Therefore $$a^2+b^2\equiv q\equiv 4np+2p-1\equiv -1\pmod p$$