# Analyze the monotony of this function - I almost got it

Analyze the monotony of $f(x) = (1+x+\frac{1}{2}x^{2})e^{-x}$

To analyze the monotony of a function, you can build the first derivation of the function, equalize it with $0$ and if the (derivative) function is larger than $0$, then it's strictly monotonic increasing, if smaller then it's strictly monotonic decreasing. What happens if you get $0$? Then you cannot say anything about the monotony? Because for this function, I get $f'(x) = 0$

Maybe I did a mistake?

$f'(x) = (1+x)e^{-x} + (1+x+\frac{1}{2}x^{2})(-e^{-x})$

$= e^{-x}(1+x-(1+x+\frac{1}{2}x^{2}))$

$= e^{-x}(1+x-1-x-\frac{1}{2}x^{2})$

$= -\frac{1}{2}x^{2}e^{-x}$

$f'(x) = 0$

$0 = -\frac{1}{2}x^{2}e^{-x}$

$0 = x^{2}e^{-x}$

$0 = x^{2}$

$x = 0$

The task also was "analyze" and not "is it strictly monotonic... or...?" so it might be alright if I get a solution like that. Anyway, I'd like to know what happens in a case like that if you get $x = 0$ and if my solution is correct.

Edit: Sorry for the first delete, I thought I found my mistake (still not sure if there is one) and thus deleted my question immediately.

Everything looks fine so far. What you found is that $f(x)$ is neither increasing nor decreasing exactly at $x = 0$. So what you should do next is determine what's going on with $f'(x)$ (i.e., is $f'(x)$ positive or negative) when $x > 0$ and when $x < 0$.
In this case it's pretty simple because $f'(x) = -\frac{1}{2}x^2e^{-x}$. Note that $-1/2 < 0$, and $x^2 e^{-x} > 0$ for all $x \ne 0$. Therefore...