Find the solutions for $a$, for which the function $f(x) $is non-decreasing I came across an example which asks to find all the values of $a$, for which the function $f:\mathbb{R}\rightarrow \mathbb{R}: x\mapsto e^x(ax^2+1)$ is non decreasing.
I derived it, $f'(x) = e^x(ax^2 +2ax + 1)$. I tried to approach it this way:
If the function is non decreasing, it's derivative, for all $x$-es, should be positive. Hence I put $f'(x) =0$.
Now $e^x > 0$, so $ax^2+2ax+1 = 0.$ and the discriminant is
$d= 4a^2 - 4a = 4a(a-1)$.
from now on, I don't know what to do. I understand that $0 $is a solution, when substituting in the function, yields $e^x$, which is nondecreasing on all of it's domain.
Thanks for help.
 A: You have got that $f'(x) \ge 0$, and that this means we should have $ax^2+2ax+1 \ge 0$.
Now one approach is to consider $ax^2+2ax+1 = a(x+1)^2+(1-a)$.  If $a$ is negative, as $x$ becomes large the first term will dominate and will be negative.  So we must have $a \ge 0$.  However note that if $a> 1$, the second term is negative and the first term vanishes when $x=-1$.  Hence we must have $a \in [0, 1]$.  A little more thought will be enough to say both terms are non-negative for all $a$ in that interval.
Another way is, we want the quadratic $ax^2+2ax+1$ to remain above the $X$-axis.  Now when $x=0$ it is evident the quadratic is above, so we need to ensure it never gets below the $X$-axis.  Which means it cannot have two distinct real roots, or that its discriminant cannot be positive.  Hence
$$\triangle = (2a)^2-4\cdot a\cdot 1 \le 0 \iff a(a-1) \le 0$$
Now break the real line into three intervals $a < 0, \; 0 \le a \le 1, \; a> 1$ and see when we have $a(a-1) \le 0$ or $a, a-1$ have opposite signs.
