If $x$ and $y$ are non-negative integers for which $(xy-7)^2=x^2+y^2$. Find the sum of all possible values of $x$. I am not able to reach to the answer. I have used discriminant as $x$ and $y$ are both integers but it didn't give any hint to reach to answer. I am not able to understand how should I deal with these type of question. 

We have $$(xy)^2-12xy+49=(x+y)^2\iff(xy-6)^2+13=(x+y)^2$$
hence $$13=(x+y+xy-6)(x+y-xy+6)$$ It follows the only possibility (after discard$-13$ and $-1$)
$$x+y+xy-6=13\\x+y-xy+6=1$$ This implies clearly $$x+y=7$$ which gives the candidates $(0,7),(1,6),(2,5),(3,4)$ and symmetrics and it is verified that the only to be accepted are $(0,7)$ and $(4,3)$.
Consequently, taking $(x,y)=(0,7),(7,0),(4,3),(3,4)$ $$S=0+7+4+3=\color{red}{14}$$
