Quadratic Diophantine Equation $x^2 + axy + y^2 = z^2$

I have been reading about this quadratic Diophantine equation of the form

$x^2 + axy + y^2 = z^2$

where x, y, z are integers to be solved and a is a given integer.

All integral solutions are given by

$x = k(an^2 - 2mn), y = k(m^2 - n^2), z = k(amn - m^2 - n^2)$ and

$x = k(m^2 - n^2), y = k(an^2 - 2mn), z = k(amn - m^2 - n^2)$

(due to diagonal symmetry in x and y)

where $m,n$ are integers with $\gcd(m,n) = 1,$ but $k \in \mathbb Q$ is rational such that $(a^2 - 4) \, k \in \mathbb Z.$ This is Theorem 2.3.2. on page 90 of An Introduction to Diophantine Equations by Andreescu, Andrica, and Cucurezeranu. (2010). EDIT BY WILL JAGY.

I have no problem understanding how the solution forms were derived; they were just basic algebraic manipulation. But then when it comes to the solutions in positive integers, the form becomes

$x = k(an^2 + 2mn), y = k(m^2 - n^2), z = k|amn + m^2 + n^2|$ and

$x = k(m^2 - n^2), y = k(an^2 + 2mn), z = k|amn + m^2 + n^2|$

where k, m, n are positive integers, an + 2 m > 0 and m > n.

What I can understand is that we apply modulus to the x, y, and z in the previous form to get the latter form (we want x, y, and z to be in positive integers), but I can't seem to understand how an + 2 m > 0 and m > n work to prove

$|x| = |k(an^2 - 2mn)| = kn|an - 2m| = kn(an + 2m) = k(an^2 + 2mn)$ and

$|z| = |k(amn - m^2 - n^2)| = k|amn + m^2 + n^2|$.

Can anyone help me on this? I've been pondering for almost a week. It's driving me crazy. Thank you in advance.


Solution 1:

There is something wrong here. The given set of formulas does give infinitely many solutions, that part is fine.

Example: $$ x^2 + 8 xy + y^2 = z^2 $$ Set of solutions that does not fit those formulas: $$ x = 16 u^2 - 14 u v + 3 v^2, \; \; y = -2 u^2 + 2 u v, \; \; z = 2 u^2 + 6 u v - 3 v^2 $$ I know this is new because the indefinite binary form $2 u^2 + 6 u v - 3 v^2$ is neither the principal form nor its negative: it does not represent $+1$ or $-1$ over the integers.

I have requested two books by Andreescu through my city library, a local college has them. I cannot imagine that they claim all solutions come up through one set of formulas.

pari
? x =  16 * u^2 - 14 * u * v + 3 * v^2
%1 = 16*u^2 - 14*v*u + 3*v^2
? y = -2 * u^2 + 2 * u * v
%2 = -2*u^2 + 2*v*u
? z = 2 * u^2 + 6 * u * v - 3 * v^2
%3 = 2*u^2 + 6*v*u - 3*v^2
? x^2 + 8 * x * y + y^2 - z^2
%4 = 0


==========================================================

jagy@phobeusjunior:~$ ./Conway_Positive_Primes 1 8 1   1000 5
           1           8           1   original form 

           1           6          -6   Lagrange-Gauss reduced 



 Represented (positive) primes up to  1000

    61   109   181   229   241   349   409   421   541   601
   661   709   769   829

==========================================================

jagy@phobeusjunior:~$ ./Conway_Positive_Primes 2 6 -3   1000 5
           2           6          -3   original form 

           2           6          -3   Lagrange-Gauss reduced 



 Represented (positive) primes up to  1000

     2     5    17    53   113   137   173   197   233   257
   293   317   353   557   593   617   653   677   773   797
   857   953   977