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. 

$$(xy-7)^2=x^2+y^2 $$
$$x^2y^2-14xy+49 = x^2+y^2 $$
$$x^2y^2-12xy+49 = x^2+2xy+y^2 $$
$$(xy-6)^2+13=(x+y)^2 $$
$$13 = (x+y)^2-(xy-6)^2 $$
$$13 = (x+y+xy-6)(x+y-xy+6) $$
The factors on the right must be factors of the prime $13$.
We conclude $x+y=7$ and easily enumerate all solutions.
