TITLE: Prove that if $(x+y)^2 \equiv 0 \pmod{xy}$, then $x = y$
QUESTION [7 upvotes]: Let $x,y$ be integers. Prove that if $(x+y)^2 \equiv 0 \pmod{xy}$, then $x = \pm y$.

The given condition is equivalent to $x^2+y^2 \equiv 0 \pmod{xy}$. How do we continue from here to prove that $x = \pm y$?

REPLY [5 votes]: $$x^2 + y^2 = kxy$$
Let $d =gcd(x,y)$.  Then $x=da, y=db$ for some relatively prime $a,b$. 
The equation becomes 
$$a^2+b^2=kab $$
with gcd$(a,b)=1$. This implies $a=\pm 1$ and $b=\pm1$. Indeed, if $a$ or $b$ are not $\pm1$, then $a$ or $b$ is divisible by a prime $p$. Then the prime $p$ also divides $kab$ and hence divides both $a$ and $b$.