It can be proven that every prime $p\equiv1,3\mod{8}$ can be written in the form $a^2+2b^2$. Is it true that this representation is unique? This is certainly true for primes written in the form $a^2+b^2$ $($this is well known$)$, but I was wondering if this could be generalized.
-
It's not true neither for primes written in the form $a^2 + b^2$, why are you saying that it is well known? – Crostul Nov 12 '14 at 23:27
-
1@Crostul: I think the intended claim is that primes which can be written in the form $x^2+y^2$ can be written in that form uniquely. – Charles Nov 13 '14 at 00:37
4 Answers
We can give an elementary proof too, similar to the one for primes of the form $a^2+b^2$, based on Euler's Factorization Method. It seems that the 2009 article by John Brillhart (see Will Jagy's answer, preview here) has generalized this even further.
Suppose we have an odd prime $p=a^2+2b^2=c^2+2d^2$ with $a,b,c,d>0$ and $a\neq c$. Let $x=\frac{a+c}2$ and $y=\frac{b+d}2$. (Some modular arithmetic shows that $x,y\in\mathbb N$.) Factorizing gives
$$\left(\frac{a+c}{b+d}=\right)\quad\frac xy=2\frac{y-b}{x-c}\quad\left(=2\frac{d-b}{a-c}\right).$$
Let $x=pr$, $y=qr$ with $\gcd(p,q)=1$. Let $y-b=us$, $x-c=vs$ with $\gcd(y-b,x-c)=1$. ($u$ and $v$ can be negative.) We have
$\frac pq=\frac{2u}v$. There are two cases to consider:
Case 1. $v$ is even. Say $v=2w$. Then $u=p$, $v=2w=2q$. We have $a=x+(x-c)=pr+2qs$ and $b=y-(y-b)=qr-ps$. It follows that
$$p=a^2+2b^2=(pr+2qs)^2+2(qr-ps)^2=(p^2+2q^2)(r^2+2s^2)$$
(generalised Brahmagupta-Fibonacci identity), a contradiction because $q,s\neq0$.
Case 2. $v$ is odd. We have $2u=p$, $v=q$. Again, $a=x+(x-c)=2ur+qs$ and $b=y-(y-b)=qr-us$, hence $$p=a^2+2b^2=(2ur+qs)^2+2(qr-us)^2=(q^2+2u^2)(s^2+2r^2),$$ contradiction. $\square$
Note: If I'm not mistaking, the same argument works for any prime instead of $2$, i.e., if $p=a^2+nb^2$ and $n$ are primes, then $a,b$ are unique up to signs. When $n$ is composite things get ugly because of too much cases to consider (some of which presumably won't give a Brahmagupta-Fibonacci-like factorization). You can always try and see if this technique works for some small composite $n$ such as $6,10,14,15$; I don't know. Also note that for $n=1$ the proof is the same, but without casework.

- 26,355
-
Thanks! This is very enlightening! I will certainly investigate further (prime and composite) examples! :-) – Jef Nov 14 '14 at 08:34
It is true for $a^2 + b^2$ once you insist $a \leq b.$ From a short article by John Brillhart in the M.A.A. Monthly, December 2009, it is true for any $m x^2 + n y^2$ with positive $m,n$ TABLE OF CONTENTS

- 139,541
This is true, up to multiplication of $a$ or $b$ by $-1$. This follows from the fact that $\mathbb Q(\sqrt{-2})$ has class number $1$ and unit group $\pm 1$.

