Taylor series of a composed function

What is the approach to use to find the Taylor series (not just the first terms of the Taylor polynomial) of a composed function?

Take for example $$f(x)=e^{\mathrm{cos} x}$$

If I set $t=\mathrm{cos} x$, then I can find

$$f(x)=\sum_{n \geq 0} \frac{({\mathrm{cos}\, x})^n}{n!} \,\,\, \forall x \in \mathbb{R}$$

But this is not the Taylor power series for $f(x)$. So how can one determine the power series of the type $\sum_{n \geq 0}a_n x^n$ such that:

$$f(x)=\sum_{n \geq 0}a_n x^n$$

• What is the problem with using the formula for the Taylor series directly? Just take derivatives and evaluate them? Alternately, you could expand the Taylor series for $\cos(x)$ in your Taylor series and collect terms based on the powers of $x$. – Michael Burr Nov 15 '16 at 13:30
• Hint: plug in the expansion of cosine and expand. – Simply Beautiful Art Nov 15 '16 at 14:36

Call $g(x) = \cos(x)$, so that $f(x) = e^{g(x)}$. Note that

$$\frac{df(x)}{dx} = e^{g(x)}\frac{dg(x)}{dx}$$

so that, using Leibniz rule we get

\begin{eqnarray} \frac{d^{2n+1}}{dx^{2n+1}}\frac{d}{dx}f(x) &=& \sum_{k=0}^{2n+1}\left(\begin{array}{c}2n+1 \\ k\end{array}\right) \frac{d^k}{dx^k}f(x) \frac{d^{2n+1-k}}{dx^{2n+1-k}}\frac{d}{dx}g(x) \\ \frac{d^{2n+2}}{dx^{2n+2}}f(x) &=& \sum_{k=0}^{2n+1}\left(\begin{array}{c}2n+1 \\ k\end{array}\right) \frac{d^k}{dx^k}f(x) \frac{d^{2n+2-k}}{dx^{2n+2-k}}g(x) \tag{1} \end{eqnarray}

Note that for this case

$$\left.\frac{d^{2k}}{dx^{2k}}g(x)\right|_{x=0} = (-1)^k \quad\mbox{and}\quad \left.\frac{d^{2k+1}}{dx^{2k+1}}g(x)\right|_{x=0}=0$$

So at $x=0$ all terms for $k$ odd in the r.h.s of (2) vanish, leading to

$$\left. \frac{d^{2n+2}}{dx^{2n+2}}f(x)\right|_{x=0} = -\sum_{k=0}^{n}(-1)^{n-k}\left(\begin{array}{c}2n+1 \\ 2k\end{array}\right) \left.\frac{d^{2k}}{dx^{2k}}f(x)\right|_{x=0} \tag{2}$$

If you call $\alpha_n = d^nf(0)/dx^n$ we get the recurrence expression:

$$\alpha_{2n+2} = -\sum_{k=0}^{n}(-1)^{n-k}\left(\begin{array}{c}2n+1 \\ 2k\end{array}\right) \alpha_{2k} \tag{3}$$

and $\alpha_k=0$ for $k$ odd. Here are a few terms

\begin{align} \alpha_0 = e \\ \alpha_2 = -e \\ \alpha_4 = 4e \\ \alpha_6 = -31e \\ \cdots \end{align}

The Taylor expansion around $x=0$ of $f(x)$ is then

$$f(x) = \sum_{k=0}^{+\infty}\frac{\alpha_{2k}}{(2k)!}x^{2k}$$