This problem appeared multiple times in MSE -

UK 1998, Show that $hxyz$ is a perfect square.
Let $x,y,z$ be positive integers such that $\frac{1}{x}-\frac{1}{y}=\frac{1}{z}$. Let $h=\gcd(x,y,z)$, Prove that $hxyz,h(y-x)$ are perfect squares

They seem not to solve my problem. Also the posts are old enough. This problem appeared in UK MO 1998. I found this solution in the book "104 Number Theory Problems from USA Math Camp" written by Titu Andrescu - enter image description here
I don't understand the red boxed step. How we get
$c(b'-a') = a'b'g$ implies $g \mid c$?
why it cant occur that $g \mid (b'-a')$ and $a'b' \mid c$?
I don't understand from here till end.
Both of the linked question have answers with different approaches. But I want a solution which continues from here.


3 Answers 3


It suffices to prove $\,abc\,$ and $\,b\!-\!a\,$ are squares, by $\ hxyz = h^4abc,\,$ $\, h(z\!-\!y) = h^2(b\!-\!a)$

$$\begin{align}{\rm multiplying}\ \ \ \dfrac{1}{c}\ &=\ \dfrac{1}a\ -\ \dfrac{1}b\ \ \ {\rm by}\ \ \ g := (a,b)\\[0.7em] {\rm yields}\ \ \ \dfrac{(a,b)}{c}\ &=\ \dfrac{1}{a'}\ -\ \dfrac{1}{b'}\ =\ \dfrac{b'-a'}{{a'b'}}\end{align}$$

Both fractions are reduced (i.e. in lowest terms) since $\,{((a,b),c)}=1=(b'\!-a',a'b'),\,$ therefore they have equal numerator and denominator (wlog $\ge 0),\,$ hence

$$b'\!-a' = (a,b)=g\ \Rightarrow\ b\!-\!a = g(b'\!-\!a') = g^2$$

$$ a'b' = c\ \Rightarrow\ abc = g^2 a'b'c = g^2 c^2 = (gc)^2$$

Remark $\ $ Notice how much clearer the argument becomes when presented in fractional form. See this post on unique fractionization for more on the uniqueness of reduced fractions.

  • $\begingroup$ Great! I never seen this kind of solutions for this type of problems. Too simple ! :) $\endgroup$ Feb 5, 2017 at 7:09
  • $\begingroup$ But didn't get how $\frac{b'-a'}{a'b'}$ implies $c= a'b'$? Explain a little bit more please $\endgroup$ Feb 5, 2017 at 7:11
  • $\begingroup$ @Rezwan I added the full argument, and clarified the use of uniqueness of reduced fractions. $\endgroup$ Feb 5, 2017 at 15:38

Good job asking a specific question—it makes it very easy to provide useful comments! And indeed, this step of the proof is incorrect: when $a=6$, $b=15$, and $c=10$, we have $\frac16-\frac1{15} = \frac1{10}$ and $g=\gcd(a,b)=3$ does not divide $c$.

(By the way, in your comments, you say "why can't it occur that $g\mid (b'-a')$...?" I want to remind you that $g\mid c(b'-a')$ does not necessarily mean that $g\mid c$ or $g\mid(b'-a')$; it could be that $g$ is the product of some divisor of $c$ times some divisor of $b'-a'$.)

  • $\begingroup$ But the books is quite well known :| "104 Number Theory Problems from USA Math Camp" Written by Titu Anrescu Trainer of USA MO Team:| $\endgroup$ Feb 4, 2017 at 22:12
  • $\begingroup$ Math truth > well known :) $\endgroup$ Feb 4, 2017 at 22:13
  • $\begingroup$ wait .. I think the statement is right ... $a,b,c$ are not any arbitrary integers. It must be true that $\frac{1}{x} - \frac{1}{y} = \frac{1}{z}$ and $x = ad, y = bd, z = cd$ with $d = gcd(x,y,z)$. $\endgroup$ Feb 4, 2017 at 22:23
  • $\begingroup$ But if x = 6, y = 15 and z = 10 then d=gcd(x,y,z) = 1 so $x = a =6$ and $y = b = 15$ and $z = c = 10$. And the observation is valid. $\endgroup$
    – fleablood
    Feb 4, 2017 at 22:34
  • $\begingroup$ @GregMartin Now how to continue from here ? $\endgroup$ Feb 4, 2017 at 22:35

