parametric solution for the sum of three square Is there a parametric integer solution for $x,y,z,t$ when the sum of three square is equal to a square, i.e,
$$x^2+y^2+z^2=t^2$$?
 A: EDIT: I knew i had written up Jones and Pall 1939 before, but it was on a question with different intent: Every integer vector in $\mathbb R^n$ with integer length is part of an orthogonal basis of $\mathbb R^n$
J-P 1939: as long as $t$ is odd, find all solutions to
$$ a^2 + b^2 + c^2 + d^2 = t,  $$
including permuting the letters and choosing various $\pm$ signs, while not requiring $a,b,c,d$ to be coprime. Then all solutions to your equation are given by
$$ \left( a^2 + b^2 - c^2 - d^2 \right)^2 + (-2ad+2bc)^2 +(2ac+2bd)^2 = t^2.  $$ 
Edit, November 26, 2016. This is often called Lebesgue's Formula, after V. A. Lebesgue the number theorist. It seems to go back to Euler as well. The first acceptable proof that all solution arise this way was due to L. E. Dickson, about 1920. 
This is Theorem 3 on page 176 of Regular and Semi-Regular Positive Ternary Quadratic Forms, Acta Mathematica, volume 70, (1939), pages 165-191. It is  a theorem about quaternions with all coefficients integers. 
Now, if $t$ is even, then $t^2$ is divisible by $4,$ which means you need to double all three numbers; if the sum of three squares is divisible by $4,$ then all the squares are even. So, given some even number $n = 2^k t$ with $t$ odd, solve as above, then multiply through all solutions found by the same $2^k.$ 
I finished the version with stereographic projection from the North Pole of the sphere, and I can see now why this is not typically taught: by the Gauss-Legendre Three Squares Theorem, either $t$ or $2t$ is the sum of three squares, possibly both. 
The first case gives, when $\color{magenta}{t = p^2 + q^2 + r^2},$
$$ (2rp)^2 + (2rq)^2 + \left( p^2 + q^2 - r^2 \right)^2 = t^2.  $$ 
Note that the recipe above cannot be used for $t=7,$ despite $2^2+3^2+6^2=7^2.$
If, instead,when $\color{magenta}{2t = p^2 + q^2 + r^2},$ then $p^2 + q^2 - r^2$ is even and
$$ (rp)^2 + (rq)^2 + \left( \frac{p^2 + q^2 - r^2}{2} \right)^2 = t^2.  $$ 
This way, $2 \cdot 7 = 14 = 3^2 + 2^2 + 1^2,$ we do get $3^2 + 2^2 + (12/2)^2 = 49.$
Let's see, this is very different from Pythagorean triples. there are no restrictions on $t$ at all. Also, if you multiply $t$ by $4$ in either of the recipes above, all that happens is that you are forced to double all three of $p,q,r,$ so nothing important changes. that is, if the sum of three squares is divisible by 4, the squares are all even.  
For those keeping score at home, it is quite easy to show that all rational points on the unit sphere $x^2 + y^2 + z^2 = 1$ other than the North Pole $(0,0,1)$ are given by
$$ \left( \; \frac{-2rp}{p^2 + q^2 + r^2} \; , \; \frac{-2rq}{p^2 + q^2 + r^2} \; , \; \frac{p^2 + q^2 - r^2}{p^2 + q^2 + r^2} \;  \right)   $$
for an integer triple $p,q,r.$
A: There is a parameterization for every equal sums of squares equation
$$
X_1^2 + \dotsb + X_m^2 = Y_1^2 + \dotsb + Y_n^2
$$
with $n,m$ positive integers and all $X_i,Y_i$ integers; your equation is the special case $(m,n)=(3,1)$. The papers by Barnett and Bradley are my first recommendations.
A: Notice that for all integers $n$:$$n^2 + (n + 1)^2 + (n(n + 1))^2 = (n^2 + n + 1)^2$$
Of course, the above parametric solution does not necessarily represent all integer solutions.
