x2+y2=2(x+y)+xy
⇒x2−x(2+y)+y2−2y=0
It is a quadratic equation in the variable x.
Discriminant of the above equation is given by
D=(2+y)2−4(1)(y2−2y)
=4+12y−3y2=16−3(y−2)2
Since x is an integer, D must be a perfect square and thus it is non-negative.
Hence, 16−3(y−2)2≥0
⇒(y−2)2≤163
⇒|y−2|≤4√3<3
Since y is an integer, it follows that its only possible values are given by y=0,1,2,3,4.
When y=1,3,
D=13, which is not a perfect square.
Thus, y=0,2,4
When y=0,
we have x2−2x=0
⇒x=0,2
When y=2,
we have x2−4x=0
⇒x=0,4
When y=4,
we have x2−6x+8=0
⇒x=2,4
Thus, there are 6 solutions,
(0,0),(2,0),(0,2),(4,2),(2,4),(4,4)