Characterize the solution of a Diophantine equation
$$x^2+py^2=z^2$$ where $p$ is a prime of the form $p\equiv 1 \pmod4$ and $(x,y,z)=1$.
Consider every possible cases.
Characterize the solution of a Diophantine equation
$$x^2+py^2=z^2$$ where $p$ is a prime of the form $p\equiv 1 \pmod4$ and $(x,y,z)=1$.
Consider every possible cases.
We can assume $x,y,z$ are pairwise coprime. We know that $z$ is odd and the parity of $x$ and $y$ are different. Finally, all variables used are integers.
Case 1: $x$ is odd, $y$ is even.
Then we can rearrange the above equation to
$$\left( \frac{z+x}2 \right) \left( \frac{z-x}2 \right) = p \left( \frac{y}2 \right)^2.$$
Now if $d = \gcd\left(\frac{z+x}2, \frac{z-x}2 \right)$,
$$d|\left(\frac{z+x}2 + \frac{z-x}2 \right) \implies d|z$$
and similarly,
$$d|\left(\frac{z+x}2 - \frac{z-x}2 \right) \implies d|x.$$
Therefore, $d = 1$. Thus, we have two subcases.
Sub Case 1:
$$\frac{z+x}2 = pa^2, \frac{z-x}2 = b^2$$
which gives
$$(x,y,z) = (pa^2-b^2, 2ab, pa^2+b^2).$$
Sub Case 2: $$\frac{z+x}2 = a^2, \frac{z-x}2 = pb^2$$
which gives
$$(x,y,z) = (a^2-pb^2, 2ab, a^2+pb^2).$$
Case 2: $y$ is odd, $x$ is even. This shouldn't bee too different from Case 1. See if you can finish it.
Case 2: $y$ is odd, $x$ is even.$$( z+x)( z-x) = p ( y)^2.$$
Now if $d = \gcd(z+x, z-x)$, then $d\neq 2k$ since both $(z+x)$ and $(z-x)$ are odd. But
$$d|(z+x + z-x) \implies d|(2z)$$
which implies $\color{#66f}{d=1}$.
– user194772 Dec 29 '14 at 12:50$x^2+y^2\equiv z^2\pmod 4$ and $(x,y,z)=1$, so $z$ is odd, and so exactly one of $x,y$ is even.
If $x=2x_1$, then $$py^2=(z+2x_1)(z-2x_1)$$
$\gcd(z+2x_1,z-2x_1)=\gcd(x_1,z)=\gcd(x,z)=1$
(since if $q\mid x,z$, then $q\mid y$, but $(x,y,z)=1$, contradiction).
If $z+2x_1=pa^2, z-2x_1=b^2$, where $y=ab, a,b\in\mathbb Z, \gcd(a,b)=1, a,b$ are odd, then $x=\frac{pa^2-b^2}{2}, z=\frac{pa^2+b^2}{2}$, thus $y=\pm ab$. This works.
If $z+2x_1=b^2, z-2x_1=pa^2$, where $y=ab, a,b\in\mathbb Z, \gcd(a,b)=1, a,b$ are odd, then $x=\frac{b^2-pa^2}{2}, z=\frac{b^2+pa^2}{2}$, thus $y=\pm ab$. This works.
If $y=2y_1$, then $$py^2=\left(\frac{z+x}{2}\right)\left(\frac{z-x}{2}\right)$$
$\gcd(\frac{z+x}{2},\frac{z-x}{2})=\gcd(x,z)=1$
(since if $q\mid x,z$, then $q\mid y$, but $(x,y,z)=1$, contradiction).
If $\frac{z+x}{2}=pa^2, \frac{z-x}{2}=b^2$, where $y=ab, a,b\in\mathbb Z, \gcd(a,b)=1$, then similarly we can get that this time $x=pa^2-b^2$, $z=pa^2+b^2$, and so $y=\pm 2ab$. This solutions works.
If $\frac{z+x}{2}=b^2, \frac{z-x}{2}=pa^2$, where $y=ab, a,b\in\mathbb Z, \gcd(a,b)=1$, then similarly we can get that this time $x=b^2-pa^2$, $z=b^2+pa^2$, and so $y=\pm 2ab$. This solution works.
Therefore, all the solutions are generated by
$$(x,y,z)=(\pm\left(\frac{b^2-pa^2}{2}\right),\pm ab, \frac{b^2+pa^2}{2}), a,b\in\mathbb Z, \gcd(a,b)=1, a\equiv b\equiv 1\pmod 2$$
$$(x,y,z)=(\pm(b^2-pa^2), \pm2ab, b^2+pa^2), a,b\in\mathbb Z, \gcd(a,b)=1$$
Some of the $\pm$ signs are redundant, so all the solutions are generated by
$$(x,y,z)=(\pm\left(\frac{b^2-pa^2}{2}\right),ab, \frac{b^2+pa^2}{2}), a,b\in\mathbb Z, \gcd(a,b)=1, a\equiv b\equiv 1\pmod 2$$
$$(x,y,z)=(\pm(b^2-pa^2), 2ab, b^2+pa^2), a,b\in\mathbb Z, \gcd(a,b)=1$$