# Is it possible to solve $ax^2+hxy+by^2+c=0$ in integers?

Last time I got stuck in this problem which I have posted earlier. Today I have come accross to this new situation.

How to solve the diophantine equation $ax^2+hxy+by^2+c=0$ in integers ? Given all of $a,b,c,h\in \mathbb Z$.

The motivation was to solve $30x^2+21y^2-57xy+729=0$ in integers which through MAPLE i got as $(x,y)=(-22,-17), (-10,-11), (10,11), (22,17)$.

• also solutions to +57xy is you change 1 of the signs. – JMP Feb 5 '15 at 12:42
• sorry i didn't get you properly – Anjan3 Feb 5 '15 at 13:33
• Solutions to (30,57,21,729) are (22,-17) etc..., – JMP Feb 5 '15 at 13:38
• Ohh now i got it. never though that. thanks for the info – Anjan3 Feb 6 '15 at 4:50

Here's the method to solve such an equation ( both theory and equation solver ).

In general, given an initial solution $x_0,y_0 = m,n$ to,

$$a x^2 + b x y + c y^2 + d = 0\tag1$$

if the discriminant $D= b^2-4ac\,$ is a non-square $D>0$, then an infinite more can be found as,

$$x = mu^2 - 2(b m + 2c n)u v + D m v^2$$

$$y = n u^2 + 2(2a m + b n)u v + D n v^2$$

where $u,v$ solve the Pell equation,

$$u^2 - D v^2 = \pm1\tag2$$

However, if your $D$ is a square, or $D<0$, then $(1)$ will only have a finite number of integer solutions. (In your case, it is a square $D=27^2$.)

• Really impressive. But would you like to share with me how did you arrive such calculation like this ? – Anjan3 Feb 6 '15 at 6:33
• @AnjanDebnath: The general method can be found in Dickson's History of the Theory of Numbers. I derived this version to highlight the connection to Pell equations. It's quite tedious to explain it step-by-step, but it's a useful identity. The more complete version can be found as Identity 2 of this post and will shed light on why it works. – Tito Piezas III Feb 6 '15 at 7:23