TITLE: Find $x,y,z \in \mathbb Q$ such that $x + \frac 1y, y + \frac 1z, z+ \frac 1x \in \mathbb Z$
QUESTION [16 upvotes]: Find $x,y,z \in \mathbb Q$ such that: $$x + \frac 1y, y + \frac 1z, z+
 \frac 1x \in \mathbb Z$$

Here is my thinking:
$$x + \frac 1y, y + \frac 1z, z+ \frac 1x \in \mathbb Z\\ \implies \left ( x + \frac 1y\right ) \left ( y + \frac 1z\right )\left ( z + \frac 1x\right )\in \mathbb Z \\ \iff \frac 1 {xyz} + xyz + \left( x+\frac 1y \right) + \left( y+\frac 1z \right) + \left( z+\frac 1x \right) \in \mathbb Z \\ \iff xyz + \frac 1 {xyz} \in \mathbb Z \\ \iff |xyz| = 1 \text{ (I proved it, easily)}$$
Case 1:
$xyz=1 \implies \exists a,b,c \in \mathbb Z$ such that: $x = \frac ab,y=\frac bc,z=\frac ca$
$$\implies \frac {a+c} b = x+\frac 1y \in \mathbb Z$$
and so on.
Now, I am stuck. Do you thing I am going a right way ?

REPLY [7 votes]: Let's start with your observation, that $|xyz| = 1$, and therefore $xyz = \pm 1$. If we take any solution $(x, y, z)$ with $xyz = -1$ and change it to $(-x, -y, -z)$, it is still a solution and we have $(-x)(-y)(-z) = 1$, so it's enough to consider the solutions with $xyz = 1$ and obtain the rest by flipping all the signs. So we have $x = \frac{a}b$, $y = \frac{b}c$, and $z = \frac{c}a$ for some integers $a, b, c$. Without loss of generality, let |a| ≤ |b| ≤ |c|. We actually can't make the assumption $|a| \le |b| \le |c|$ without loss of generality! But we can let $c$ be the largest of the three in magnitude, which means that $|c| \ge |b|$ and $|c| \ge |a|$. The other solutions will be obtained by cyclically rotating the three.
Then, consider the fact that (as $y + \frac1z$ is an integer) $c$ divides $(a + b)$ and therefore $|c|$ divides $|a+b|$. As $|a| \le |c|$ and $|b| \le |c|$, we have $|a + b| \le 2|c|$, with equality holding only when $|a| = |c|$ and $|b| = |c|$ (in which case we have the solutions $|x| = |y| = |z| = 1$). 
Otherwise, $|a+b|$ is strictly less than $2|c|$, and so either $|a + b| = 0$, or $|a + b| = |c|$.
If $|a + b| = 0$ so that $b = -a$, then the fact that $a$ divides $b+c = c-a$ means that $c$ is a multiple of $a$, say $c = ka$. This is always a solution, and gives $x = \frac{a}{b} = -1$, $y = \frac{b}{c} = \frac{-1}{k}$, and $z = \frac{c}{a} = k$.
The other case is that $|a + b| = |c|$, so $a + b = \pm c$. We can consider these separately as two cases:

$a + b = -c$. This happens to be fine for any pair of nonzero integers $(a, b)$, and gives the family of solutions $x = \frac{a}{b}$, $y = \frac{b}{c} = \frac{-b}{a+b}$, and $z = \frac{c}{a} = \frac{-a-b}{a}$.
$a + b = c$. In this case, the fact that $b$ divides $(c + a) = 2a + b$ means that $b$ divides $2a$, and similarly the fact that $a$ divides $(b + c) = a + 2b$ means that $a$ divides $2b$. So $|b|$ is one of $|a|/2$, $|a|$, or $2|a|$. Let's consider all three separately, in descending order:

If $|b| = 2|a|$, then $b = 2a$ (as $b = -2a$ gives $c = a + b = -a$, which contradicts our assumption that $|c| \ge |b|$). So $c = a + b = 3a$, and this gives the solution $x = \frac{a}{b} = \frac12$, $y = \frac{b}{c} = \frac23$, $z = \frac{c}{a} = 3$.


If $|b| = |a|$, then we can ignore the case $b = -a$ as we already considered it earlier, and look at $b = a$. This gives $c = 2a$, and indeed a solution $x = \frac{a}b = 1$, $y = \frac{b}{c} = \frac12$, and $z = \frac{c}{a} = 2$.


If $|b| = |a|/2$, then $a = 2b$ (as $a = -2b$ gives $c = a + b = -b$, contradicting our assumption that $|c| \ge |a|$). So $c = a + b = 3b$, and this gives the solution $x = \frac{a}{b} = 2$, $y = \frac{b}{c} = \frac13$, and $z = \frac{c}{a} = \frac32$.



To summarize, all the solutions $(x, y, z)$ are (note that all the below are distinct):

$(1, 1, 1)$,
$(2, 1, \frac12)$,
$(\frac12, \frac23, 3)$,
$(-k, -1, \frac1k)$ for any nonzero integer $k$,
$(\frac{a}{b}, \frac{-b}{a+b}, \frac{a+b}{-a})$, for any pair of nonzero integers $a$ and $b$,

and the solutions obtained by changing any $(x, y, z)$ above to $(y, z, x)$, $(z, x, y)$, $(-x, -y, -z)$, $(-y, -z, -x)$, or $(-z, -x, -y)$.