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.