- 54,711
-
This is perfectly obvious and lucid to anyone who has studied algebraic number theory even as cursorily as I have. But I think it would be a mistake to assume this makes any sense to the asker, as his choice of tags suggests to me that he doesn't know what is the difference between elementary and algebraic number theory. – Bill Thomas Nov 14 '14 at 18:36
-
I agree, this answer is dense. It needs to be unpacked, but I don't think I have enough characters in a comment to do a proper unpacking. Maybe I'll post an algebraic-number-theoretic answer of my own... – Robert Soupe Nov 15 '14 at 04:51
Yes, it can be generalized, and the simplest way is through algebraic number theory, after acquiring certain background knowledge. With such knowledge, one might feel entitled to offhandedly toss off a dense, concentrated answer to your question:
Since $\mathbb{Z}[\sqrt{-2}]$ is a unique factorization domain with only two units (1 and $-1$), given an odd prime $p \in \mathbb{Z}^+$, the equation $x^2 + 2y^2 = p$ has exactly one solution in positive integers if $p$ splits in $\mathbb{Z}[\sqrt{-2}]$ and no solutions if it is inert.
But without the proper background, that sounds almost like nonsense. I will now attempt to unpack that in the hopes that it makes sense to someone with an understanding of elementary number theory and basic algebra, and perhaps pique their interest in algebraic number theory. But this unpacking is of course no substitute for careful study with a good book on algebraic number theory.
It is obvious that $(-x)^2 = x^2$. If $\{x, y\}$ is a solution to $x^2 + 2y^2 = p$, then clearly so are $\{-x, y\}, \{x, -y\}, \{-x, -y\}$. These are technically different, yet it feels like cheating to consider them distinct, since all we are doing is multiplying one or both of $\{x, y\}$ by $-1$ (which is considered a "unit"). To make things a little more formal, let's agree on this requirement: given solutions $\{x_1, y_1\}, \{x_2, y_2\}$, we consider them distinct if and only if $|x_1| \neq |x_2|$ and likewise for $y_1$ and $y_2$.
Suppose for a moment that there can be multiple distinct solutions in positive integers for $x^2 + 2y^2 = p$. The complete set of such solutions is still finite, for in fact $1 \leq x < \sqrt{p}$ and $1 \leq y < \sqrt{\frac{p}{2}}$. For example, for $p = 19$, $x$ can be at most 4 and $y$ at most 3, and in fact the only solution is $x = 1$, $y = 3$.
Now let us turn our attention to numbers of the form $a + b \sqrt{-2}$, with $a \in \mathbb{Z}$ and likewise $b$. We're getting here into the realm of complex numbers, which sound complicated but it turns out they often simplify things. For our purposes here, it is enough to accept that $(\sqrt{-2})^2 = -2$. These numbers form a domain usually notated $\mathbb{Z}[\sqrt{-2}]$ (though you may encounter different notations in older textbooks).
Applying a little basic algebra, verify that $(x - y \sqrt{-2})(x + y \sqrt{-2}) = x^2 + 2y^2$. For example, $(1 - 3 \sqrt{-2})(1 + 3 \sqrt{-2}) = 1^2 + 2 \times 3^2 = 19$. This concept, called the "norm," is what makes $\mathbb{Z}[\sqrt{-2}]$ relevant to your $x^2 + 2y^2 = p$ question.
One should not automatically assume that $\mathbb{Z}[\sqrt{-2}]$ is a unique factorization domain like $\mathbb{Z}$, but I don't want to make this excessively long. For now suffice it to say that the proof that $\mathbb{Z}[\sqrt{-2}]$ is in fact a unique factorization domain is very similar to the proof of the fundamental theorem of arithmetic with a few small but important adjustments. In $\mathbb{Z}$ we don't consider $(-1)^2 \times 19$ to be a distinct factorization of 19, because $-1$ is a unit. Likewise we don't consider $(-1 - 3 \sqrt{-2})(-1 + 3 \sqrt{-2})$ a distinct factorization of 19 in $\mathbb{Z}[\sqrt{-2}]$.
Another key fact is that there are only two units in $\mathbb{Z}[\sqrt{-2}]$. To prove this you only need to show that the equation $x^2 + 2y^2 = 1$ has only two solutions in integers (0 and negative integers allowed). Those solutions are 1 and $-1$ (this is true of almost all $\mathbb{Z}[\sqrt{d}]$ or $\mathcal{O}_{\mathbb{Q}[\sqrt{d}]}$ for which squarefree $d < 0$).
And now, to generalize. If $d = 1$, 2, 3, 7, 11, 19, 43, 67 or 163, then $\mathbb{Z}[\sqrt{-d}]$ or $\mathcal{O}_{\mathbb{Q}[\sqrt{-d}]}$ is a unique factorization domain and the equation $x^2 + dy^2 = p$ has only one solution in positive integers.
Maybe there are infinitely many positive $d$ which correspond to $\mathbb{Z}[\sqrt{d}]$ or $\mathcal{O}_{\mathbb{Q}[\sqrt{d}]}$ which are unique factorization domains. But that doesn't matter, because the equation $x^2 - dy^2 = p$ has either infinitely many solutions or no solutions at all, and that's because the equation $x^2 - dy^2 = \pm1$ has infinitely many solutions, meaning that there are infinitely many units which are powers of each other.
From a single solution we can obtain as many other solutions as we want by multiplying it by units. For example, solve $x^2 - 2y^2 = 7$. Working in $\mathbb{Z}[\sqrt{2}]$, we have $(3 - \sqrt{2})(3 + \sqrt{2}) = 3^2 - 2 \times 1^2 = 7$. The units in $\mathbb{Z}[\sqrt{2}]$ are of the form $(1 + \sqrt{2})^n$ with $n \in \mathbb{Z}$. Thus from $(3 - \sqrt{2})(1 - \sqrt{2})^n$ we can derive infinitely many other solutions, like $x = 13$, $y = 9$; $x = 75$, $y = 53$; etc. (I'm deliberately skipping over solutions to $x^2 - 2y^2 = -7$).

- 14,663