<s>[INST] How many different values can $(x^2 + y^2, x^2 + 2y^2 )$ have mod 4? It is known that if a prime number $p = x^2 + y^2 $ is equivalent to $p \equiv 1 \mod 4$.  This is Fermat's theorem on the sum of two squares.

My question is about the value of two simultaneous quadratic forms.  Consider the values:
$$ (x,y) \in \mathbb{Z}^2 \longrightarrow (x^2 + y^2 , x^2 + 2 \,y^2) $$
Invidually I can find the value of each coordinate modulo 4:


*

*$x^2 = 0, 1 \mod 4$ e.g. $0,1,4,9,16,25,\dots \equiv 0,1,0,1,0,1,\dots$

*$x^2 + y^2 = \{0 \text{ or } 1\} + \{0 \text{ or } 1\} = \{0,1 \text{ or } 2\}$ modulo $4$.

*$x^2 + y^2 = \{0 \text{ or } 1\} + 2\times\{0 \text{ or } 1\} = \{0,1,2 \text{ or } 3\}$ modulo $4$.
Then $x^2 + y^2$ can take any 3 out of the 4 possible values and $x^2 + 2y^2$ can take all possible values, so that $(x^2 + y^2 , x^2 + 2 \,y^2) $ can be one of $3 \times 4 = 12$ of $4^2 = 16$ possible values, but if we plot:


Only (0,0), (1,1), (1,2) and (2,3)... Why can't we get all $12$ possibilites?  

Similarly, we don't get all $11 \times 11 = 121$ possibilities mod $11$.
Question - what fraction of the $m^2$ possible values can we obtain mod $m$?  
As a function of $m$ the value do not fit into any OEIS sequence.
  1,   4,   4,   4,   9, 
 16,  16,   9,  16,  36, 
 36,  16,  49,  64,  36, 
 16,  81,  64, 100,  36, 
 64, 144, 144,  36, 121, 
196, 121,  64, 225

 [/INST] $x^2$ and $y^2$ modulo 4 can each only take on 2 values.  Thus, there can be at most four distinct combinations of those values, no matter how you arrange them.
Modulo 11, $x^2$ and $y^2$ can take on up to 6 distinct values, so you can have up to 36 possible combinations.
Note that if $(a,b)$ are independent variables, then so are $(a+b,b)$, and likewise $(a+b,a+2b)$.  Thus, since $x^2$ and $y^2$ are independent, so must also be $x^2+y^2,x^2+2y^2$.
Thus, all the combinations show up for any $m$.
For generic $m$, the number of possibilities is $f(m)^2$, where $f(m)$ is the number of distinct values that $x^2$ can take modulo $m$.  For odd primes, $f(m) = (m+1)/2$.
</s>