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. 
 A: Write the equation as $(xy-7)^2 - x^2 = y^2$, and factor as
$$(xy+x-7)(xy-x-7) = y^2$$
Note that if $x \ge 4$ and $y \ge 4$, $$xy+x-7 > xy - x - 7 \ge 4 (y-1) - 7 = y + 3y - 11 > y$$
Now look at small values of $x$ or $y$.
A: $$(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.
A: $$(x+xy-7)(x-xy+7) + y^2 = 0$$
$$(x(1+y)-7)(x(1-y)+7) + y^2 = 0$$
This means for example prime factors of $y^2$ must split over factors of $$(7-x(y+1))(7+x(1-y))$$
They will also be opposite (mod $7$) and same (mod $x$).
But we can start with that for each side be positive ( requirement for a square ) both factors of a product must be either negative or positive.


*

*both negative: $\cases{7<x(y+1) \\ 7<-x(1-y) = x(y-1)}$

*both positive $\cases{7>x(y+1) \\ 7>x(y-1)}$
Now this should reduce the problem enough to check the rest by hand.
A: 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}$$
A: (xy)2−12xy+49=(x+y)2⟺(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=13x+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=14
A: $$(xy)^2−12xy+49=(x+y)^2\longleftrightarrow(xy−6)^2+13=(x+y)^2.$$ Hence $$13=(x+y+xy−6)(x+y−xy+6).$$ It follows the only possibility (after discarding $−13$ and $−1$) is that $$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=14.$$
