# If $\frac1x-\frac1y=\frac1z$, $d=\gcd(x,y,z)$ then $dxyz$ and $d(y-x)$ are squares

Let $x, y, z$ be three non negative integer such that $\dfrac{1}{x}-\dfrac{1}{y}=\dfrac{1}{z}$. Denote by $d$ the greatest common divisor of $x, y, z$.

Prove that $dxyz$ and $d(y-x)$ are squares number.

My idea is that if $x=da, y=db, z=dc$, where $\gcd(a, b, c)=1$, then $c(b-a)=ba$. But I don't know how to do next.

It suffices to prove that $d (y - x)$ is a square, because $$\tag{id}(y - x) z = x y,$$ and thus $$d (y - x) z^{2} = d x y z.$$

Let $p$ be a prime, and let $p^{a}, p^{b}, p^{c}$ be the highest powers of $p$ that divide respectively $x, y, z$.

Let us look at (the exponent of) the highest powers of $p$ that divides $y - x$.

If $a \ne b$, the highest power of $p$ that divides $y - x$ is $\min(a, b)$. Comparing the powers of $p$ in (id) we get thus $$\min(b, a) + c = a + b,$$ so that $c = \max(a, b)$.

This implies that the highest power of $p$ that divides $d (y - x)$ is $$\min(a, b, c) + \min(b, a) = 2 \min(b, a).$$

So let us consider the case $a = b$. Writing $x = p^{a} x'$, $y = p^{a} y'$, we obtain $$p^{a} (y' - x') z = x' y' p^{2 a}.$$ Therefore, if $e$ is the highest power of $p$ that divides $y' - x'$, we have $e + c = a$, so that $c \le a$. Thus in this case the highest power of $p$ that divides $d (y - x)$ is $c + a + e = 2 a$.

We have proved that the highest power of every prime that divides $d (y - x)$ has an even exponent. Thus $d (y - x)$ is a square.

We have $$\frac{1}{x} - \frac{1}{y} = \frac{1}{z}$$ and $d = (x, y, z)$. Let $x = dx'$, $y = dy'$, $z = dz'$. Multiplying both sides by $d$ we get $$\frac{1}{x'} - \frac{1}{y'} = \frac{1}{z'}$$ where $(x', y', z') = 1$.

Let $e = (x', y')$, and $x' = ex''$ and $y = ey''$. We know from the equation above that $z'(y' - x') = x'y'$, or in other words, $z'(ey'' - ex'') = e^2x''y''$; dividing by $e$, we have $z'(y'' - x'') = ex''y''$. $e$ divides the right-hand side, so it must divide the left-hand side. If $(e, z') > 1$, then $(x', y', z') > 1$ which is a contradiction.

Thus $e \mid y'' - x''$. This implies $y'' - x'' = \frac{y' - x'}{e} = ek$ for some $k$, so $y' - x' = e^2k$.

Now, we want $z' = \frac{x'y'}{y' - x'} = \frac{e^2x''y''}{e^2k} = \frac{x''y''}{k}$, so $k \mid x''y''$. $(x'', y'') = 1 \implies k \mid x'' \text{ or } k \mid y''$, but from $y'' - x'' = ek$ we get that $k$ divides both $x''$ and $y''$ if it divides one. So $k = 1$.

We have $y' - x' = e^2$. Multiplying both sides by $d^2$, we finally have $d(y - x) = e^2d^2 = (ed)^2$. Then, as in the answer above, $dxyz = dz(y - x)z = (ed)^2z^2 = (edz)^2$ is a square too.