If $x^2+y^2-xy-x-y+1=0$ ($x,y$ real) then calculate $x+y$ If $x^2+y^2-xy-x-y+1=0$ ($x,y$ real) then calculate $x+y$
Ideas for solution include factorizing the expression into a multiple of $x+y$ and expressing the left hand side as a sum of some perfect square expressions.  

Let $s=x+y$ and $d=x-y$. Then $x=(s+d)/2$ and $y=(s-d)/2$. Making this substitution, we find that
$$
x^2+y^2-xy-x-y+1=\frac{3d^2}{4}+\frac{(s-2)^2}{4}.
$$
Hence, being a sum of squares, if the original expression is zero, $d=0$ and $s-2=0$. This means that $s=x+y=2$, with $x=y$.
