Show that $\ln{(\cos{x})}=-\frac{x^2}{2}-x^4g(x),$ for $-\pi/4 \leq x\leq \pi/4.$ Problem: Show that $\ln{(\cos{x})}=-\frac{x^2}{2}-x^4g(x),$ for $-\pi/4 \leq x\leq \pi/4,$ where $1/12 \leq g(x) \leq 2/3.$
This is supposed to be done with McLaurin expansion. For $\ln{t}$ I have that
$$\ln{(1+t)} = t-\frac{t^2}{2}+O(t^3),$$
Setting $t=\cos{x}-1$ I get
$$t=\cos{x}-1=-\frac{x^2}{2}+O(x^4).$$
So
$$\ln{\cos{x}}=-\frac{x^2}{2}+O(x^4) - \frac{\left(-\frac{x^2}{2}+O(x^4)\right)^2}{2}+O(x^4)=$$
$$=-\frac{x^2}{2}+O(x^4).$$
Questions:


*

*Is my arithmetic correct using the ordo notation? For the big square, I thought that the lowest power is $x^4$ after expansion, so I put everything in $O(x^4).$

*How do I now show that the error should be in $[1/12,2/3]?$ I understand that  $O(x^4)=x^4g(x)$ where $g(x)$ is a bounded function, but I still don't get how I should prove this.

 A: $f(x)=\log\left(\cos x\right)$ is an analytic function in a neighbourhood of the origin and an even function. Additionally $f(0)=0$, so $f(x)=\sum_{n\geq 1} a_{2n} x^{2n}$. We have $a_2=\frac{1}{2}f''(0)=-\frac{1}{2}\sec^2(0)=-\frac{1}{2}$, so
$$ \log(\cos x) = -\frac{x^2}{2}-x^4 g(x) $$
where $g(x)$ is an analytic function in a neighbourhood of the origin. We may also notice that
$$ \log(\cos x)+\frac{x^2}{2}=\int_{0}^{x}z-\tan(z)\,dz $$
where $h(z)=\frac{z-\tan z}{z^3}$ is an even, negative and concave$^{(*)}$ function over $I=\left[-\frac{\pi}{4},\frac{\pi}{4}\right]$.
In particular $h(z)$ over $I$ is bounded between $\frac{16(\pi-4)}{\pi^3}$ and $-\frac{1}{3}$ and 
$$ \frac{1}{12}\leq g(x)\leq \frac{4(4-\pi)}{\pi^3}\leq\frac{1}{9}.$$

$(*)$ This follows from  well-known lemma, which is an interesting exercise in itself.

Given $f(x)=\tan(x)$, for any $k\in\mathbb{N}$ we have $f^{(2k+1)}(0)\in\mathbb{Z}^+.$

A: Let's expand $f(x)$ at 4th order by Taylor's series with Lagrange's remainder:
$$\log \cos x=\log (1-(1-\cos x))=\\\log1+\frac{-\tan0}{1!}x+\frac{-\sec 0}{2!}x^2+\frac{-2\tan0\sec^20}{3!}x^3+\frac{2(\cos (2\theta)-2)\sec^4 \theta}{4!}x^4=\\= -\frac{-x^2}{2}-x^4\left(\frac{-2(\cos (2\theta)-2)\sec^4 \theta}{4!}\right)= -\frac{-x^2}{2}-x^4g(\theta) \quad \theta\in\left[-\frac{\pi}{4},+\frac{\pi}{4}\right]$$
The function $g(\theta)$ is convex in the interval and:
$$\frac{1}{12}=g(0)\leq g(\theta)\leq g\left(\pm\frac{\pi}{4}\right)=\frac23$$
plot of $g(\theta)$
