Here I analyse the equation $x^2 -D y^2 = z^2$.Generally these type of equations can have several solutions if x, y, D and z are particular function of a certain parameter like m.
Suppose $x=2m^2 + p$; plugging in equation we get:
$(2m^2 +p)^2 - z^2 = D y^2 $ ⇒ $4 m^4 + 4p m^2+p^2 -z^2=Dy^2 $
If $4m^2 | p^2 - z^2$ then we have:
$p^2 - z^2 = 4 k m^2 $ or $4m^2(m^2 +p+k)=D y^2$
So we have following system of equations:
$y^2 = 4m^2$ ⇒ $ y = ± 2m$
$ D= m^2 +p+k$
Therefore with certain values for m, p, and k equation $x^2 -D y^2 = z^2$ is valid. In fact equation $p^2 = z^2 + 4 k m^2 $ can have several solutions if $p^2$, $z^2$ and $4km^2$ make a Pythagorean triple$ a^2 +b^2= c^2$ in which c and b are two consecutive numbers, that is $4km= p-1$ and $4km^2$is a perfect square. For example Consider triple $25^2 = 24^2 +7^2$ and compare it with above equation, we get:
$p=25$, $z=7$ and:
$4km^2=24^2= 4. 4. 6^2$ ⇒ $(k=4 , m=6)$ or $( k=36 , m=2)$
For example for $m=2, k=36, p=25 and z=7$ we have:
$x=2m^2 +p =2. 2^2 +25 = 33$
$y = 2m= 2.2=4$
$D=m^2 +p+k=2^2 +25+36=65$ and the equation has the form:
$x^2 -65y^2=z^2$
Since there are infinitely many such triples, then there are infinitely many forms of equation$x^2 -D y^2 = z^2$, that is there are several solution. Using this algorithm you can analyse the equation when RHS of equation is not perfect square.