I found this problem in a book and I cannot solve it. Find $a, b \in \mathbb{R}$ sucht that $f:\mathbb{R} \rightarrow [-1, 1], \ f(x) = \frac{ax + b}{x^2 + 1}$ is surjective.
I have tried to do it the usual way: for every $y \in [-1, 1]$, there is a $x \in \mathbb{R}$ such that $f(x) = \frac{ax + b}{x^2 + 1} = y$ and solved the equation: $$x = \frac{a \pm \sqrt {a^2 - 4y^2 + 4b}}{2y}$$ Now, for every $x \in \mathbb{R}$, it exists a $y\in \mathbb{R}$, such that $\frac{a \pm \sqrt{a^2 - 4y^2 + 4b}}{2y}$, but I could not continue with this idea.
Another idea was set $f(x) \ge -1$ and $f(x) \le 1$. I get 2 quadratics to be greater than $0$, which means $\Delta \le 0$ and such I get a system of 2 quadratic inequations in $a$. But this does not guarantee the fact that the whole interval $[-1, 1]$ is covered.
Have you got any idea?
If $a=0$, no $b$ exists such that $f(\Bbb R)=[-1,1]$, because if $b\geqslant0$, then $(\forall x\in\Bbb R):f(x)\geqslant0$ and if $b\leqslant0$, then $(\forall x\in\Bbb R):f(x)\leqslant0$.
Now, suppose that $a>0$. Note that$$f'(x)=\frac{-a x^2-2 b x+a}{\left(x^2+1\right)^2}$$and that therefore$$f'(x)=0\iff x=\frac{-b\pm\sqrt{a^2+b^2}}a.$$So, since $a>0$, $f$ is decreasing on $\left(-\infty,\frac{-b-\sqrt{a^2+b^2}}a\right]$ and on $\left[\frac{-b+\sqrt{a^2+b^2}}a,\infty\right)$ and increasing on $\left[\frac{-b-\sqrt{a^2+b^2}}a,\frac{-b+\sqrt{a^2+b^2}}a\right]$. But$$f\left(\frac{-b-\sqrt{a^2+b^2}}a\right)=\frac{b-\sqrt{a^2+b^2}}2\quad\text{and}\quad f\left(\frac{-b+\sqrt{a^2+b^2}}a\right)=\frac{b+\sqrt{a^2+b^2}}2.$$So, you must have$$\frac{b-\sqrt{a^2+b^2}}2=-1\quad\text{and}\quad\frac{b+\sqrt{a^2+b^2}}2=1.$$If you add these equalities, you get that $b=0$. It follows now that $a=2$.
The case in which $a<0$ is similar.