# Find all integer solutions to $x^2+xy+y^2=((x+y)/3 +1)^3$

Find all ordered pairs of integers $$(x,y)$$, that satisfy the following relation:

$$x^2+xy+y^2=((x+y)/3 +1)^3$$

I tried bashing at first. Then I assumed $$x+y = 3k$$ for some integer $$k$$ so that $$y=3k-x$$, substituted in the given equation and got a cubic polynomial involving $$k$$ and $$x$$ if I had solved it right. But I dont know how to proceed further. Please help. Any other solution is also welcome.

• $x=y=3$ is a solution. I would guess it is the only one, but can't justify it. – Ross Millikan Jan 10 '19 at 6:23
• Yup, I guessed it, but I want a rigorous solution(I know bashing is not a very elegant method of rigorously writing a solution, but just gave a try) – Yellow Jan 10 '19 at 6:25
• since one side grows as a cube and the other a square, your options for positive solutions are very limited. – DanielV Jan 10 '19 at 6:46
• I cannot accept two answers simultaneously, right? (I know that is a stupid question, but you see, I usually admire any solution that I see) – Yellow Jan 10 '19 at 7:10

Bashing seems like a good approach. Setting $$x+y=3k$$ as you suggest, the equation becomes $$x^2-3kx+9k^2=(k+1)^3.$$ For a fixed integer $$k$$, we can consider this as a quadratic in $$x$$, and it has integer roots iff the discriminant $$(-3k)^2-4(9k^2-(k+1)^3))=-27k^2+4(k+1)^3$$ is a perfect square. Serendipitously, this discriminant factors as $$(k-2)^2(4k+1),$$ so it is a perfect square iff either $$k=2$$ or $$4k+1$$ is a perfect square. When $$k=2$$, $$4k+1$$ is in fact also a perfect square, so $$4k+1$$ is a perfect square in all cases.
We can thus write $$4k+1=(2a+1)^2$$ for some integer $$a$$, so $$k=a^2+a$$ and the discriminant is $$(a^2+a-2)^2(2a+1)^2$$. The quadratic formula then gives $$x=\frac{3a^2+3a\pm(a^2+a-2)(2a+1)}{2}$$ and $$y=3a^2+3a-x=\frac{3a^2+3a\mp(a^2+a-2)(2a+1)}{2}$$ which are a solution for any integer $$a$$. Or, simplified, we can say $$x$$ and $$y$$ are $$a^3+3a^2-1$$ and $$-a^3+3a+1$$ in some order.
Put $$a = x+y, b = x -y \implies x^2+y^2 +xy = \dfrac{(x+y)^2+(x-y)^2}{2}+ \dfrac{(x+y)^2-(x-y)^2}{4}= \dfrac{a^2+b^2}{2}+\dfrac{a^2-b^2}{4}= \dfrac{3a^2+b^2}{4}$$. The equation becomes: $$\dfrac{3a^2+b^2}{4} = \dfrac{(a+3)^3}{27}\implies 81a^2+ 27b^2=4(a+3)^3$$. Observe that $$3 \mid a$$, thus put $$a = 3n$$, and we have a new equation: $$3(3n)^2+b^2= 4(n+1)^3\implies 4n^3-15n^2+12n+4 = b^2\implies (4n+1)(n-2)^2 = b^2\implies 4n+1 = m^2\implies n = k^2+k, m = 2k+1, k \in \mathbb{Z}\implies b = m(n-2)= (2k+1)(k^2+k-2)\implies a = 3n = 3k^2+3k\implies x = \dfrac{a+b}{2}= \dfrac{(2k+1)(k^2+k-2)+3k^2+3k}{2}, y = \dfrac{a-b}{2}= \dfrac{-(2k+1)(k^2+k-2)+3k^2+3k}{2}, k \in \mathbb{Z}$$. Note that $$k \neq 0$$ for the solutions to "work".