2. (5) Find all rational $x>0, y>0$, for which $x+\frac{1}{y}$ and $y+\frac{1}{x}$ are integers.
2. Answer: $\left( \pm 2, \pm \frac{1}{2}\right),\left( \pm \frac{1}{2}, \pm 2\right),( \pm 1, \pm 1)$ (signs simultaneously + or -), as well as all pairs of rational $x, y$ with the condition $x=-\frac{1}{y}$. Note that $\left(x+\frac{1}{y}\right)\left(y+\frac{1}{x}\right)=x y+\frac{1}{x y}+2=m+2$ is also an integer. We get $x y=\frac{m \pm \sqrt{m^{2}-4}}{2}$. Clearly, for the conditions to be met, $\sqrt{m^{2}-4}$ must be rational, which is only true if $m^{2}-4$ is a perfect square. We get $m= \pm 2$ (larger squares are too far apart). This means $x y= \pm 1$. In the case $x y=1$, we get $x=\frac{1}{y}$ and $y=\frac{1}{x}$. Substituting this into the condition, we get that $2 x$ and $2 y$ are also integers, and their product is 4. The six possible answers are then obvious.

In the case $x y=-1$, we get that any pairs with this condition are valid.