If $xy$ divides $x^2 + y^2$ show that $x=\pm y$

Suppose that $\gcd(x,y)=1$ and $(xy)\mid(x^2+y^2)$. Then $y^2\equiv0\pmod x$. If $1=ax+by$ then $by\equiv1\pmod x$ and so $1\equiv(by)^2=b^2y^2\equiv0\pmod x$. So $x=\pm1$. Likewise, $y=\pm1$.


It makes little sense if either of $x,y$ is zero.

I will continue with $x,y \neq 0.$

If $x^2 + y^2 = kxy$ for nonzero integer $k,$ we have $$ x^2 - k xy + y^2 = 0 $$ We are taking $y \neq 0,$ so we may divide through by $y^2,$ define $r = \frac{x}{y},$ giving $$ r^2 - kr + 1 = 0 $$ with integer $k$ and rational $r.$

So: what are the roots $r$ of $$ r^2 - kr + 1 = 0 \; ? \; $$ Can the roots actually be rational? For what values of $k$ can the roots be rational?


Suppose $xy|x^2+y^2$. Then $xy|x^2+y^2+2xy=(x+y)^2$. But if $\gcd(x,y)=1$, then also $$ 1=\gcd(x,x+y)=\gcd(y,x+y)=\gcd(xy,x+y)=\gcd(xy,(x+y)^2) $$ from which it then follows that $xy=\pm 1$.