<s>[INST] 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?
 [/INST] Here I have a solution just using Pythagorean triples. we know that any solution of $$x^2+y^2=z^2$$ can be written as $$x=2ab,\,\,\,\,\,  y=a^2-b^2,\,\,\,\,\ z=a^2+b^2.$$
Therefore for your equation, we can choose 
$$w=4abc,\,\,\,\,\,  x=2(a^2-b^2)c,\,\,\,\,\ y=(a^2+b^2)^2-c^2,\,\,\,\,\,z=(a^2+b^2)^2+c^2.$$
Isn't it interesting? :)
</s>