From: rusin@vesuvius.math.niu.edu (Dave Rusin) Newsgroups: sci.math,sci.math.symbolic Subject: Re: Math problem Date: 26 Dec 1997 07:23:17 GMT In article <883039210.1040449545@dejanews.com>, wrote: >Given A*x^2 + B*x*y + C*y^2 = z^2, and given values for A, B, and C, >I would like to be able to find all integer solutions of x, y, and z. > >For example: -23*x^2 + 22*x*y + 17*y^2 = z^2 > >Is there a general way to solve this? See e.g. http://www.math.niu.edu/~rusin/known-math/95/quadratics [URL updated 1999/01 -- djr] Your particular example may be reduced to "polar form" u^2-2v^2=-23z^2 by completing the square (that is, by making some linear changes of variables). It is sufficient to solve this p-adically for p=2 and p=23, but one can proceed "by inspection", noting that u=3, v=4, z=1 is a solution. In terms of the original variables we have only a _rational_ solution x=y=1/4, z=1; but by scaling we obtain an integral solution x=1, y=1, z=4 to the original equation. We can treat this as an inhomogeneous quadratic in two rational variables: -23*p^2 + 22*p*q + 17*q^2 = 1 where p = x/z, q = y/z. Once we have one rational solution (p0, q0) to a multivariate quadratic, we may obtain all others by finding the intersection of the conic with the line (p,q) = (p0 + t, q0 + mt), as a function of m. In our example, using (p0,q0)=(1/4, 1/4) we compute t = (6-14m)/(-23+22m+17m^2), so that the rational points on the curve are parameterized by the formulae p = (1-34m+17m^2)/(-92+88m+68m^2) q = (-23+46m-39m^2)/(-92+88m+68m^2) for all rational m. You can now work backwards if you like and recover the integral solutions: They are of the form x = ( n^2-34mn+17m^2)d y = (-23n^2+46mn-39m^2)d z = (-92n^2+88mn+68m^2)d where m and n range over the integers, and d could be any rational number making x, y, and z integral. (Equivalently, d = d1/d2 where d1 is any integer, and d2 divides the GCD of (n^2+34mn+17m^2), (-23n^2+46mn-39m^2), and (-92n^2+88mn+68m^2); that GCD is 1 or 2 if n and m are relatively prime.) For related topics see e.g. http://www.math.niu.edu/~rusin/known-math/index/11DXX.html dave