Help with Maclaurin series of $\cos(\ln(x+1))$? Hi I've almost completed a maths question I am stuck on I just can't seem to get to the final result. The question is:
Find the Maclaurin series of $g(x) = \cos(\ln(x+1))$ up to order 3.
I have used the formulas which I won't type out as I'm not great with Mathjax yet sorry. But I have obtained:
$$ \ln(x+1) = x - \frac{x^2}{2} + \frac{x^3}{3} - \frac{x^4}{4} $$
$$ \cos x =   1 - \frac{x^2}{2} + \frac{x^4}{24} - \frac{x^6}{720} $$
I'm sure what I have done above is correct however I can't seem to get to the final solution shown in the answers and would like some help please. Thanks 
 A: Since you also don't need very high orders, the straightforward calculation of derivatives is tractable, though not preferable computationally.  If $f(x) = \cos \log(1+x)$, then $$f'(x) = -\frac{\sin \log (1+x)}{1+x}, \quad f'(0) = 0.$$  Then $$f''(x) = -\frac{\cos \log (1+x)}{(1+x)^2} + \frac{\sin \log(1+x)}{(1+x)^2}, \quad f''(0) = -1.$$  Finally, $$f'''(x) = \frac{\sin \log(1+x)}{(1+x)^3} + \frac{2\cos \log(1+x)}{(1+x)^3} + \frac{\cos \log(1+x)}{(1+x)^3} - \frac{2 \sin \log (1+x)}{(1+x)^3}, \quad f'''(0) = 3.$$  Then $$f(x) = f(0) + \frac{f'(0)}{1!}x + \frac{f''(0)}{2!}x^2 + \frac{f'''(0)}{3!}x^3 + O(x^4) = 1 - \frac{x^2}{2} + \frac{x^3}{2} + O(x^4).$$
