# Show that if $a \neq b$ and a and b are positive then $\frac{a}{b}+\frac{b}{a}$ is never an integer

Some observations I made is for $\frac{a}{b}+\frac{b}{a}$, is either:

1. the denominator has to be one,

2. the numerator has to be a multiple of the denominator or

3. the numerator and denominator have to be the same.

Obviously, with the given conditions case 3 is eliminated since $a \neq b$.

For case 1, if $b=1$, then $a=1$ which is a contradiction to the given condition that says $a \neq b$.

For case 2, I would think of examples. For example if $b=2$ then a multiple is $4$, so $a=4$. Then we have:

$$\frac{a}{b}+\frac{b}{a}=\frac{4}{2}+\frac{2}{4}=\frac{10}{4}$$

which is not an integer, but how would i proceed to show this case for all integers.

• Are $a$ and $b$ both integers also? Oct 7, 2015 at 4:05

Let's solve the equation $x + 1/x = n$ where $n$ is any positive integer. It's equivalent to the quadratic equation $x^2 - nx + 1 = 0$. Its coefficients are integers so, if $a/b$ is a root with $\operatorname{gcd}(a,b) = 1$ and $a\neq b$ then $a$ divides the constant coefficient $1$ and $b$ divides the dominant coefficient $1$.

(I assume that $a$ and $b$ are both integers...)

Let $x=\dfrac{a}{b}+\dfrac{b}{a}=\dfrac{a^2+b^2}{ab}$. We can assume that $a$ and $b$ are relatively prime, since substituting $a/g$ and $b/g$ instead of $a$ and $b$ doesn't change the value of $x$.

If $x$ is integer, than $ab$ should divide $a^2+b^2$, so

$$a|(a^2+b^2) \; \Rightarrow\; a|b^2$$

$$b|(a^2+b^2) \; \Rightarrow\; b|a^2$$

Since we assumed that $a$ and $b$ are relatively prime, these formulas hold only when $a=b=1$, which is contradicted to the condition $a\neq b$.

Therefore, $x\not\in \mathbb{Z}$.

Presumably you want $a,b$ to be integers. If $x = a/b$, solve the equation $$x + \dfrac{1}{x} = n$$ to get $$x = \dfrac{n}{2} \pm \dfrac{\sqrt{n^2-4}}{2}$$ The question is whether $\sqrt{n^2-4}/2$ is ever rational. This would require $\sqrt{n^2-4}$ to be an integer (because the square root of an integer is only rational if it is an integer). But then if $m = \sqrt{n^2-4}$, we would have $n^2 - m^2 = 4$. The only squares of integers that differ by $4$ are $2^2$ and $0^2$, but that corresponds to $x = 1$, i.e. $a = b$.

If $a,b$ are not integers, nothing stops $x+\frac1x$ being an integer. In fact, that happens infinitely many times as the function is continuous.

Let $d=gcd(a,b)$ and $a=xd, b=yd$ with $gcd(x,y)=1$. Then $$\frac{a}{b}+\frac{b}{a}=\frac{x^2+y^2}{xy}.$$ We will show that if $p$ is a common prime divisor of $x^2+y^2$ and $xy$ then $p=2$. Indeed, $$(x+y)^2=x^2+y^2-2xy\text{ and }(x-y)^2=x^2+y^2-2xy$$ are both multiples of $p$. Thus $p$ divides both $x+y$ and $x-y$, and so $p$ divides $2x$ and $2y$. Since $gcd(x,y)=1$, $p$ divides $2$ and $p$ must be $2$.

It follows that $x^2+y^2$ and $xy$ are both even. From $xy$ is even, we see that either $x$ or $y$ is even. That together with $x^2+y^2$ is even, we see that both $x$ and $y$ are even. It contradicts the fact that $gcd(x,y)=1$.

Thus $x^2+y^2$ and $xy$ don't have a common prime factor. $\dfrac{x^2+y^2}{xy}$ is an integer only if $xy=1$, equivalently $x=y=\pm1$, or $a=b$.

I will assume that $a$ and $b$ are to be integers, although it is easy to see that it makes no difference if we take $a$ and $b$ to be rational.

Without loss of generality we may take $a$ and $b$ relatively prime. We show that $a^2+b^2$ and $ab$ are relatively prime, which forces $a=b=1$.

They cannot both be even. Suppose some prime $p\gt 2$ divides both. Then $p$ divides $a^2+b^2\pm 2ab$, and therefore $p$ divides $a+b$ and $a-b$. It follows that $p$ divides both $a$ and $b$.