What is the value of $a^2+b^2$?

If the range of the function $$f(x)=\frac{x^2+ax+b}{x^2+2x+3}$$ is $[-5,4]$ then what is the value of $a^2+b^2$ ?

[$a,b$ are natural numbers]

What will the correct approach to this problem?

I tried using the general method as follows: $({x^2+2x+3})y={x^2+ax+b}$

or,$x^2(y-1)+x(2y-a)+(b-3y)=0$

Then since $x$ is real the discriminant should be greater than equal to 0.

But this method isn't very efficient and quick for this problem.Any shortcuts possible?

• If I pick $a=-10$ and $b=-15$ then the desired range is met. Then $a^2+b^2=325$ But then the combination $a=6$ and $b=17$ should also work, but alas, it doesn't. So something isn't right... – imranfat Jul 30 '16 at 21:31
• $a$ and $b$ are natural numbers... – smcc Jul 30 '16 at 21:32

Both the quadratic equations $$f(x)=-5$$ and $$f(x)=4$$ must have double roots. If these equations have no roots, then the corresponding value is not in the range. But if either has two roots, then in between them the function will go outside the prescribed range.

So the discriminants $\Delta_1$ of both $(x^2+ax+b)+5(x^2+2x+3)$ and $\Delta_2$ of $(x^2+ax+b)-4(x^2+2x+3)$ must both vanish. In other words \begin{aligned} 0&=\Delta_1=a^2+20a-260-24b,\\ 0&=\Delta_2=a^2-16a-80+12b. \end{aligned} This system is easy to solve. There are two solutions $(a,b)=(-10,-15)$ and $(a,b)=(14,9)$.

• This is great. The thing though that got me going is that $a^2+b^2$ expression. It was my understanding that there are many solutions since the sum of squares is what needed to be calculated. But as you have shown, the sum of squares really has got nothing to do with the entire problem, and is thus a distractor. +1 for your answer, -1 for the question – imranfat Jul 30 '16 at 21:47
• I guess the method needs a justification. One comes from the fact that as $\lim_{x\to\pm\infty}f(x)=1$ and the function is continuous everywhere, then it is bounded. As it attains values both larger and smaller than $1$, the range is a closed interval. The derivative has a quadratic numerator, so both its zeros must come into play, and the extremal values cannot be achieved at more than a single point. – Jyrki Lahtonen Jul 30 '16 at 21:57
• @SanchayanDutta The parabola $y=1-x^2$ cannot have a maximum at $x=1$ because when you solve $1-x^2=0$, you find two solutions. Thus inbetween $1$ and $-1$ the curve goes higher than the function value of $x=1$. This thought is crucial in Jyrki's answer – imranfat Jul 30 '16 at 22:03
• @SanchayanDutta: Many ways to see that. My previous comment gives one justification (using the form of the derivative). Actually that is not needed. If the discriminant formed with $y=4$ (resp. $y=-5$) were positive, then it would still be positive for slightly larger choice of $y$ (resp. slight smaller choice of $y$), and those values would not be extremal. All because the discriminant is a continuous function of $y$. – Jyrki Lahtonen Jul 30 '16 at 22:03
• @JyrkiLahtonen What if interval of range is $(-5,4)$ – Aakash Kumar Jul 31 '16 at 16:39

Note that $$-5 \leq y \leq 4 \iff (y+5)(y-4) \leq 0 \iff y^2+y-20 \leq 0$$

For $x^2(y-1)+(2y-a)x+(3y-b)=0$ admits real value of $x$, \begin{align*} \Delta & \geq 0 \\ (2y-a)^2-4(y-1)(3y-b) & \geq 0 \\ -8y^2+4(3-a+b)y+a^2-4b & \geq 0 \\ 8y^2+4(a-b-3)y-a^2+4b & \leq 0 \\ \end{align*}

Comparing coefficients, $$8y^2+4(a-b-3)y-a^2+4b \equiv 8(y^2+y-20)$$

\implies \left \{ \begin{align*} a-b-3 &= 2 \\ -a^2+4b &= -160 \end{align*} \right.

$$\implies (a,b)= (14,9) \: \text{ or } \: (-10,-15)$$

Since $a$ and $b$ are natural numbers, reject $\, (a,b)=(-10,-15)$.

$$\therefore \quad a^2+b^2=277$$