It is worth noting that $$f^{(n)}(x) = \frac{A_n \cos \log (1+x) + B_n \sin \log (1+x)}{(1+x)^n},$$ for suitable constants $A_n$, $B_n$.  A proof by induction is straightforward and yields insight into the recursion relations defining $\{(A_n, B_n)\}_{n \ge 1}$:  $$\begin{align*} f^{(n+1)}(x) &= -A_n \frac{\sin \log (1+x)}{(1+x)^{n+1}} - nA_n \frac{\cos \log (1+x)}{(1+x)^{n+1}} - n B_n \frac{\sin \log(1+x)}{(1+x)^{n+1}} + B_n \frac{\cos \log (1+x)}{(1+x)^{n+1}} \\
&= \frac{(B_n - nA_n) \cos \log(1+x) + (-A_n - nB_n)\sin \log(1+x)}{(1+x)^{n+1}}.
\end{align*}.$$  Therefore, $$\begin{align*} A_{n+1} & = -nA_n + B_n, \\ B_{n+1} &= -A_n - nB_n, \\ A_0 &= 1, \\ B_0 &= 0. \end{align*}$$  In matrix form, this recurrence is equivalent to $$\begin{bmatrix}A_{n+1} \\ B_{n+1}\end{bmatrix} = \begin{bmatrix} -n & 1 \\ -1 & -n \end{bmatrix} \begin{bmatrix} A_n \\ B_n \end{bmatrix},$$ consequently $$\begin{bmatrix}A_n \\ B_n\end{bmatrix} = M_n \begin{bmatrix} 1 \\ 0 \end{bmatrix},$$ where $$M_n = \prod_{k=0}^{n-1} \begin{bmatrix} -k & 1 \\ -1 & -k \end{bmatrix}$$ and $f^{(n)}(0) = A_n$.  This lets us continue our calculation of higher orders with relative ease if we keep track of the matrix product $M_n$, which is always of the form $$M_n = \begin{bmatrix} a & b \\ -b & a \end{bmatrix};$$ for example, $$M_3 = \begin{bmatrix} 3 & 1 \\ -1 & 3\end{bmatrix}, \quad M_4 = \begin{bmatrix} -3 & 1 \\ -1 & -3\end{bmatrix}\begin{bmatrix} 3 & 1 \\ -1 & 3\end{bmatrix} = \begin{bmatrix} -10 & 0 \\ 0 & -10 \end{bmatrix},$$ so that $A_4 = -10$ and the next coefficient is $-10/4! = -5/12$.
A: Since$$\cos x=1-\frac{x^2}2+\cdots,$$you have\begin{align}\cos\bigl(\log(x+1)\bigr)&=1-\frac12\left(x-\frac{x^2}2+\frac{x^3}3-\cdots\right)^2+\cdots\\&=1-\frac{x^2}2+\frac{x^3}2+\cdots\end{align}Note that this argument works because the series for $\log(x+1)$ has no constant term. A consequence of this is that no matter how more terms you use from both series, you will get no new term whose degree is smaller than $4$.
A: $f(x)=o(x^k)$ if:
$\underset{x\rightarrow 0}{\lim} \frac{f(x)}{x^k}=0$
Since smaller powers of $x$ matter more when tending to $0$, it essentially means that something is negligible relative  to $x^k$ when tending to $0$. Moreover by simple calculus one can see that if $f=o(x^m)$ and $g=o(x^\ell)$, then:
$f(x)+g(x)=o(x^{\min \{m,\ell \}  })$
And for $k<\ell$ we have that:
$a\cdot x^\ell = o(x^k)$
Therefore by uniqueness of the Taylor series, you want to write your function of the form:
$\cos \big( \ln(1+x) \big)= p_3(x)+o(x^3)$
Where $p_3$ is a polynomial of $x$ with degree at most $3$. If we denote by $T_m^f(x)$ the Taylor polynomial up to order $m$ at $0$. Then by your calculations:
$T_4^{\ln(x+1)}(x)=x-\frac{x^2}{2}+\frac{x^3}{3}-\frac{x^4}{4}\quad$ and $\quad T_6^{\cos(x)}(x)=1-\frac{x^2}{2}+\frac{x^4}{24}-\frac{x^6}{720}$
Then the function $T_6^{\cos(x)}\circ T_4^{\ln(x+1)}(x) $ is a polynomial, and if you erase the powers negligible to $x^3$ in the final polynomial, then you obtain the Taylor polynomial at $0$ of order $3$. In particular:
$\cos(\ln(1+x))= 1 - \Big( T_4^{\ln(x+1)}(x) \Big)/2 + \Big( T_4^{\ln(x+1)}(x) \Big)^4/24+o(x^4)=$ 
$=1- \frac{1}{2} \Big( x- \frac{1}{2} x^2+ +\frac{x^3}{3} +o(x^3) \Big)^2 +o(x^4)=$
$=1-\frac{1}{2} \Big( x^2- x^3 +o(x^3) \Big)+ o(x^4)= 1-\frac{x^2}{2}+\frac{x^3}{2}+o(x^3)$
Where I neglected things that I saw which were going to be of powers strictly greater than $3$.
I think it is helpful to go by this algorithm when unsure.
A: A heuristic way using complex numbers that's related to one of the other answers: define
$$\begin{align}
f(x)&=\cos\ln(1+x) \\
g(x)&=\sin \ln(1+x)\text{.}
\end{align}$$
Then
$$\begin{align}f(0)+\mathrm{i}g(0)&=1\\
(f+\mathrm{i}g)'&=\frac{\mathrm{i}(f+\mathrm{i}g)}{1+x}
\end{align}$$
so the left- and right-hand sides of
$$f(x)+\mathrm{i}g(x)=(1+x)^{\mathrm{i}}$$
coincide as formal power series in $x$. Thus
$$\begin{split}\cos \ln(1+x)&= 1 +\Re \mathrm{i} x+\Re \tfrac{\mathrm{i}(\mathrm{i}-1)}{2} x^2+\Re \tfrac{\mathrm{i}(\mathrm{i}-1)(\mathrm{i}-2)}{6} x^3+o(x^3)\\
&=1-\tfrac{x^2}{2}+\tfrac{x^3}{2}+o(x^3)\end{split}$$
