Solving Diophantine Equations Using Inequalities Prove that if $x$ and $y$ are positive integers such that $xy$ divides $x^2+y^2+1$ then prove that the quotient is $3$.
Now as $x^2+y^2 +1 > 2xy$ we have $$\frac{x^2+y^2+1}{xy} \geq 3$$ So now we have to prove that $$\frac{x^2+y^2+1}{xy} \leq 3$$
Now if we prove that for positive integers $x$, $y$ and $z$ we have $x^2+y^2+z^2 \leq 3xyz$ then for $z=1$ our problem gets solved but I don't know how to prove it.
 A: Suppose $x y \mid (x^2 + y^2 + 1)$ and without loss of generality assume that $x < y$. 
Then $(x, y)$ is a pair of positive integers with $x < y$ such that $x \mid (y^2 + 1)$ and $y \mid (x^2 + 1)$. Notice that this implies that $\gcd (x, y) = 1$.
Therefore there exist positive integers $w, z$ such that $x^2 + 1 = w y$ and $y^2 + 1 = x z$. If $x > 1$, then
$$w = \frac {x^2 + 1} y < \frac {x^2 + x} y = \frac {x(x + 1)} y \le \frac {x y} y = x$$
Also, from $1 = wy - x^2$ and $1 = x z - y^2$, we have
$$wy - x^2 = x z - y^2 \quad\implies\quad y(w + y) = x(x + z) \quad\implies\quad w + y = \frac {x (x + z)} y$$
Therefore
$$w^2 + 1 = w^2 + wy - x^2 = w(w + y) - x^2 = w \, \frac {x (x + z)} y - x^2 = x \left ( w\, \frac {x + z} y - x \right )$$
where we know that $\frac {x + z} y$ is an integer because $\frac {x (x + z)} y$ is an integer and $\gcd(x, y) = 1$.
We have found another pair $(w, x)$ with $w < x$ such that $w \mid (x^2 + 1)$ and $x \mid (w^2 + 1)$. Moreover,
$$\frac {w^2 + x^2 + 1} {w x} = \frac {w^2 + wy} {wx} = \frac {w + y} x = \frac {wy + y^2} {xy} = \frac {x^2 + y^2 + 1} {x y}$$
so the ratio is the same. If $w > 1$, then we can find another pair $(v, w)$ with $v < w$ such that $v \mid (w^2 + 1)$ and $w \mid (v^2 + 1)$, and so on. Iterating this procedure, we must end at a pair $(1, b)$, which satisfies the property if and only if $b \mid (1^2 + 1) = 2$, so either $b = 1$ or $b = 2$. Since
$$\frac {1^2 + 1^2 + 1} {1 \cdot 1} = 3 \qquad \frac {1^2 + 2^2 + 1} {1 \cdot 2} = \frac 6 2 = 3$$
we have proved that $3$ is the only possible value for the ratio.
