# [SOLVED]Find a and b

#### anemone

##### MHB POTW Director
Staff member
Find all positive integers $a$ and $b$ such that $\dfrac{a^2+b}{b^2-a}$ and $\dfrac{b^2+a}{a^2-b}$ are both integers.

• #### topsquark

##### Well-known member
MHB Math Helper
This problem has gotten stuck in my head. This would be okay if I had any inkling of how to solve it. (I already went through all my ideas and they failed.) So this message is for anemone only. Open it at your own risk.

Since you got the problem stuck into my head, this is my revenge!
IT'S A SMALL WORLD AFTER ALL IT'S A SMALL WORLD AFTER ALL IT'S A SMALL WORLD AFTER ALL IT'S A SMALL SMALL WORLD!!!

-Dan

• • • Opalg, GJA, anemone and 2 others

#### Opalg

##### MHB Oldtimer
Staff member

Since you got the problem stuck into my head, this is my revenge!
IT'S A SMALL WORLD AFTER ALL IT'S A SMALL WORLD AFTER ALL IT'S A SMALL WORLD AFTER ALL IT'S A SMALL SMALL WORLD!!!

-Dan
I love that song! I first heard it in the Disney pavilion when I visited the New York World's Fair in 1965. Then in 1979 I took my kids to Disney World in Florida, and there it was again. Happy memories!

• anemone and topsquark

#### Opalg

##### MHB Oldtimer
Staff member
Find all positive integers $a$ and $b$ such that $\dfrac{a^2+b}{b^2-a}$ and $\dfrac{b^2+a}{a^2-b}$ are both integers.
The problem is symmetric in $a$ and $b$, so it will be sufficient to find all solutions with $a\leqslant b$. Let $b = a+c$, with $c\geqslant0$. Then $$\frac{a^2+b}{b^2-a} = \frac{a^2+a+c}{a^2 + (2c-1)a + c^2}, \qquad \frac{b^2+a}{a^2-b} = \frac{a^2 + (2c+1)a + c^2}{a^2-a-c} = 1 + \frac{(2c+2)a + c(c+1)}{a^2 - a - c}.$$ Case 1: $c=0$. Then both fractions become $\dfrac{a+1}{a-1}$, which is an integer when $a = 2$ or $3$ but not otherwise.

Case 2: $c=1$. Then the first fraction becomes $\dfrac{a^2+a+1}{a^2+a+1}$, which is obviously an integer for every $a$. The second fraction is $1 + \dfrac{4a+2}{a^2-a-1}$. That is an integer when $a = 1$ or $2$. It is not an integer if $a= 3,\ 4$ or $5$. And if $a\geqslant 6$ then $0 < \dfrac{4a+2}{a^2-a-1} < 1$. So there can be no more solutions in this case.

Case 3: $c>1$. Then in the fraction $\dfrac{a^2+a+c}{a^2 + (2c-1)a + c^2}$ the numerator is less than the denominator. So the fraction lies between $0$ and $1$ and is therefore not an integer.

Thus there are altogether six possible solutions, as follows: $$\begin{array}{c|c|c}(a,b)&\frac{a^2+b}{b^2-a} & \frac{b^2+a}{a^2-b} \\ \hline (1,2) & 1 & -5 \\ (2,1) & -5&1 \\ (2,2) & 3&3 \\ (2,3) & 1& 11 \\ (3,2) & 11 & 1 \\ (3,3) & 2& 2 \end{array}$$

• • #### anemone

##### MHB POTW Director
Staff member
By the symmetry of the problem we may suppose $a\le b$. Notice that $b^2-1\ge 0$ so that if $\dfrac{a^2+b}{b^2-a}$ is a positive integer, then $a^2+b\ge b^2-a$. Rearranging this inequality and factoring we find that $(a+b)(a-b+1)\ge 0$. Since $a,\,b>0$, we must have $a\ge b-1$. We therefore have two cases:

Case 1: $a=b$. Substituting, we have
$\dfrac{a^2+a}{a^2-a}=\dfrac{a+1}{a-1}=1+\dfrac{2}{a-1}$, which is an integer iff $(a-1)|2$. As $a>0$, the only possible values are $a-1=1 \text{or} 2$. Hence, $(a,\,b)=(2,\,2)$ or $(3,\,3)$.

Case 2: $a=b-1$. Substituting, we have

$\dfrac{b^2+a}{a^2-b}=\dfrac{(a+1)^2+a}{a^2-(a+1)}=\dfrac{a^2+3a+1}{a^2-a-1}=1+\dfrac{4a+2}{a^2-a-1}$

Once again, notice that $4a+2>0$ and hence for $\dfrac{4a+2}{a^2-a-1}$ to be an integer, we must have $4a+2\ge a^2-a-1$, that is $a^2-5a-3\le 0$. Hence, since $a$ is an integer, we can bound $a$ by $1\le a \le 5$. Checking all ordered pairs, we find that only $(a,\,b)=(1,\,2)$ or $(2,\,3)$ satisfy the given conditions.

Thus, the ordered pairs that work are $(a,\,b)=(2,\,2),\,(3,\,3),\,(1,\,2),\,(2,\,3),\,(2,\,1),\,(3,\,2)$

• • 