Find all positive integers $a,b$ such that each of the equations $x^2-ax+b=0$ and $x^2-bx+a=0$ has distinct positive integral roots.

Find all positive integers $a,b$ such that each of the equations $$x^2-ax+b=0$$ and $$x^2-bx+a=0$$ has distinct positive integral roots.

Suppose $\alpha,\beta$ are roots of the first equation and $\gamma,\delta$ are of the second, then we have these two sets of equations $$a=\alpha+\beta$$ $$b=\alpha\beta$$ and $$b=\gamma+\delta$$ $$a=\gamma\delta$$ How to proceed?

• I have found only $(4,4);\;(5,6)$ which give $x=2$ and $x=2;\;x=3$ – Raffaele Sep 30 '17 at 15:45
• I used a program to find my values and there are no more values up to $a=b=100$. the solutions are rational if both $a^2-4b$ and $b^2-4a$ perfect squares – Raffaele Sep 30 '17 at 16:02
• This is true and this leads us to $(a-b)(a+b+4)=(m+n)(m-n)$ where $(m,n)$ are integers. But what next? Besides, $-a\pm m$ and $-b\pm n$ have to be even integers. – ami_ba Sep 30 '17 at 16:25
• Can you share the entire solution set that your program has generated? – ami_ba Sep 30 '17 at 16:33
• My program gave $(4,4),(5,6),(6,5)$ this time I made it run up to $a=b=1000$ – Raffaele Sep 30 '17 at 16:36

A long answer, I'm afraid, but I think it's correct. Please let me know if anything is unclear.

Observe first that $a/b = 1/\beta + 1/\alpha < 2$ and similarly $b/a < 2$. That is, $a < 2b$ and $b < 2a$. But now, assuming wlog $\alpha > \beta$, the previous inequality says: $$\alpha \beta < 2\alpha + 2 \beta < 4 \alpha,$$ meaning $\beta < 4$. Of course, there's a similar statement for $(\gamma, \delta)$, but let's work with $(\alpha,\beta)$, remembering that whatever we find for $(a,b)$ can be swapped to yield another solution $(b,a)$. (Which we would have found if we had used ($\gamma, \delta$).)

If $\beta = 3$, then $b = 3 \alpha < 2a = 2 \alpha + 2 \beta = 2 \alpha + 6$, i.e. $\alpha < 6$, forcing $\alpha = 4$ or $5$. Neither of these choices work, by a routine check.

If $\beta = 2$, then $4 - 2a + b = 0$ by the first equation, i.e. $b = 2a - 4$. But then $$b^2 - 4a = 4a^2 - 20a + 16 = 4(a^2 - 5a + 4)$$ needs to be a perfect square, meaning $a^2 - 5a + 4 = c^2$ for some $c$, so $a = (10 \pm \sqrt{9+(2c)^2})/2$ by the quadratic formula. But the expression under the square root here has to be odd, so $a$ cannot be an integer – contradiction.

Thus $\beta = 1$, and we arrive at $b = a - 1$. Now, the roots of $x^2 - (a-1)x + a = 0$ are $$x = \frac{a-1 \pm \sqrt{(a-1)^2 - 4a}}{2};$$ thus we require the discriminant $(a-1)^2 - 4a = a^2 - 6a + 1$ to be a perfect square, say $a^2 - 6a + 1 = c^2$ for some $c$, so $a = (6 \pm \sqrt{32 + (2c)^2})/2$ by the quadratic formula again.

It will have to be plus, to ensure $a > 0$, and $32 + (2c)^2$ now has to be a square, say $32 + (2c)^2 = d^2$. But then $32 = (d-2c)(d+2c)$, forcing $d - 2c = 1, 2,$ or $4$, since it must be less than $\sqrt{32} = 4 \sqrt2$. But $d$ is even, so actually $d - 2c = 2$ or $4$. Suppose $d = 2c + 2$, so $$32+ (2c)^2 = (2c+2)^2.$$ Then $32 = 8c + 4$, which is impossible. Hence $d = 2c + 4$ and we get $32 + (2c)^2 = (2c + 4)^2$ or $32 = 16c + 16$, i.e. $c = 1$, $a = 6, b = 5$.

• What about $(4,4)$? – ami_ba Oct 1 '17 at 4:49
• @Amitayas, the problem asks for distinct roots. – Gerry Myerson Oct 1 '17 at 5:26
• Got it,........ – ami_ba Oct 1 '17 at 5:30
• I was thinking of adding the two polynomials – ami_ba Oct 1 '17 at 5:31
• Why should the roots of $(p(x)+q(x))/2$ be positive integers just because the same is true of $p(x)$ and $q(x)$ individually? – Mr. Chip Oct 1 '17 at 9:21