# How do I find the number of integer solutions ($x,y$) that satisfy the equation $y = 3x^2 + 7xy + 4y^2$?

I'm looking for the number of integer solutions for this equation. This problem is from a $7$th grade math contest where you had a few minutes to answer it, but the only way to solve it I found was to find all the solutions by solving second degree equations which takes significantly more than that. Is there any way to solve this problem that, perhaps, would be easier/would get closer to that time limit? Thanks.

Noting that the coefficient of the middle term is the sum of the other coefficients, so there is a factor $x+y$, we find the factorisation $y=(x+y)(3x+4y)$

Set $x+y=X$ and we have $y=X(3X+y)$ and $y=\cfrac {3X^2}{1-X}$

($X=1$ is easily eliminated, so we are not dividing by zero)

Now $X$ and $1-X$ can have no [non-trivial] factor in common, so $1-X$ must be a factor of $3$ hence $(1-X)\in \{-3, -1, 1, 3\}$

Clearly each of these possibilities does provide a solution, since the steps are reversible.

• Notice how the substitution was used to obtain an equation linear in $y$. That's a trick worth remembering. – Mark Bennet Jul 9 '18 at 19:54
• I thought the factoring could be used in some way. Good. Also, metro.co.uk/2018/07/07/… – Will Jagy Jul 9 '18 at 21:53
• To make use of this factorisation directly, translate the intersection of the asymptotes to the origin so the equation becomes $(x+y)(3x+4y)=-3$. Solving $\langle x+y-1,3x+4y+3\rangle$, $\langle x+y+1,3x+4y-3\rangle$, $\langle x+y-3,3x+4y+1\rangle$, $\langle x+y+3,3x+4y-1\rangle$ we get $(7,-6),(-7,6),(13,-10),(-13,10)$ which translates back to $(0,0),(14,-12),(20,-16),(-6,4).$ – Jan-Magnus Økland Jul 10 '18 at 5:05
• Or even more directly from the asymptotes: $(x+y-1)(3x+4y+3)=-3$ rearranges to the given equation. – Jan-Magnus Økland Jul 10 '18 at 11:32
• @Jan-MagnusØkland Of course that is the way to go to formalise the solution. I wanted to explain this in a way that a 7th grade student might be able to spot from scratch. Also it is not so clear that each choice for the factors gives an integer solution. – Mark Bennet Jul 10 '18 at 12:27

Say $(x,y)$ is a pair of integers satisfying $y = 3x^2 + 7xy + 4y^2$. We can rewrite this as $$4y^2 + (7x-1)y + 3x^2 = 0$$ and solving for $y$ with the quadratic formula yields $$y = \frac{1-7x \pm \sqrt{(7x-1)^2 - 48x^2}}{8} = \frac{1-7x \pm \sqrt{x^2 - 14x + 1}}{8}$$ For this to be an integer, we require $x^2 - 14x + 1$ to be a perfect square, call it $m^2$. Then $$(x-7-m)(x-7+m) = (x-7)^2 - m^2 = 48$$ Since both factors on the left hand side are integers, this has a finite number of integer solutions coming from factorizations of $48$. This readily yields all possible values of $x$ when combined with the condition that $y$ must itself be an integer.

• Very nice your answer. Why $\ldots=48$? – user401938 Jul 9 '18 at 21:19
• @Sebastiano (x-7)^2 - m^2 = x^2 - 14x + 49 - m^2 = x^2 -14x + 1 - m^2 + 48 = m^2 - m^2 + 48 = 48 – Wiirexu Jul 13 '18 at 12:32
• @Wiirexu I have now undestood. You have used the hypothesis $x^2 - 14x + 1=m^2$. Ok! Thank you very much. – user401938 Jul 13 '18 at 20:16