# Strange behavior of composite MacLaurin Series

While answering a question about the MacLaurin Series Expansion of a composite function I noticed something strange I can not explain to myself. The task was to verify that the MacLaurin Series Expansion of $$\ln(1+\sin x)$$ is up to the fourth term given by

$$\ln(1+\sin x)=x-\frac{x^2}2+\frac{x^3}6-\frac{x^4}{12}+\left(\frac{x^5}{24}-\frac{x^6}{45}+\frac{61x^7}{5040}-\frac{17x^8}{2520}+\frac{277x^9}{72576}\cdots\right.$$

Not that hard actually. However, the OP tried something which made me smile in the first place but while examining his approach confuses me right away. Instead of computing the derivatives and evaluating them at $$0$$ he instead decided to just plug in the expansion of $$\sin x$$ as argument of the expansion of $$\log(1+x)$$. Well, apparently this works out; at least for a few terms!

Starting by using both, i.e. the one of the sine and the one of the logarithm, expansions up to the fifth term we obtain $$\ln(1+\sin x)=x-\frac{x^2}2+\frac{x^3}6-\frac{x^4}{12}+\frac{x^5}{24}+\color{red}{\frac{13x^6}{90}+\cdots}$$ I have marked the first erroneous term. At this point I though it was only a coincidence that this naïve approach leads to the right solution. So I tried the same with more terms, to be precise with both expansions up to the ninth term from which I got the $$\ln(1+\sin x)=x-\frac{x^2}2+\frac{x^3}6-\frac{x^4}{12}+\frac{x^5}{24}-\frac{x^6}{45}+\frac{61x^7}{5040}-\frac{17x^8}{2520}+\frac{277x^9}{72576}+\color{red}{\frac{2773x^{10}}{28350}+\cdots}$$ Again, I marked the first erroneous term. Notice that it is the tenth term, i.e. the one for which the used series representations were not correct anymore (hence non-existing tenth term). At least the accurency of the so obtained series seems reasonable to me. However, I am totally confused concerning the fact that this ridiculous straightforward approach works out.

Quite simple question: Why? Furthermore, is this actually used somewhere?

Note that if $$f$$ is smooth in $$0$$, then for any natural $$k$$ there is unique polynomial $$t$$ of degree at most $$k$$ such that $$f(x) = t(x) + o(x^k)$$ (and this polynomial is exactly first $$k + 1$$ terms of Taylor expansion).

$$\sin(x) = P_k(x) + h_k(x)$$, where $$k$$ is polynomial of degree (at most) $$k$$ and $$h_k(x) = o(x^k)$$. Note that $$P_k$$ (and thus $$h_k$$) is determined uniquely.

Similarly we have $$\ln(1 + x) = Q_k(x) + g_k(x)$$.

Now, taking composition of two functions, we have \begin{align*} \ln(1 + \sin x) &= Q_k(\sin x) + g_k(\sin x)\\ &=Q_k(P_k(x)) + Q_k(h_k(x)) + g_k(P_k(x)) + g_k(h_h(x))+Q_k(P_k(x))\\ &~~~~+ o(x^k) + o(x^k) + o(x^k) \end{align*} Now, $$Q_k(P_k(x)) = R_k(x) + o(x^k)$$, where $$R_k$$ is polynomial we get from $$Q_k(P_k(x))$$ by removing coefficients at degrees greater than $$k$$. So we finally have $$\ln(1 + \sin x) = R_k + o(x^k)$$ - thus $$R_k$$, that we got as first $$k$$ terms from substitution $$k$$-th Taylor polynomial of $$\sin x$$ into $$k$$-th Taylor polynomial of $$\ln(1 + x)$$, is exactly $$k$$-th Taylor polynomial of $$\ln(1 + \sin x)$$.

Alternatively you can note that in first $$k$$ terms of Taylor expansion of $$f(g(x))$$ derivatives of order higher then $$k$$ of $$f$$ or $$g$$ are not used, so you can replace $$f$$ and $$g$$ with any functions with the same derivatives of order up to $$k$$ - for example, their Taylor polynomials.

It's quite standard way to find Taylor series of composition of functions.

• Thank you for your quick response! I have never encoutered this technique before which may be the reason for my scepticism. Apr 28, 2019 at 10:37