When will a parametric solution generate all possible solutions?
I was looking for integer solutions to this equation: $$a^2+b^2+c^2=3d^2$$ And found a parametric solution. Given r, s, t: $$a=r^2+s^2-t^2+2t(r+s)$$ $$b=r^2-s^2+t^2+2s(t-r)$$ $$c=-r^2+s^2+t^2+2r(t-s)$$ $$d=r^2+s^2+t^2$$
My question is will this generate every possible solution?
ADDED: I found out how to prove this from one of my favorite papers, Jones and Pall (1939), the discussion of quaternions in manuscript pages 174-176. First, a "pure quaternion" $w$ means that the real part zero, so such a $w = w_1 i + w_2 j + w_3 k.$ "Proper" means the greatest common divisor of the coefficients is $1.$ If we have a pure quaternion $w$ with norm $Nw = 3,$ there is a unit $\theta$ such that either $\bar{\theta} w \theta = i + j + k$ or $\bar{\theta} w \theta = -(i + j + k).$
Next, suppose we have a proper pure quaternion $v$ with $Nv = 3 m^2,$ with odd positive integer $m.$ By Theorem 2 on page 175 we may define right divisor $q$ with $Nq = m,$ so $v = pq.$ Note $Np = 3m.$
Repeating Theorem 2, we may set $p = s r$ with $Ns = m.$ So far, $v = s r q.$
This is the cute part, from the proof of Theorem 3 on page 176. Since $v$ is pure, $\bar{v} = -v.$ However, $-v = \bar{v} = \bar{q} \bar{r} \bar{s}.$ That is, $\bar{q}$ is a left divisor of $-v$ and of $v.$ By theorem 2, there is a unit $\theta$ such that $$ s = \bar{q} \theta. $$
We have reached $$ v = \bar{q} \theta r q. $$ It follows that $\theta r$ is a pure quaternion of norm $3.$ There is a further unit $\omega$ such that $q = \omega p$ and $$ v = \pm \, \bar{p} \, (i+j+k) \, p. $$ Negating $v$ does not change its norm.
Saturday morning, 15 October 2016: I finally figured out how to get the computer to print each (ordered) quadruple just once. Take all $a \geq b \geq c \geq 0$ OR $a \leq b \leq c \leq 0.$ This is legitimate, my little proof above says the central element in the product is one of $\pm(i+j+k).$ This still gives two representations each, some $(w,x,y,z)$ and $(-w,-x,-y,-z),$ so I said to take the ordered quadruple (WLOG) with $w > 0$ or $w = 0, x > 0,$ or $w=0, x=0, y > 0,$ or $w = 0, x = 0, y = 0, z > 0.$ Very satisfying outcome.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
This is the right way to do this and get everything primitive. Take the quaternion $q = w + x i + y j + z k,$ so that $\bar{q} = w - x i - y j - z k.$ We get a "vector" or "pure quaternion," meaning a quaternion with real part zero, from $$ \bar{q} \, (i+j+k) \, q = ai + bj + ck. $$ It is automatic that $$ a^2 + b^2 + c^2 = 3 (w^2 + x^2 + y^2 + z^2)^2. $$ I will see if I can find a reference that proves that all possibilities with $\gcd(a,b,c) = 1$ occur this way. As you can see from the output, they are repeated in different orders and with different $\pm$ signs. I think I will leave in the zeros in the formulas for $a,b,c.$ They serve as spacers.
$$ a = w^2 + x^2 - y^2 - z^2 + 0 \, w x - 2 w y + 2 x y + 2 w z + 2 x z + 0 \, y z $$ $$ b = w^2 - x^2 + y^2 - z^2 + 2 w x - 0 \, w y + 2 x y - 2 w z + 0 \, x z + 2 y z$$ $$ c = w^2 - x^2 - y^2 + z^2 - 2 w x + 2 w y + 0 \, x y + 0 \, w z + 2 x z + 2 y z$$ $$ d = w^2 + x^2 + y^2 + z^2 $$
Sunday 16 October: all three indefinite forms $a,b,c$ are integrally equivalent, in $SL_4 \mathbb Z,$ to the diagonal form $$p^2 + q^2 - 3s^2 - 3 t^2$$ with Gram matrix $$ D = \left( \begin{array}{rrrr} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & -3 & 0 \\ 0 & 0 & 0 & -3 \end{array} \right) $$ Indeed, if $$ A = \left( \begin{array}{rrrr} 1 & 0 & -1 & 1 \\ 0 & 1 & 1 & 1 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{array} \right), \; \; \; \; A^T D A = \left( \begin{array}{rrrr} 1 & 0 & -1 & 1 \\ 0 & 1 & 1 & 1 \\ -1 & 1 & -1 & 0 \\ 1 & 1 & 0 & -1 \end{array} \right). $$ The rows of $A$ tell us that $$ a = (w - y + z)^2 + (x+y+z)^2 - 3 y^2 - 3 z^2, $$ compare $$ a = w^2 + x^2 - y^2 - z^2 + 0 \, w x - 2 w y + 2 x y + 2 w z + 2 x z + 0 \, y z. $$
If $$ B = \left( \begin{array}{rrrr} 1 & 1 & 0 & -1 \\ 0 & 1 & 1 & 1 \\ 0 & -1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{array} \right), \; \; \; \; B^T D B = \left( \begin{array}{rrrr} 1 & 1 & 0 & -1 \\ 1 & -1 & 1 & 0 \\ 0 & 1 & 1 & 1 \\ -1 & 0 & 1 & -1 \end{array} \right), $$ The rows of $B$ tell us that $$ b = (w +x - z)^2 + (x+y+z)^2 - 3 (-x)^2 - 3 z^2, $$ where the minus sign on the singleton $x$ has no effect other than $ \det B = 1.$ Compare $$ b = w^2 - x^2 + y^2 - z^2 + 2 w x - 0 \, w y + 2 x y - 2 w z + 0 \, x z + 2 y z.$$
If $$ C = \left( \begin{array}{rrrr} 1 & -1 & 1 & 0 \\ 0 & 1 & 1 & 1 \\ 0 & 0 & 1 & 0 \\ 0 & -1 & 0 & 0 \end{array} \right), \; \; \; \; C^T D C = \left( \begin{array}{rrrr} 1 & -1 & 1 & 0 \\ -1 & -1 & 0 & 1 \\ 1 & 0 & -1 & 1 \\ 0 & 1 & 1 & 1 \end{array} \right). $$ The rows of $C$ tell us that $$ c = (w - x + y)^2 + (x+y+z)^2 - 3 y^2 - 3 (-x)^2 $$ where the minus sign on the singleton $x$ has no effect except $\det C =1.$ Compare $$ c = w^2 - x^2 - y^2 + z^2 - 2 w x + 2 w y + 0 \, x y + 0 \, w z + 2 x z + 2 y z.$$
Your suggested solution seems pretty similar to the result of taking $w = 0,$ then negating $a,b,c,$ because mine have two minus signs remaining on the squares.
jagy@phobeusjunior:~$ ./Pythagorean_Quadruples 1 25 | sort -n
1 1 1 1 check 0 w x y z 1 0 0 0
3 -5 -1 -1 check 0 w x y z 0 1 -1 -1
5 -7 -5 -1 check 0 w x y z 0 1 0 -2
7 11 5 1 check 0 w x y z 1 2 1 1
9 11 11 1 check 0 w x y z 0 2 2 1
9 -13 -7 -5 check 0 w x y z 0 2 -1 -2
11 -13 -13 -5 check 0 w x y z 0 1 1 -3
11 17 7 5 check 0 w x y z 3 1 0 1
11 19 1 1 check 0 w x y z 3 0 -1 1
13 -17 -13 -7 check 0 w x y z 0 2 0 -3
13 19 11 5 check 0 w x y z 2 -2 -2 -1
15 19 17 5 check 0 w x y z 3 2 1 1
15 -23 -11 -5 check 0 w x y z 1 -1 3 -2
15 25 7 1 check 0 w x y z 1 -3 -2 -1
17 -23 -13 -13 check 0 w x y z 0 3 -2 -2
17 23 17 7 check 0 w x y z 4 0 -1 0
17 25 11 11 check 0 w x y z 0 3 2 2
17 29 5 1 check 0 w x y z 3 -2 -2 0
19 -23 -23 -5 check 0 w x y z 1 -3 3 0
19 -25 -17 -13 check 0 w x y z 0 3 -1 -3
19 -29 -11 -11 check 0 w x y z 1 0 3 -3
19 -31 -11 -1 check 0 w x y z 1 1 1 -4
21 -25 -23 -13 check 0 w x y z 0 2 1 -4
21 29 19 11 check 0 w x y z 2 3 2 2
21 31 19 1 check 0 w x y z 4 2 0 1
23 29 25 11 check 0 w x y z 1 -3 -3 -2
23 31 25 1 check 0 w x y z 3 -2 -3 -1
23 -35 -19 -1 check 0 w x y z 1 -3 3 2
23 37 13 7 check 0 w x y z 3 3 1 2
25 -31 -25 -17 check 0 w x y z 0 3 0 -4
25 35 19 17 check 0 w x y z 4 -2 -2 -1
25 -35 -23 -11 check 0 w x y z 1 -2 4 -2
25 41 13 5 check 0 w x y z 1 4 2 2
25 -43 -5 -1 check 0 w x y z 2 -1 4 -2
You almost got it. The complete rational parameterization to $$a^2+b^2+c^2=3\tag1$$ is given by, $$a=\frac{r^2+s^2-t^2-2t(r+s)}{r^2+s^2+t^2}\\b=\frac{r^2-s^2+t^2-2s(r+t)}{r^2+s^2+t^2}\\c=\frac{-r^2+s^2+t^2-2r(s+t)}{r^2+s^2+t^2}\tag2$$ Proof: For any solution $a,b,c$, one can find $r,s,t$ using the simple formulas, $$r=\frac{1}{b-1}\\s=\frac{1}{c-1}\\t=\frac{a-1}{(b-1)(c-1)}\tag3$$ Example: Using Jagy's example, we have $a,b,c = \frac{1}{7}, \frac{5}{7}, \frac{11}{7}$. Plugging this into $(3)$, we get $r,s,t = \frac{-7}{2}, \frac{7}{4}, \frac{21}{4}$. Plugging this into $(2)$, we recover the $a,b,c$.
Note: Division by zero is easily avoided by using $(\pm1)^2+(\pm1)^2+(\pm1)^2=3$.