# Integer solutions of a quadratic equation with combined variables

I'm having problems with finding all possible integers solutions of particular equations, like this one for example: $x^2 -xy + 2y^2 = 29$. What sets me off, is the term $xy$, I don't know how to deal with it.

I know methods for solving equations like $x^2 - 3y^2 = -3$ (then I work with the fundamental unit and with norm forms), but I'm stuck on a method for the first one. Substitutions don't seem to do the trick, but I could be wrong.

As always, any help would be dearly appreciated.

• You can multiply by $4$ and complete the square to obtain $4x^2-4xy+8y^2=(2x-y)^2+7y^2=116$ and set $y=2z$ since y has to be even to get $(x-z)^2+7z^2=29$ – Mark Bennet Aug 24 '15 at 13:40
• Oh yes, that's a way to do it in the case $p=29$, thanks! Do you know of some general method for these cases? I can imagine that those tricks don't always work or that you don't always see it (ahem). – Riley Aug 24 '15 at 13:44
• @Riley By "in general" do you mean when $p$ is arbitrary? Or even more arbitrary like $$ax^2-bxy+cy^2 = p$$ – graydad Aug 24 '15 at 13:47
• $4a(ax^2+bxy+cy^2)=(2ax+by)^2+(4ac-b^2)y^2$ so there is always a way of completing the square. – Mark Bennet Aug 24 '15 at 13:48
• @graydad, never mind, Mark Bennet has already answered my question. :) So if I understand it correctly: there's always a way to rewrite the equation so that you can apply the methods as mentioned in the question? – Riley Aug 24 '15 at 13:52

$$x=\dfrac{y\pm\sqrt{y^2-4(2y^2-29)}}2=\dfrac{y\pm\sqrt{116-7y^2}}2$$
We need $116-7y^2$ to be $\ge0$ and perfect sqaure
$y^2\le\dfrac{116}7<17$
So, we need to test for $1\le y\le4$