Find all solutions to the equation $x^2 + 3y^2 = z^2$ Find all positive integer solutions to the equation $x^2 + 3y^2 = z^2$
So here's what I've done thus far:
I know that if a solution exists, then there's a solution where (x,y,z) = 1, because if there is one where $(x,y,z) = d$, then $\frac{x}{d}, \frac{y}{d}, \frac{z}{d}$. is also a solution.
I'm trying to mimic the pythagorean triple proof where they have that $x = u^2 - v^2$ and $y = 2uv$ and $z = u^2 + v^2$
So, looking at the original equation mod 4, I can see that it's in the form:
$(0 or 1) - (0 or 1) = 3(0 or 1)$. Thus we for sure know that $3y^2$ is congruent to 0 mod 4 and that $y$ is even. We also learned that $z$ and $x$ are either both even or both odd.
From there I'm guessing I need to handle each case, but I'm stuck as to where to go from here.

Rearrange we have 3y^2=z^2-x^2=(z-x)(z+x)
this means 3|(z-x)(z+x)
therefore 3|z-x or 3|z+x
In fact 3 divides only one of them
For the sake of contradiction suppose 3 divides both z-x and z+x
then 3|2z and 3|2x
then 3|gcd(2z,2x)=2gcd(z,x)
since gcd(3,2)=1
therefore 3|gcd(z,x)
then 3|z, 3|x
indicating 9|z^2, 9|x^2
then 9|3y^2
then 3|y^2
then 3|y
then 3 is a common divisor of x, y and z, which is a contradiction to
gcd(x,y,z)=1
Without loss of generality assume 3|z-x
then y^2=(z+x)(z-x)/3
let d=gcd(z+x,(z-x)/3)
then d|z+x, d|3(z-x)/3=z-x
then d|2z, d|2x
then d|gcd(2z,2x)=2gcd(z,x)=2
(it’s easy to show gcd(z,x)=1 based on the assumption that gcd(x,y,z)=1)
case 1: d=1
then (z-x)/3=u^2, z+x=v^2
(this is based on the theorem: if a^k=bc, and if gcd(b,c)=1, then b=m^k, c=n^k
which can be easily proven by the fundamental theorem of arithmetics)
then x=|v^2-3u^2|/2, y=uv, z=(v^2+3u^2)/2,
where gcd(u,v)=1 and u, v are both odd
case 2: d=2
then gcd((z+x)/2, (z-x)/6)=1
then based on the same previous theorem (z-x)/6=a^2, (z+x)/2=b^2
then x=|b^2-3a^2|, y=2ab, z=b^2+3a^2,
where gcd(a,b)=1,
and exactly one of a, b is odd and the other is even
