Solve diophantine equation $x^2+y^2=2(x+y)+xy$
Solve Diophantine equation $$x^2+y^2=2(x+y)+xy$$My idea:
Rewrite as:$$2(x+y)=(x+y)^2-3xy$$Let set:$$u=x+y$$
$$v=xy$$$$2u=(u)^2-3v$$$$v=\frac{u^2-2u}{3}$$But in this approach is really hard to see solution for $x$ and $y$. It must be some easier way to do this.
5 Answers
$\begingroup$This is slightly different approach but in same spirit as that by Erick Wong.
We can multiply the equation by $2$ and then complete the squares to get$$(x-y)^2+(x-2)^2+(y-2)^2=8.$$Note that the three squares on the left hand side can only take values from $\{0,1,4\}$ for the equation to hold. Thus two of them have to be $4$ and the remaining one has to be $0$. This gives us$$(4,4), \quad (0,2), \quad (2,0), \quad (0,0), \quad (4,2), \quad (2,4)$$
$\endgroup$ $\begingroup$$$x^2+y^2=2(x+y)+xy$$
Multiply through by $4$ and introduce the new variable $z=2x-y$ to eliminate the cross term $xy$:
$$4x^2 - 4xy + y^2 + 3y^2 = 8(x+y)$$$$\implies z^2 + 3y^2 = 8x + 8y = 4z + 12y.$$
Now complete the squares in $z$ and $y$:
$$(z-2)^2 + 3(y-2)^2 = 16.$$
Because the LHS is positive definite, there are only finitely many solutions to $a^2+3b^2 = 16$. I think you should be able to complete it from here.
$\endgroup$ 2 $\begingroup$As @Erick Wong said, you should solve $a^2 + 3b^2 = 16$ that has solutions:$$a=\pm2,b=\pm2 \qquad \& \qquad a=\pm4,b=0$$This $6$ solution lead us to:$$(y=0,z=0) \ (y=0,z=4) \ (y=4,z=0) \ (y=4,z=4) \ (y=2,z=-2) \ (y=2,z=6)$$And now this gives us the final answer:$$(x=0,y=0) \ (x=2,y=0) \ (x=2,y=4) \ (x=4,y=4) \ (x=0,y=2) \ (x=4,y=2)$$
$\endgroup$ $\begingroup$The curve of equation $x^2+y^2=2(x+y)+xy$ is an ellipse whose major axis is supported on the diagonal $y=x$ hence, by symmetry, $(x,y)$ is solution if and only if $(y,x)$ is solution. Making $x=y$ we get $x(x-4)=0$ then $(0,0)$ and $(4,4)$ are solutions.
Hence, looking at points with $y\gt x$ there are no points for $y\ge5$. Similarly, there are no points with $x\ge5$.
Thus, the only solutions are $(x,y)=(0,0),(2,0)(0,2),(4,2),(2,4)$ and $(4,4)$.
$\endgroup$ $\begingroup$Other substitutions:
$x^2+y^2=2(x+y)+xy\overset{x\to u+v\\y\to u-v}{\implies} (u-2)^2+3v^2=4$
Thus
$(u,v)=(0,0),(1,-1),(1,1),(3,-1),(3,1),(4,0)\implies\\(x,y)=(0,0),(0,2),(2,0),(2,4),(4,2),(4,4)$
$\endgroup$