Actually I get the exact opposite as the text does.

As $\gcd(a,b,c) = 1$ and $\gcd(a,b) = g$ we know $\gcd(g,c) = 1$

So we have $c(b'-a') = a'b'g$ so $g|(b'-a')$ Furthermore we know $\gcd(a'-b',a') = \gcd(a'-b',b') = 1$ so $a'b'|c$.

So we have $\frac {c}{a'b'}(b'- a') = g$. But $\gcd(g,c) =1$ so $\frac{c}{a'b'} = 1$ so $g = b'-a'$ (but that's not relevant) and $c = a'b'$ (and that is relevant).

So $hxyz = h^4abc = h^4(ga')(gb')(a'b') = (h^2ga'b')^2$.


If I were to do it entirely on my own:

Let $h = \gcd(x,y,z); x = hx'; y= hy'; z = hz'$

$hxyz = h^4(x'y'z)$ and $h(y-x) = h^2(y'-x')$ so $hxyz$ is a perfect square if and only if $x'y'z$ is and $h(y-x)$ is a perfect square if and only if $y'-x'$ is. So wolog we may assume $h= 1$.

$\frac 1z = \frac 1x - \frac 1y$

$\frac {xy}z = y -x$. Presumable $y \ne x$ if is did we'd have $z = 0$ and $hxyz = 0^2$ and $h(y-x) = 0$ is trivial. So presume $y \ne x$

$z = \frac {xy}{y-x}$

So $y-x|xy$.

Let $g=\gcd(x,y)$ and $x=gx';y=gy'$ and $\gcd(x',y') =1$.

$y'-x'|gx'y'$. If $p$ prime is a factor of $x'$ then $p\not \mid y'$ and $p|y'-x'$. Likewise for any prime factor of $y'$. So $\gcd(y' -x',x'y') = 1$ and $y'-x'|g$. Let $y'-x' = kg$. And as $\gcd(y'-x', x'y') =1$ we know $\gcd(k, x'y') = 1$.

So $z = \frac {xy}{y-x} = \frac{gx'y'}{y'-x'} = \frac{x'y'}k$. But $\gcd(x'y',k) = 1$ so $k = 1$ and $y' - x' = g$

So that proves $y-x = g(y'-x') = g^2$ is a perfect square.

So $xyz = xy\frac{xy}{y-x} = xy\frac{xy}{g^2}=(\frac{xy}{g})^2 = (x'y)^2 = (xy')^2 = (gx'y')^2$ is a perfect square.

  • $\begingroup$ Why $g\mid (b'-a')$? $\endgroup$ Feb 4, 2017 at 23:02
  • $\begingroup$ Because $g$ is relatively prime to $c$. $\endgroup$
    – fleablood
    Feb 4, 2017 at 23:03
  • $\begingroup$ If $\gcd(m,n) = 1$ and $n|mx$ then $n|x$ because $m$ and $n$ have no factors in common. $\endgroup$
    – fleablood
    Feb 4, 2017 at 23:05
  • $\begingroup$ I feel like I might be wrong though. In the a=6, b=15, c = 10 we have $a'=2;b'=5$ so $c' =a'b'=10$. Can anyone think of a case where $c \ne a'b'$? I don't see my error though. And we do know that $\gcd(a,b,c) = \gcd(\gcd(a,b),c)$ correct? $\endgroup$
    – fleablood
    Feb 4, 2017 at 23:09
  • $\begingroup$ And I do find it odd that a well reputed book would be just plain wrong. I get that $g \not \mid c$ unless $g = 1$. That's a huge error. I'm not ... comfortable with saying of course I'm right and the book is wrong but... I don't see that I am. And Greg Martin's counter example... counters. $\endgroup$
    – fleablood
    Feb 4, 2017 at 23:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.