Integers of the form $x^2+2y^2$.

I'm stuck in the following problem: prove an integer $n$ is of the form $x^2+2y^2$ if and only if every prime divisor $p$ of $n$ that is congruent to $5$ or $7\bmod8$ appears with an even exponent.

I think we have to do something similar to Fermat’s sum of two squares theorem. So far I have only managed to see that the product of two numbers of this form is a number of this form (this was seen via the Fibonacci Brahmagupta identity).

• The way I would go about it would be first to prove which primes are of the form $x^2 + 2y^2$. Such primes can be expressed as $p = (x - y \sqrt{-2})(x + y \sqrt{-2})$ and $\mathbb{Z}[\sqrt{-2}]$ is closed under multiplication. May 29, 2015 at 21:24
• @Bob A high score on this site does not necessarily mean the asker is well-versed in algebraic number theory. Still, I'm going to try to write an answer along the lines you suggest. May 30, 2015 at 3:42

If $x^2 + 2y^2 ≡ 0 \pmod p$ and $\left(\frac{−2}{p}\right) = −1$ implies that both $x, y \equiv 0 \pmod p$ and $x^2 + 2y^2 \equiv 0 \pmod {p^2}$ .

Here $\left(\frac{−2}{p}\right)$ is the Legendre symbol. Also note that $$\left(\frac{−2}{p}\right) = (-1)^{\frac{p^2 - 1}{8} + \frac{p - 1}{2}}.$$ From here you can conclude that $\left(\frac{−2}{p}\right) = −1$ if and only if $p$ is of the form $5$ or $7 \bmod 8$.

For the converse case see here.

• can somebody point out what is wrong with my answer? May 29, 2015 at 3:21
• neither answer is complete. Roughly speaking the parts are: when does $(-2|p)= 1?;$ then If $(-2|q) = -1,$ and $u^2 + 2 v^2 \equiv 0 \pmod q,$ then both $u,v \equiv 0 \pmod q;$ therefore the exponent of any such prime factor is even; If $(-2|p) = 1$ we can solve $r^2 + 2 s^2 = p;$ the product of two represented numbers is another represented number. That is most of it. The OP seems to have little of the necessary background. In case you were asking about downvotes, I don't do that. May 29, 2015 at 3:33
• @WillJagy but I have included the answer to when does $(-2|p)=1$ and also I have a given a link to the answer which shows that $(-2|p)=1$ implies we can solve $r^2+2s^2=p$. So am I missing something? May 29, 2015 at 3:41
• I didn't notice the link; neither here nor there. You asked what was wrong with your answer, I said what I thought a full answer should have. I have no idea why you asked in the first place. May 29, 2015 at 3:53
• @WillJagy thanks for your clarification I will keep that in mind while writing future answers I asked in the first place because I got a downvote with no explanation as to why I got it May 29, 2015 at 4:01

It suffices to show that every prime 1 or 3 mod 8 can be expressed in this form. Start by showing that a solution exists modulo $p$, then extend this to the integers by an application of Minkowski's Theorem.

• I think I still have to show it works for squares of primes that are $2,3$ or $5\bmod 8$ May 29, 2015 at 3:11
• Square of primes are fine, because you can just cancel out the number you squared and reduce to something square-free. May 29, 2015 at 3:13
• Thanks, I have no idea how I should use Minkowski's theorem May 29, 2015 at 3:25
• So you know you have a solution mod $p$, say $(x,y)$. Consider the lattice $(x,y)+p\mathbb Z^2$; compare the area of the fundamental domain to that of the ellipse $x^2+2y^2<2p$. The area is large enough, so by Minkowski's Theorem you get a lattice point in this ellipse, which gives you a solution to $x^2+2y^2=p$. May 29, 2015 at 3:33
• don't think this works because the determinant of the lattice is p^2 so I have to show the area of the elipse is at least 4p^2 which is clearly false May 29, 2015 at 13:27

The squares modulo 8 are 1, 4, 1, 0, 1, 4, 1, 0 and twice the squares modulo 8 are 2, 0, 2, 0, 2, 0, 2, 0. Therefore, $x^2 + 2y^2 \equiv 0, 1, 2, 3, 4$ or $6 \pmod 8$. So if a prime $p \equiv 5$ or $7 \pmod 8$ then it can't be of the form $x^2 + 2y^2$.

So far I have only used elementary methods, and maybe the rest of what I'm thinking can be accomplished without recourse to algebraic number theory. But since you tagged this question with that tag, I will go ahead and avail myself to the methods of algebraic number theory. I don't know how much you know about it, and I certainly can't claim to be an expert. Please bear me with me if I seem to be repeating basic facts you already know.

If $a$ and $b$ are integers in the usual sense, then $$(a - b\sqrt{-2})(a + b\sqrt{-2}) = a^2 + 2b^2.$$ Essentially we have computed the algebraic norm of $a \pm b\sqrt{-2}$, both of which are algebraic integers in the ring $\mathbb{Z}[\sqrt{-2}]$, and their product (this norm) is an integer in the usual sense (a whole, purely real rational number). All numbers in $\mathbb{Z}[\sqrt{-2}]$ are of the same form as $a \pm b\sqrt{-2}$, and the product of any numbers in this ring is also a number in this ring, which is another way of saying this ring is closed under multiplication.

Since $b$ can be 0, all purely real rational integers (notated $\mathbb{Z}$ or $\textbf{Z}$) are in this ring. But certain prime numbers from $\mathbb{Z}$ are "composite" in $\mathbb{Z}[\sqrt{-2}]$:

• $2 = (-1)(\sqrt{-2})^2$
• $3 = (1 - \sqrt{-2})(1 + \sqrt{-2})$
• $11 = (3 - \sqrt{-2})(3 + \sqrt{-2})$
• $17 = (3 - 2\sqrt{-2})(3 + 2\sqrt{-2})$
• $19 = (1 - 3\sqrt{-2})(1 + 3\sqrt{-2})$
• etc.

Obviously, numbers like 5 or 7, which are prime in $\mathbb{Z}$ are still prime in $\mathbb{Z}[\sqrt{-2}]$ (they are inert primes). These inert primes can't be expressed as $a^2 + 2b^2$.

But if $p \equiv 5$ or $7 \pmod 8$ and $\alpha$ is even, then $p^\alpha = (p^{\frac{\alpha}{2}})^2$. Assign $q = p^{\frac{\alpha}{2}}$. Then $p^\alpha = (q - 0\sqrt{-2})(q + 0\sqrt{-2})$. To satisfactorily solve the problem you still need to prove what happens when $\alpha$ is odd, but I'm confident you can figure this out for yourself.

I'd like to close with a couple of examples:

• $3 \times 5 = (1 - \sqrt{-2})(1 + \sqrt{-2})5$
• $3 \times 5^2 = (1 - \sqrt{-2})(1 + \sqrt{-2})5^2 = (5 - 5\sqrt{-2})(5 + 5\sqrt{-2}) = 5^2 + 2 \times 5^2 = 75.$