# Better way of identifying pairs of natural numbers that satisfy certain conditions?

Recently, I encountered the following problem:

Let $$(a, b)\in(\Bbb{N}^*\space \times\space \Bbb{N}^*)$$ such that $$\frac{a^2+2b}{b^2-2a}\text{ and }\frac{b^2+2a}{a^2-2b}$$ are both integers.

(i) Show that the absolute difference of $$a$$ and $$b$$ is less than or equal to $$2$$.

(ii) Find all the pairs $$(a, b)$$ with the given properties.

The first part (i) was quite easy to prove:

$$(b^2-2a)\:\mid\:(a^2+2b)\text{ and }(a^2-2b)\:\mid\:(b^2+2a)$$

Since $$(a, b)\in(\Bbb{N}^*\space \times\space \Bbb{N}^*)$$, both $$a^2+2b$$ and $$b^2+2a$$ are positive, and therefore $$b^2-2a\le a^2+2b$$ and $$a^2-2b\le b^2+2a$$. Forming squares of binomials and switching from the RHS to the LHS and backwards:

$$b^2-2b+1\le a^2+2a+1\implies(b-1)^2\le (a+1)^2$$

And since both $$a$$ and $$b$$ are positive, the sign does not change when taking the square root: $$b-1\le a+1$$ so $$b\le a+2$$. Similarly, but working with the first relation, $$a\le b+2$$. And thus, $$|a-b|\le 2$$.

So far so good, but (ii) is quite confusing to me, in the sense that I cannot think of an approach that doesn't lead to a lot by-hand checking and "fluffy" arithmetic. My attempt was to consider each case separately, so taking each $$a$$ in $$\{b,\:b+1,\:b+2\}$$ (of course assuming $$a\ge b$$ and then swapping each pair at the end and using what we proved at (ii)). Since this method is (naturally) quite lengthy, it makes no sense to include it all in the question, but here are the results I obtained:

$$(a, b) \in \{(1, 1), (3, 3), (4, 4), (6, 6), (2, 4), (4, 2), (3, 5), (5, 3), (4, 6), (6, 4)\}$$

I was wondering if there is another, hopefully better way of solving this (ii)? (because this is the solution given by the authors of the problem too :(...)

• +1 for the well worked solution! – user371838 Jan 12 '18 at 11:54
• To be honest, I see no problem in bashing through b) since more or less part a) makes you lean towards this method – asdf Jan 12 '18 at 12:24
• As asdf comments, (i) allows us to consider only a few cases, so I find the method (taking $a=b,b+1,b+2$) natural and easy. One could reduce by-hand checking with the use of some inequalities, and write a "not-lengthy" solution using the method. – mathlove Jan 13 '18 at 5:34

As I've already commented, I find the method (taking $a=b,b+1,b+2$) natural and easy.

The following solution using the method should not be lengthy.

• If $a=b$, then in order for $$\frac{a^2+2b}{b^2-2a}=\frac{b^2+2a}{a^2-2b}=\frac{a+2}{a-2}=\frac{a-2+4}{a-2}=1+\frac{4}{a-2}$$ to be an integer, $a-2$ has to be a divisor of $4$, which implies that $a-2=\pm 1,\pm 2,\pm 4$ giving $a=1,3,4,6$.

• If $a=b+1$, in order for $$\frac{b^2+2a}{a^2-2b}=\frac{b^2+2(b+1)}{(b+1)^2-2b}=\frac{b^2+2b+2}{b^2+1}=\frac{b^2+1+2b+1}{b^2+1}=1+\frac{2b+1}{b^2+1}$$ to be an integer, $\frac{2b+1}{b^2+1}$ has to be a positve integer, so $$\frac{2b+1}{b^2+1}\ge 1\implies 2b+1\ge b^2+1\implies b\le 2$$For $b=1$, we have $\frac{b^2+2a}{a^2-2b}=\frac 52$ which is not an integer. For $b=2$, we have $\frac{a^2+2b}{b^2-2a}=-\frac{13}{2}$ which is not an integer.

• If $a=b+2$, then$$\frac{b^2+2a}{a^2-2b}=\frac{b^2+2(b+2)}{(b+2)^2-2b}=\frac{b^2+2b+4}{b^2+2b+4}=1$$$$\small P:=\frac{a^2+2b}{b^2-2a}=\frac{(b+2)^2+2b}{b^2-2(b+2)}=1+\frac{8b+8}{b^2-2b-4}=\begin{cases}1+2\cdot\frac{2m+1}{m(m-1)-1}&\text{for even b=2m}\\\\1+2^4\cdot \frac{m}{4m(m-2)-1}&\text{for odd b=2m-1}\end{cases}$$where $m$ is a positive integer.

For $b=1,2,3,4$, $P=-\frac{11}{5},-5,-31,11$ respectively.

Let us consider the case where $b=2m$ is even with $m\ge 3$. If $m\ge 3$, then $m(m-1)-1\ge 3\cdot 2-1=5$ holds. Since $m(m-1)$ is even, $m(m-1)-1$ is odd. So, in order for $P=1+2\cdot\frac{2m+1}{m(m-1)-1}$ to be an integer, $\frac{2m+1}{m(m-1)-1}$ has to be a positive integer, so we have to have $\frac{2m+1}{m(m-1)-1}\ge 1$, i.e. $2m+1\ge m(m-1)-1$ which implies $m\in\left[\frac{3-\sqrt{17}}{2},\frac{3+\sqrt{17}}{2}\right]$. With $m\ge 3$, we get $m=3$, and then $(a,b)=(8,6)$ gives $P=\frac{19}{5}$ which is not an integer.

Let us consider the case where $b=2m-1$ is odd with $m\ge 3$. If $m\ge 3$, then $4m(m-2)-1\ge 4\cdot 3\cdot 1-1=11$ holds. Since $4m(m-2)$ is even, $4m(m-2)-1$ is odd. So, in order for $P=1+2^4\cdot\frac{m}{4m(m-2)-1}$ to be an integer, $\frac{m}{4m(m-2)-1}$ has to be a positive integer, so we have to have $\frac{m}{4m(m-2)-1}\ge 1$, i.e. $m\ge 4m(m-2)-1$ which implies $m\in\left[\frac{9-\sqrt{97}}{8},\frac{9+\sqrt{97}}{8}\right]$. There are no integers $m$ satisfying both this and $m\ge 3$.

• This is my initial method, but it’s good to see other people’s thoughts on the problem. Thank you for your effort (+1)! (If you wouldn’t have posted this, I would have done it anyway) – Mr. Xcoder Jan 15 '18 at 6:25