Describe all integral solutions of the equation $x^2 + y^2 = 2z^2$ such that $x,y,z > 0$, gcd$(x,y,z) = 1$, and $x > y$. As the title states, the question tasks me with finding all the integral solutions of the equation under the specified constraints. I have an idea of where to start due to a somewhat similar problem in my notes, but I'm having trouble adapting it to this new equation, and knowing where I need to change my process. My professor has provided the hint: "Use the circle $^2 + ^2 = 2$ and the lines
passing through the point $(1,1)$." Here's what I have so far:
$x^2 + y^2 = 2z^2$
$\frac{x^2}{z^2} + \frac{y^2}{z^2} = 2$
Let $X = \frac{x}{z}$ and $Y = \frac{y}{z}$
$X^2 + Y^2 = 2$
So we now have a circle with an origin at $(0,0)$ and radius of $\sqrt{2}$. I then drew up the circle and the line passing through $(1,1)$.

So the slope $\lambda$ of this line would be: $\lambda = \frac{Y-1}{X-1}$. This is the part where I get lost, in class we went off on a tangent related to these problems and I'm having trouble knowing exactly how to proceed. I have an idea of what the final answer will look like. The form we found for $x^2 + y^2 = z^2$ was: $(x,y,z) = (a^2 - b^2, 2ab, a^2 + b^2)$ Any help would be greatly appreciated!

The trick to this one is to create three new variables
$$
a = x+y\\
b = x-y\\
c = 2z
$$
Then $x^2+y^2 = 2z^2 \implies a^2+b^2 = c^2$
Temporarily ignoring the condition that $\gcd(x,y,z) = 1$ we can now list all solutions of 
$a^2+b^2 = c^2$ as
$$
a = k(n^2 - m^2)\\
b = 2kmn\\
c = k(n^2 + m^2)
$$
with $m \neq n \pmod 2$ and $\gcd(m,n) = 1$. 
To get back to $x,y,z$ we have 
$$ x = \frac{b+a}2 = k\frac{(n^2 + 2mn - m^2)}2
\\ y = \frac{b-a}2 = k\frac{(m^2 + 2mn - n^2)}2
\\ z = \frac c2 = k\frac{(n^2 + m^2)}2
$$
However, since $m$ and $n$ are of opposite parity, $(n^2 + m^2)$ is odd, so in order for $z$ to be an integer, $k$ must be even:  $k = 2p$. 
Then the generic triplet is 
$$ x =  p(n^2 + 2mn - m^2)
\\ y = p(m^2 + 2mn - n^2)
\\ z =  p(n^2 + m^2)
$$
$x$ and $y$ are not coprime unless $p = 1$.  So we have 
$$ x =  n^2 + 2mn - m^2
\\ y =| m^2 + 2mn - n^2|
\\ z =  n^2 + m^2
$$
Finally, we can ask when $\gcd(x,y) = 1$ but it is easier to ask when $(x,z) = 1$ which is equivalent for our purposes.
The difference $z-x = m(m-2)$ is a multiple of $m$ and thus is coprime with $z$ because $\gcd(n^2,m) = 1)$ So all such triplets are coprime, and that is our answer:

$$
x =  n^2 + 2mn - m^2
\\ y =| m^2 + 2mn - n^2|
\\ z =  n^2 + m^2
$$  with $ n,m\in \Bbb N \wedge n > m \wedge m \neq n \pmod 2 \wedge \gcd(m,n) = 1$.

