Let $f(x) = \ln(1 + x + x^2/2) - \sin(x)$
Determine if $f$ has a local maximum or minimum in $x=0$.
My approach:
Set $u(x) = x + x^2/2$
I know the Maclaurin series
$\ln(1+x) = x - x^2/2 + x^3/3 + ... + (-1)^{n-1}x^n/n + \mathcal{O}(x^{n+1})$
And because of properties of $u$ it follows that $\ln(1+x+x^2/2) = \ln(1+u(x)) = u(x) + \mathcal{O}(u(x)^2) = x + x^2/2 + \mathcal{O}(x^2)$
And by the maclaurin series for $\sin(x) = x - x^3/3! + x^5/5! -...$ it follows that
$f(x) = x + x^2/2 + \mathcal{O}(x^2) - \sin(x) = x + x^2/2 + \mathcal{O}(x^2) - (x + \mathcal{O}(x^3)) = x^2/2 + \mathcal{O}(x^2) = x^2(1/2 + \mathcal{O}(1))$
So for $x$ near $0$ $f(x) > 0$ and $f(0) = 0$, so $0$ is a local minimum.
The books answer is that it is a local minimum, but it says that $f(x) = x^4/8 + \mathcal{O}(x^5)$ for $x$ close to $0$ which makes me suspect that I've solved the problem in the wrong way. The only way I can think of to arrive at the books answer is by expanding $\ln(1+u(x))$ up to order $4$ but that would become a lot more calculations than I've done in my solution. So I wonder if my solution is correct and if the way to arrive at the books answer is to expand the series for $\ln(1 + u(x))$ up to order 4?
\begin{align}\ln (1+x+x^2/2)&=(x+x^2/2)-\frac{(x+x^2/2)^2}{2}+\frac{(x+x^2/2)^3}3-\frac{(x+x^2/2)^4}4+O(x^5)\\ &=x+\left(\frac{1}2-\frac{1}2\right)x^2+\left(-\frac12+\frac13\right)x^3+\left(-\frac18 +\frac12-\frac14\right)x^4+O(x^5)\\ &=x-\frac16x^3+\frac18x^4 + O(x^5)\end{align}
Also, $\sin(x) = x-\frac{x^3}6+O(x^5)$
Hence $$\ln (1+x+x^2/2) - \sin (x) = \frac18x^4+O(x^5).$$