# Numbers representable as $x^2 + 2y^2$

I need to describe all numbers of the form $x^2 + 2y^2$.

So far I've reduced the problem to primes, and showed p=2 satisfies it. I've also shown that any primes mod 5 or 7 can't be a written in this form. How do I proceed to show that it holds for all primes mod 1 or 3? I think I'll need to use quadratic reciprocity somehow (only since it is the topic of the homework). I have a hunch the supplementary quadradic recprocity laws will be important.

Any help would be appreciated. Thanks!

-
It will not be very quick. You can easily identify the congruence classes which are not ruled out. But to show each of the non-forbidden primes is actually representable takes work. One can imitate Fermat's descent argument for $x^2+y^2$. More easily, one can imitate the standard Gaussian integers argument, this time using the fact that $\mathbb{Z}[\sqrt{-2}]$ is a Euclidean domain. – André Nicolas Nov 13 '12 at 1:29
@AndréNicolas I wonder if there's any version of the involutive argument available! – Steven Stadnicki Nov 13 '12 at 1:32
@AndréNicolas I'm not sure which arguments you refer to. For sure I havn't seen anything involving Gaussian integers. The proof I saw involving sums of squares used balanced congruency classes.. not sure if it was "Fermat's descent argument" or not – user45814 Nov 13 '12 at 1:59
Yes, it was a version of the Fermat argument. – André Nicolas Nov 13 '12 at 2:08
@AndréNicolas, I put the reduced form argument as an answer. Note that Keith felt this is not geometry of numbers, see math.stackexchange.com/questions/231769/… – Will Jagy Nov 13 '12 at 5:11

We have an odd prime with $(-2|p)= 1.$ That is, we can solve $w^2 \equiv -2 \pmod p.$ So now we have $w^2 = -2 + p t.$ Which looks more impressive as $$p t - w^2 = 2.$$ Or $$\det \; \left( \begin{array}{cc} p & w \\ w & t \end{array} \right) \; = \; 2$$ We have constructed the positive binary quadratic form $f(x,y) = p x^2 + 2 w x y + t y^2,$ or in shorthand $\langle p, 2 w, t \rangle.$

Now, any positive binary quadratic form can be reduced in the sense of Gauss. That is, a replacement form can be produced, call it $\langle a, 2 b, c \rangle,$ with the same determinant $ac-b^2 = 2$ and $0 \leq |2b| \leq a \leq c,$ also $a > 0$ and $2b \neq -a.$ It is not difficult to show by inequalities that the only such reduced form is actually $\langle 1,0,2 \rangle.$ This property is called "class number one."

See REDUCTION DEMO.

Now, what is this about reduction? It means we can find an integral matrix of determinant $1,$ call it $$P = \left( \begin{array}{cc} \alpha & \beta \\ \gamma & \delta \end{array} \right)$$ with transpose $$P^T = \left( \begin{array}{cc} \alpha & \gamma \\ \beta & \delta \end{array} \right),$$ such that $$\left( \begin{array}{cc} \alpha & \gamma \\ \beta & \delta \end{array} \right) \left( \begin{array}{cc} p & w \\ w & t \end{array} \right) \left( \begin{array}{cc} \alpha & \beta \\ \gamma & \delta \end{array} \right) \; = \; \left( \begin{array}{cc} 1 & 0 \\ 0 & 2 \end{array} \right).$$ So far, so good. As $P$ has determinant $1,$ it is easy to find its inverse, and we find $$\left( \begin{array}{cc} \delta & -\gamma \\ -\beta & \alpha \end{array} \right) \left( \begin{array}{cc} 1 & 0 \\ 0 & 2 \end{array} \right) \left( \begin{array}{cc} \delta & -\beta \\ -\gamma & \alpha \end{array} \right) \; = \; \left( \begin{array}{cc} p & w \\ w & t \end{array} \right).$$

Well. If you carefully multiply out the matrices, you see that $\delta^2 + 2 \gamma^2 = p.$ It's a good thing.

AFTERSHOCK: the situations where this argument works in its entirety are these: for a positive form $\langle a,b,c \rangle,$ where $b$ is allowed to be odd, we take the discriminant $\Delta = b^2 - 4 a c$ which is negative, and the same quantity as in the "quadratic formula." The argument works for primes with $\Delta \neq 0 \pmod p$ and $(\Delta | p) = 1,$ when, in addition, there is only one class per genus and we know the necessary congruence information on $p,$ or when there are exactly two classes per genus, and we are asking about a genus made up of a form and its opposite class, in symbols $\langle a,b,c \rangle$ and $\langle a,-b,c \rangle.$ For example, we can describe the primes represented by $3 x^2 + 2 x y + 5 y^2$ entirely by congruences, although doing that for $x^2 + 14 y^2$ or $2 x^2 + 7 y^2$ is a fair bit of Cox's book. Finally, I would like to emphasize that this works for indefinite forms, which are treated in Buell's book but not in Cox's. All that happens is that there are typically multiple reduced forms in a given equivalence class, that does not hurt the argument. I just saw a new question with indefinite, discriminant $5,$ but I'm not going to type all that.

-
great answer @Will Jagy. Interesting "AFTERSHOCK". My only question being, how do I know off the bat that any prime of the form $x^2+2y^2$ has -2 as a quadratic residue? I've seen results for odd primes with 2 as a quadratic residue, but not -2.. – user45814 Nov 13 '12 at 3:37
@user45814, what is $(-2|p)$ if $p \equiv 1,3 \pmod 8?$ What is $(-2|p)$ if $p \equiv 5,7 \pmod 8?$ – Will Jagy Nov 13 '12 at 4:08
@user45814, this is simple: if $x^2 + n y^2 \equiv 0 \pmod p$ and $(-n|p)= -1,$ then both $x,y \equiv 0 \pmod p$ and $x^2 + n y^2 \equiv 0 \pmod {p^2}$ and $x^2 + n y^2 \neq p.$ You should fill in the details. – Will Jagy Nov 13 '12 at 4:16
would have loved you as a proff. Thanks! – user45814 Nov 13 '12 at 4:25
I see your mention of David Cox's book, Primes of the Form $x^2 + ny^2$, but not a link to it. Excellent material, very readable and makes sense of the history of the subject. – hardmath Nov 14 '12 at 0:25