If $p = 4k+3$ is a prime number (so $p = 7,11,19$ but not $p = 5,13$ or $p =15$) then there are numbers $a,b$ such that:
$$a^2 + b^2 + 1 \equiv 0 \mod p$$
For example $2^2 + 3^2 + 1 = 14 = 7 \times 2\equiv 0 \mod 7 $.
My reasoning was that in the finite field $\mathbb{F}_{p^2}$, $-1$ is always a perfect square
- if $p = 4k+1$ then $-1$ is a perfect square in $\mathbb{F}_p$
- if $p = 4k+3$ then $x^2 +1 $ is irreducible then always $\mathbb{F}_p[x]/(x^2+1) \simeq \mathbb{F}_{p^2}$
I remember this as $i = \sqrt{-1} \in \mathbb{F}_p$ if $p = 4k+1$ and $i = \sqrt{-1} \in \mathbb{F}_p^2$ if $p = 4k+3$
Then somehow I made the magical conclusion that we always had a solution for $z \overline{z} = -1$ with $z = a+bx$
$$z \overline{z} = (a+bx)(a-bx) = a^2 + b^2 = -1 $$
This does not logically follow, but I made a leap of intution. What is the correct logic here?
This is a variant of Fermat's theorem that $p = 4k+1$ can be written as the sum of two squares: $p = a^2 + b^2$ but that is not a congruence. That is an equality involving whole numbers $a,b \in \mathbb{Z}$.
I'm not sure how to modify/fix your construction, but for reference the "standard" argument is that since $p$ is prime, $-a^2$ and $b^2+1$ both run over $(p+1)/2$ distinct values for $a,b\in \mathbb{F}_p$, and so must agree on at least one value.
Notice that this works for any (odd) prime, not just those of the form $4k+3$, but that in the case $p\equiv 1 \bmod 4$ you can additionally take $a=0$.