I'm told that if $r^2 + s^2 = z^2$ then $(r+s)^2 + (r-s)^2 = 2z^2$, which is obvious. But i'm trying to show that every integer solution to $x^2 + y^2 = 2z^2$ arises this way from a Pythagorean Triple (r,s,z) and then go on to find the general solution of $x^2 + y^2 = 2z^2$ where $gcd(x,y,z)=1$.
I started by saying that $a,b \in \mathbb{Z}$ was an integer to solution to $x^2 + y^2 = 2z^2$, then $a^2 + b^2 = 2z^2$ and then trying to show that there exist some $a_1 , b_1$ such that $a = a_1 + b_1$, $b=a_1 - b_1$, but i haven't seem to have gotten anywhere. I find myself going in circles. Any tips?

In General, for the equation;
$$x^2+y^2=az^2$$
If you can represent a number as a sum of squares. $a=t^2+k^2$
The solution can be written in this form.
$$x=-tp^2+2kps+ts^2$$
$$y=kp^2+2tps-ks^2$$
$$z=p^2+s^2$$
For the case:
$$x^2+y^2=2z^2$$
Solutions will be:
$$x=-p^2+2ps+s^2$$
$$y=p^2+2ps-s^2$$
$$z=p^2+s^2$$
$p,s - $any integer.