# Parametrization of $a^2+b^2+c^2=2d^2$

Is a complete parametrization of primitive solutions to the equation $$a^2+b^2+c^2=2d^2\qquad a,b,c,d \in \mathbb{Z}$$ known? A reference would be great.

Solutions to $a^2+b^2=c^2$ give solutions to the equation above, but I know that there are other solutions.

Alright, this is from Jones and Pall (1939), I have a pdf if you wish to investigate.

Find all ways to write $$m = t^2 + u^2 + 2 v^2 + 2 w^2,$$ with $m$ odd. There is no reason to consider even $m$ for this problem. Using material from pages 174-177, all primitive solutions of $$2 m^2 = x^2 + y^2 + z^2$$ can then be written, up to order and signs, as $$x = 4 tw+ 4 uv,$$ $$y = t^2 - 2tu -u^2 +2v^2 +4vw - 2 w^2,$$ $$z = t^2 + 2tu -u^2 +2v^2 -4vw - 2 w^2.$$ Since $m$ is odd, $2m^2 \equiv 2 \pmod 8,$ two out of three of $x,y,z$ must be odd, the other divisible by $4.$

Those below are primitive, that is $\gcd(x,y,z) = 1.$ In order to get all possible solutions, take a quadruple $(m;x,y,z)$ and multiply all four by any constant you like.

  m      x      y      z
1      0      1      1        t : 1  u : 0  v : 0  w : 0
3      4      1      1        t : 1  u : 0  v : 0  w : 1
5      0      7      1        t : 2  u : 1  v : 0  w : 0
5      4      5      3        t : 1  u : 0  v : 1  w : 1
7      4      9      1        t : 2  u : 1  v : 1  w : 0
7      8      5      3        t : 2  u : 1  v : 0  w : 1
9      4     11      5        t : 2  u : 1  v : 1  w : -1
9      8      7      7        t : 1  u : 0  v : 0  w : 2
11     12      7      7        t : 3  u : 0  v : 0  w : 1
11      4     15      1        t : 1  u : 0  v : 2  w : 1
11      8     13      3        t : 1  u : 0  v : 1  w : 2
13      0     17      7        t : 3  u : 2  v : 0  w : 0
13     12     13      5        t : 3  u : 0  v : 1  w : 1
13     16      9      1        t : 2  u : 1  v : 0  w : 2
13      8     15      7        t : 2  u : 1  v : 2  w : 0
15     16     13      5        t : 2  u : 1  v : 2  w : 1
15     20      7      1        t : 2  u : 1  v : 1  w : 2
15      8     19      5        t : 3  u : 2  v : 1  w : 0
17      0     23      7        t : 4  u : 1  v : 0  w : 0
17     20     13      3        t : 3  u : 2  v : 1  w : 1
17     24      1      1        t : 3  u : 0  v : 0  w : 2
17      4     21     11        t : 3  u : 2  v : 1  w : -1
17      8     17     15        t : 1  u : 0  v : 2  w : 2
19     12     17     17        t : 1  u : 0  v : 0  w : 3
19     12     23      7        t : 3  u : 0  v : 2  w : 1
19     16     21      5        t : 4  u : 1  v : 0  w : 1
19     24     11      5        t : 3  u : 0  v : 1  w : 2
19      4     25      9        t : 4  u : 1  v : 1  w : 0
21     16     25      1        t : 3  u : 2  v : 2  w : 0
21     20     19     11        t : 4  u : 1  v : 1  w : 1
21      4     29      5        t : 1  u : 0  v : 3  w : 1
21      8     23     17        t : 2  u : 1  v : 2  w : -2
23     12     25     17        t : 2  u : 1  v : 3  w : 0
23     16     21     19        t : 3  u : 2  v : 1  w : -2
23     24     19     11        t : 2  u : 1  v : 0  w : 3
23     28     15      7        t : 3  u : 2  v : 2  w : 1
23     32      5      3        t : 3  u : 2  v : 1  w : 2
23      4     31      9        t : 3  u : 2  v : 2  w : -1
25      0     31     17        t : 4  u : 3  v : 0  w : 0
25     20     27     11        t : 2  u : 1  v : 3  w : 1
25     20     29      3        t : 2  u : 1  v : 1  w : -3
25     24     25      7        t : 3  u : 0  v : 2  w : 2
25     28     21      5        t : 2  u : 1  v : 1  w : 3
25     32     15      1        t : 4  u : 1  v : 0  w : 2
25      4     35      3        t : 2  u : 1  v : 3  w : -1
25      8     31     15        t : 4  u : 1  v : 2  w : 0
m      x      y      z


Note how very similar this is to

Look for a single rational solution to $x^2+y^2+z^2=2$. Say, $(x_0,y_0,z_0)=(-1,0,1)$.

Then take any three integers $(u,v,w)$ and seek solutions of form $(-1+tu,tv,1+tw)$. You get:

$$1-2tu+t^2u^2 + t^2v^2 + 1+2tw + t^2w^2=2$$

solving, excluding $t=0$, you get:

$$t=\frac{2(u-w)}{u^2+v^2+w^2}$$

Substituting that bach in, we get:

\begin{align} x&=-1+tu = \frac{-(u^2+v^2+w^2)+2(u-w)u}{u^2+v^2+w^2}&=&\frac{u^2-2uw-v^2-w^2}{u^2+v^2+w^2}\\ y&=tv &=& \frac{2(u-w)v}{u^2+v^2+w^2}\\ z&=1+tw &=&\frac{u^2+v^2-w^2 +2uw}{u^2+v^2+w^2} \end{align}

Then $$(a,b,c,d)=(u^2-2uw-v^2-w^2,2(u-w)v,u^2+v^2-w^2+2uw,u^2+v^2+w^2)\tag{1}$$

When $w=0$, this gives: $(a,b,c,d)=(u^2-v^2,2uv,u^2+v^2,u^2+v^2)$, which is the result you note that if $(a,b,c)$ is a Pythagorean triple then $(a,b,c,c)$ is a solution of your equation. (I had to pick the $(x_0,y_0,z_0)$ carefully to make that work.

The formula (1) should yield all integer solutions, up to constant multiples.

To ensure a primitive solution, you need that $u+v+w$ is odd and that $u-w$ and $v^2+2u^2$ are relatively prime. That is equivalent to $\gcd(2(u-w),u^2+v^2+w^2)=1$, which is saying that $t$ above is in lowest common denominator form.

As Will noted in comments, this doesn't give all primitive solutions directly, since:

$$9^2+4^2+1^2=2\cdot 7^2$$

is a solution, and there is no way to write $7$ as the sum of three squares.

Instead, we get: $21=4^2+2^2+1^2$, and we get a solution:

$$(27,12,3,21)$$ from my formula, which is obviously not primitive.

• In $x=$ and then in $a=$ the sign of $2uw$ should be negative. Thank you! – vuur Oct 28 '15 at 13:48
• Fixed. You're welcome. – Thomas Andrews Oct 28 '15 at 13:51
• Given any rational homogeneous quadratic polynomial $p(x_1,\dots,x_n)$ if you can find one solution to $p(x_1,\dots,x_n)=C$ then you can use this approach to find all rational solutions. – Thomas Andrews Oct 28 '15 at 14:46
• right, in your (1), we cannot have $u^2 + v^2 + w^2 \equiv 7 \pmod 8,$ although we can have $d \equiv 7 \pmod 8.$ (9,4,1,7) – Will Jagy Oct 28 '15 at 18:16
• found parametrization similar to en.wikipedia.org/wiki/… I will check with a computer program later or tomorrow. – Will Jagy Oct 29 '15 at 1:24