Originally Posted by

**undefined** Yes, I should have been more careful about that point.

So we have

$\displaystyle x^2 + 5y^2 = z^2$

and suppose we are interested in all integer solutions. First note that there are trivial solutions $\displaystyle (x,0,x)$ for all integers $\displaystyle x$. Without loss of generality we can consider just solutions in positive integers for the non-trivial solutions. It can be seen that if $\displaystyle (x,y,z)$ satisfies, then $\displaystyle (kx,ky,kz)$ satisfies for any positive integer $\displaystyle k$, thus we can obtain all non-trivial solutions from the *primitive* solutions having $\displaystyle \gcd(x,y,z) = 1$. (This is standard use of the term primitive.) As for the problem statement restricting $\displaystyle x$ to odd; I don't know what the motivation is for that, but we can just discard any solutions for which $\displaystyle x$ is even at the very end.

Now for the actual proof/derivation I mentioned earlier. Disclaimer is that my solution method is not original.

Let $\displaystyle a=\frac{y}{z}$ and $\displaystyle b=\frac{x}{z}$, from which we obtain

$\displaystyle (bz)^2 + 5(az)^2 = z^2$

$\displaystyle 5a^2 + b^2 = 1$

This is an equation of an ellipse; solutions to the problem correspond with points on the ellipse. Consider the point $\displaystyle A\ (0,-1)$ on the ellipse. A parametrisation for all lines through $\displaystyle A$ with slope $\displaystyle t$ is $\displaystyle (a, ta - 1)$. The intersection of the line with the ellipse is given by

$\displaystyle 5a^2 + (ta-1)^2 = 1$

$\displaystyle 5a^2 + t^2a^2 - 2ta + 1 = 1$

$\displaystyle a(5+t^2) = 2t$

$\displaystyle a = \frac{2t}{t^2 + 5}$

and

$\displaystyle b = 2\left( \frac{2t}{t^2 + 5} \right) - 1$

$\displaystyle b = \frac{2t^2-5-t^2}{t^2+5}$

$\displaystyle b = \frac{t^2 - 5}{t^2 + 5}$

It can be seen that if $\displaystyle t$ is rational then $\displaystyle a$ and $\displaystyle b$ are rational. Replace $\displaystyle t$ with $\displaystyle \frac{m}{n}$ and we have

$\displaystyle a = \frac{2\left( \frac{m}{n}\right)}{\left( \frac{m}{n} \right)^2 + 5}$

$\displaystyle b = \frac{\left( \frac{m}{n} \right)^2 - 5}{\left( \frac{m}{n} \right)^2 + 5}$

which simplifies to

$\displaystyle a = \frac{2mn}{m^2 + 5n^2}$

$\displaystyle b = \frac{m^2-5n^2}{m^2+5n^2}$

Now we can take the parametrisation $\displaystyle (x',y',z') = (m^2-5n^2, 2mn, m^2+5n^2)$. Let $\displaystyle g = \gcd(x',y',z')$. Then we have a parametrisation for primitive solutions $\displaystyle (x,y,z) = \left(\frac{x'}{g},\frac{y'}{g},\frac{z'}{g} \right)$. We must choose positive integers $\displaystyle m$ and $\displaystyle n$ such that

$\displaystyle m^2-5n^2 > 0$

$\displaystyle m > \sqrt{5}n$

Restricting $\displaystyle \gcd(m,n)=1$, we obtain all primitive triples uniquely.