<s>[INST] Algebra - Solving for three unknowns. Find all possible solutions of
$$2^x + 3^y = z^2.$$

My approach. 
First I substituted $x = 0$, and got the solution, then for $y = 0$. And for $x >  0$ and $y > 0$ , I just know the Pythagorean triple and got the solution as $(4,2,5)$ and $(4,2,-5)$. Please help me to solve it properly. 
 [/INST] If $x,y>0$ then working mod $3$ we have $2^x\equiv 1$ so $x$ is even. Working mod $4$ gives $y$ even. So $(2^{x/2})^2+(3^{y/2})^2=z^2$, meaning $(2^{x/2},3^{y/2},|z|)$ form a pythagorean triple.
Any pythagorean triple can be written as $(a(b^2-c^2), 2abc, a(b^2+c^2))$ for some positive integers $a,b,c$ (where the first two terms can be in either order). So we must have $2abc$ is a power of $2$, and so $a(b^2-c^2)$ is a power of $3$. This means $a=c=1$, $b$ is a power of $2$, and $(b-1)(b+1)$ is a power of $3$, hence $b$ must be $2$. This means the only option for $x,y>0$ is $2^{x/2}=8, 3^{y/2}=3, |z|=5$.
</s>