Find all solutions in positive integers of the diophantine equation $w^2+x^2+y^2=z^2$ It's an exercises of the text book Elementary Number Theory and It's Applications 6th Edition by Kenneth H.Rosen. I wanted to solve it using the method in solving the diophantine equation $x^2+y^2=z^2$. But some difficult gaps showed up. And I found that the rational solutions of $w^2+x^2+y^2=1$ is
$$w = \frac{2s}{1+s^2+t^2}$$
$$x = \frac{2t}{1+s^2+t^2}$$
$$y = \frac{1-s^2 - t^2}{1+s^2+t^2}$$
where $s$ and $t$ are both rational numbers. From this I found out that
$$(2mnq^2)^2 + (2pqn^2)^2 + (n^2q^2 - m^2q^2-n^2p^2)^2 = (n^2q^2 + m^2q^2+n^2p^2)^2.$$
But it helps little because I cannot prove that the solutions have to be in such form.
Can any one help?

In General it is possible in various ways to write the solution to this equation:
$$x^2+y^2+z^2=q^2$$
I like such kind.
$$x=2a^2s^2-2abs^2\pm{2apbs}$$
$$y=2a^2s^2+2abs^2\pm2apbs$$
$$z=p^2b^2-a^2s^2+s^2b^2\pm2apbs$$
$$q=p^2b^2+3a^2s^2+s^2b^2\pm2apbs$$
If you want you can write infinitely many formulas are not the problem. You can even choose a particular form.   It is of interest how to solve equations such as this:
$$ax^2+bxy+cxz+dy^2+jyz+rz^2=wq^2$$
$a,b,c,d,j,r,w - $ any specified coefficients.
