Find $m$ and $n$ so that the given function has the range $[-3, 5]$ Find $m$ and $n$ real numbers so that $f(x) = \frac{3x^2 + mx + n}{x^2 + 1}$ takes all and only the values from the interval $[-3, 5]$.
I started by solving the following double inequality:
$$-3 \leq \frac{3x^2 + mx + n}{x^2 + 1} \leq 5$$
From the left inequality I got $6x^2 + mx + n + 3 \geq 0$. The coefficient of $x^2$ is positive so the discriminant $\delta$ has to be less than or equal to $0$.
$\delta = m^2 - 24n - 72 \leq 0$
From the right inequality I got $2x^2 -mx + 5 - n \geq 0$. By using the same technique as the one used to solve the left inequality I got:
$\delta = m^2 - 40 + 8n \leq 0$
By combining these two resulted inequalities I got $m \leq 48$, that is $m \in [-4\sqrt3, 4\sqrt3]$.
Now I need to find the values of $m$ and $n$ so that $f$ is surjective, because it must take all the values in the given interval.
I don't know yet how to proceed, so I would appreciate any help from you guys!
Thank you!

Here's another way. Consider $\large y=\dfrac{3x^2+mx+n}{x^2+1}$. Rearranging, we have:
$$x^2(y-3)+-mx+(y-n)=0$$
Now, since $x$ has to be real (since domain of $y$ is $\mathbb{R}$), so we see that:
$$m^2 - 4(y-3)(y-n) \ge 0 \\
  \implies 4y^2-4(n+3)y+12n-m^2 \le 0 $$
Since $y$ is surjective, so the entire range of $y$ must be exactly $[-3,5]$, so our equation should be equivalent to $(y+3)(y-5)\le 0$, or:
$$4y^2-8y-60 \le 0$$
So we just compare the coefficients to get the two equations:
$$-4(n+3)=-8 \\
 12n-m^2= -60$$
Which gives:
$$ m=\pm 4\sqrt 3 \text{ and } n= -1$$
