Let $f: \mathbb{D}\to \mathbb{R}$ be defined as $f(x)= \dfrac{x^2 + 2x+a}{x^2 +4x +3a},$ where D and R denote the domain of $f $ and the set of all real numbers respectively. If $f$ is surjective mapping then the range of $a$ is?
Attempt:
Set $y=\dfrac{x^2 + 2x+a}{x^2 +4x +a} $\
We get a quadratic in x: $$ x^2(y-1)+ x(4y-2)+3ay -a=0 $$, setting its discriminant $\ge 0$, I get $a \in (-\infty,0]\cup{[1, \infty)}$
But coefficient of $x$ $\ne 0$ $\implies a \ne \frac 4 3$
Intersection of the 2 sets, doesn't give the right answer for $a$, how do I solve it then?
Suppose that $D$ is the subset of $\mathbb{R}$ such that $f$ is well-defined.
Set $\displaystyle y=\frac{x^2+2x+a}{x^2+4x+3a}$.
Case (1) If $x^2+2x+a=0$ and $x^2+4x+3a=0$ have a common root $x=x_0$. Then $y$ can be written as
$$y=\frac{(x-x_0)(x+2+x_0)}{(x-x_0)(x+4+x_0)}=\frac{x+2+x_0}{x+4+x_0}$$
$y$ cannot be equal to $1$ and hence $f$ is not surjective.
$x^2+2x+a=0$ and $x^2+4x+3a=0$ have a common root $x=x_0$ when $x_0^2+2x_0+a=0=x_0^2+4x_0+3a$.This implies that $x_0=-a$.
So, $(-a)^2+2(-a)+a=0$.
$a=0$ or $a=1$.
Case (2) If $x^2+2x+a=0$ and $x^2+4x+3a=0$ does not have a common root. The $a\ne0$ and $a\ne1$
We have $(y-1)x^2+(4y-2)x+3ay-a=0$. As $x$ is real,
\begin{align*} (4y-2)^2-4(y-1)(3ay-a)&\ge0\\ 4y^2-4y+1-3ay^2+4ay-a&\ge0\\ (4-3a)y^2+(4a-4)y+(1-a)&\ge0 \end{align*}
The above inequality in $y$ should be satisfied by all $y\in\mathbb{R}$.
So, we need $4-3a>0$ and $(4a-4)^2-4(4-3a)(1-a)\le0$. Therefore, $\displaystyle a<\frac{4}{3}$ and
\begin{align*} 4a^2-8a+4-4+7a-3a^2&\le0\\ a^2-a&\le0\\ 0\le a&\le1 \end{align*}
$f$ is surjective if and only if $\displaystyle 0< a<1$.