An example problem in my textbook asks: Find all solutions in positive integers of the diophantine equation $x^2 + 2y^2 = z^2$. The provided proof appears as follows:
$2y^2 = z^2 - x^2 = (z - x)(z + x)$. $x$ and $z$ have the same parity, so $(z - x)/2$ and $(z + x)/2$ are integers. It suffices to assume $(x, z) = 1$. Then either $(\frac{(z - x)}{2}, z + x) = 1$, and then $y^2 = \frac{(z - x)}{2}(z + x) = m^2n^2$, and solving $\frac{(z - x)}{2} = m^2$ and $z + x = n^2$ for $x$ and $y$ gives $x = (n^2 - 2m^2)=2, y = mn, z = \frac{(n^2 + 2m^2)}{2}$.
Or $(\frac{(z + x)}{2}, z - x) = 1$, which gives $x = (2m^2 - n^2)=2$, $y = mn$, $z = \frac{(2m^2 + n^2)}{2}$.
Several parts of this proof confuse me. For one, why does it suffice to assume $(x, z) = 1$? Second, if we do assume this, then why does it follow that either $(\frac{(z - x)}{2}, z + x) = 1$ or $(\frac{(z + x)}{2}, z - x) = 1$?
If $\gcd(x,z) = d$, then $d^2|y^2$ so we can just cancel the common divisor. Then $\gcd(z+x, z-x) = \gcd(z-x, 2z) = k$. Now since $x,z$ have same parity, since $z^2-x^2$ is even, dividing one of $z \pm x$ by $2$ makes it odd.
Then $k \nmid 2$ if we divide one of two numbers $z \pm x$ by $2$. If $k|z$, then from $k|z-x, k|x$ so $k = 1$.