# How to compute power series by composition

Is it possible to compute the power series of every function (e.g. around $0$) just by composing of the power series of its arguments?

For example:
The power series of $\sin(x^2)$ around $0$ is the composition of power series of $\sin(x)$ and $x^2$: $compose(x-\frac{x^3}{6}+\frac{x^5}{120}+..., x^2) = x^2 - \frac{x^6}{6} + \frac{x^{10}}{120}+...$

If the answer to my question is "yes", then how would you compute the power series of $\sqrt{\cos(x)}$? Because $\sqrt{x}$ doesn't have a power series expansion around $0$ and you can't simply compose the power series of $\sqrt{x}$ and that one of $\cos(x)$ to find the expansion of $\sqrt{\cos(x)} = 1-\frac{x^2}{4}-\frac{x^4}{96}+O\left(x^5\right)$.

• Yeah, the problem is, $\sqrt{x}$ doesn't have a power series around $0$, but $\cos 0=1$ and $\sqrt{x}$ has a Talyor series around $1$. Although composing is still hard. – Thomas Andrews Jul 15 '14 at 14:21
• In general, if $g(0)=0$ and you know the power series for $f(x)$ and $g(x)$ at zero, you can get the power series for $f(g(x))$ this way, but it is a painful exercise. – Thomas Andrews Jul 15 '14 at 14:23
• But how would you find the taylor series of $\sqrt{x}$ around $1$? – Andrei Kh Jul 15 '14 at 14:23
• $$\sqrt{1+x}=(1+x)^{1/2}= \sum_{k=0}^\infty \binom{1/2}{k} x^k$$ – Thomas Andrews Jul 15 '14 at 14:25
• For comparison, note that $\sqrt{\sin{x}}$ has no power series around 0 (though $\sqrt{\sin{x}/x}$ does). – Semiclassical Jul 15 '14 at 15:33

In general, to get the power series (or Taylor series at $x=0$) for $f(g(x))$ we need the Taylor series for $g(x)$ around $0$ and the Talyor series of $f(x)$ around $g(0)$.

In the case of $\sqrt{\cos x}$, that means $f(x)=\sqrt{x}$ needs a Taylor series for $\sqrt{x}$ around $x=1$, which is:

$$\sqrt{x} = \sum_{k=0}^\infty \binom{1/2}{k} (x-1)^k$$

Even if you know $g(x)$ is a simple polynomial, like $a+x$, and $f(x)=\sum a_kx^k$, it is hard to compute the coefficient of $x^1$ when you expand:

$$\sum_{k} a_k(a+x)^k$$

If we just try to naively combine terms, we get the coefficient for $x$ is:

$$\sum_{k} ka^{k-1}a_k$$

which might not even converge.

E.g., Let $f(x)=\frac{1}{1-x}=\sum x^k$ and $g(x)=a+x$ with $|a|>1$. If you naively try to expand:

\begin{align}f(g(x))&=\sum (a+x)^k \\&= \sum_k \sum_j \binom{k}{j}a^{k-j}x^j \\ &=\sum_{j=0}^\infty x^j\left(\sum_{l=0}^\infty a^l\binom{j+l}{j}\right) \end{align}

But that expression for the coefficient of $x^j$ doesn't converge, ever, when $|a|\geq 1$.

But there is a power series for this function: \begin{align}f(g(x))&=\frac{1}{1-(x+a)}=\frac{1}{(1-a)-x}\\ &= \frac{1}{1-a}\frac{1}{1-\frac{x}{1-a}}\\ &=\frac{1}{1-a}\sum_k \left(\frac{x}{1-a}\right)^{k}\\ &=\sum_k \left(\frac{1}{1-a}\right)^{k+1}x^k \end{align}

On the other hand, when $g(0)=0$, there are only finitely many terms contributing to $x^j$ - in particular, you only need to know the power series for $g(x),g(x)^2,\dots,g(x)^j$ and the power series for $f(x)$ to determine the coefficient of $x^j$ in $f(g(x))$.

So if $g(0)=a$ then we can define $g_1(x)=g(x)-a$ and $f_1(x)=f(x+a)$. Then $f_1(g_1(x))=f(g(x))$. Knowing the power series of $g(x)$ give us the power series for $g_1(x)$ with a zero constant coefficient, and the power series for $f_1$ is essentially the Taylor series for $f(x)$ at $x=a$.

Alternatively, if $h(x)=f(g(x))$, then the power series for $h$ at $x=0$ is $\sum_k \frac{h^{(k)}(0)}{k!}x^k$, and $h^{(k)}(0)$, we can show inductively, using the chain rule, depends on $g^{(i)}(0)$ and $h^{(j)}(g(0))$ for $0\leq i,j\leq k$. That show why the coefficients for $h$ depend on the power series for $g(x)$ at $x=0$ and the power series for $f(x)$ at $x=g(0)$.

• Thanks. But how would you compute a taylor series of a general function $f(x)$ at a point $a$ if you know the series expansion of $f(x)$ at $0$ using composition? (or is it impossible?) – Andrei Kh Jul 15 '14 at 14:40
• An interesting side note; It is easy to get a power series for $\cos\sqrt{x}$ since the power series for $\cos x$ has only even powers of $x$. But there is no power series for $\sqrt{x}$ at $x=0$, so it would not be possible to do that composition this way. – Thomas Andrews Jul 15 '14 at 15:04
• Tha Taylor series for $f(x)$ at $a$ is the Taylor series of $f(y+a)$ at $y=0$, then substituting $y=x-a$. So: $$f(x)=\sum_{k=0}^\infty \frac{f^{(k)}(a)}{k!}(x-a)^k$$ See Wikipedia definition. – Thomas Andrews Jul 15 '14 at 15:14

Use the series for $\sqrt{1+x}$ and $\cos x - 1$ $$\sqrt{1+x} = 1+\frac{1}{2}x-\frac{1}{8}x^2+\frac{1}{16}x^3\pm\dots$$ $$\cos x - 1 = -\frac{1}{2}x^2+\frac{1}{24}x^4 \pm \dots$$ Now substitute the second into the first:

$$\sqrt{\cos x} =\sqrt{1 + (\cos x-1)} \\= 1+\frac{1}{2}\left(-\frac{1}{2}x^2+\frac{1}{24}x^4\pm \dots\right) -\frac{1}{8}\left(-\frac{1}{2}x^2+\frac{1}{24}x^4 \pm\dots\right)^2+ \dots\\ = 1-\frac{1}{4}x^2-\frac{1}{96}x^4 \pm \dots$$