TITLE: Sum of two squares modulo p
QUESTION [21 upvotes]: I have heard somewhere that for all primes $p$, for all $k$, there exist $x, y$ s.t. $x^2 + y^2\equiv k \pmod{p}$? I recall that the proof is very elementary, but I can't remember such a proof. How would one prove this? One way is to use Cauchy-Davenport, but I don't think that this is the simplest solution.

REPLY [5 votes]: A somewhat circular but funny proof:
Clearly $0=0^2+0^2$. For any $a$ between $1$ and $p$ we can find a prime congruent to $a\bmod p$ and $1\bmod 4$ because of dirichlets theorem. This prime is expressible in the form $b^2+c^2$ because of Fermat's sum of two squares theorem.