Given some $$f(x)$$, what’s the taylor series of $$f(x)^p$$ for some real $$p$$ around $$x=0$$? One can always calculate derivatives by hand, but we’d present a more intuitive method.

For the sake of simplicity, we will assume that $$f(x)>0$$ on a small ball around $$x=0$$. The idea is that we express $$f(x)^p = f(0)(1+h(x))^p$$ for some $$h(x)$$ derived from the taylor series of $$f(x)$$. Then we use the taylor series of $$(1+x)^p$$ around $$x=0$$ to deduce the taylor series of $$f(x)^p$$. Even though this sounds abstract, this might be what you are used to doing unconciously anyways.

Example: What’s the taylor series of $$\cos^2 x$$? We know that $$\cos x = 1 - \frac{x^2}{2} + O(x^4).$$ From binomial expansion we also know $$(1+x)^2 = 1+2x+x^2.$$ So

\begin{align*} \cos^2 x &= \left(1-\tfrac{x^2}{2} + O(x^4)\right)^2 \\ &= \left(1-\tfrac{x^2}{2}\right)^2 + O(x^4) \\ &= 1 - x^2 + O(x^4). \\ \end{align*}

We were able to simplify $$(1-\tfrac{x^2}{2} + O(x^4))^2$$ into $$(1-\tfrac{x^2}{2})^2 + O(x^4)$$ because any cross term that involves $$O(x^4)$$ is going to be $$O(x^4)$$.

This is evidently quicker than finding the first and second derivative of $$\cos^2 x$$ at $$x=0$$.

Example: What’s the taylor series of $$\frac{1}{\cos x}$$? From geometric series, we know that $$\frac{1}{1-x} = 1 + x + x^2 + O(x^3)$$. So

\begin{align*} 1/{\cos x} &= 1/(1 - (\tfrac{x^2}{2} + O(x^4))) \\ &= 1/(1-\tfrac{x^2}{2}) + O(x^4) \\ &= 1 + \tfrac{x^2}{2} + O(x^4). \end{align*}

We were able to simplify $$1/(1 - \tfrac{x^2}{2} + O(x^4))$$ into $$1/(1-\tfrac{x^2}{2}) + O(x^4)$$ for a similar reason to the previous example. Any cross term involving $$O(x^4)$$ in the geometric series is going to be of $$O(x^4)$$ and can be ignored.

We could’ve reasonbly guessed this expression from the previous example as $$\cos x \tfrac{1}{\cos x} = 1$$ and $$(1+\tfrac{x^2}{2})(1-\tfrac{x^2}{2}) = 1 + O(x^4)$$.

Non-integer exponents

We will make use of the following. Let $$p$$ be a real number. Then for $$x \in (-1, 1)$$, then the taylor series of $$(1+x)^p$$

$(1+x)^p = 1 + px + \tfrac{p(p-1)}{2!}x^2 + \tfrac{p(p-1)(p-2)}{3!}x^3 + \dots$

Intuitively we can deduce the above by repeatedly taking derivatives of $$(1+x)^p$$ and evaluating it at $$x=0$$ (Similar to calculating expectations from probability generating functions).

If $$p$$ is an integer, the above reduces to the binomial theorem. For example,

\begin{align*}(1+x)^3 &= 1 + 3x + \tfrac{3(3-1)}{2!} x^2 + \tfrac{3(3-1)(3-2)}{3!}x^3 + \dots \\ &= 1 + 3x + 3x^2 + x^3. \end{align*}

With this at hand, we can deduce even more taylor series.

Example: What’s the taylor series of $$\sqrt{\cos x}$$? We now know that $$\sqrt{1+x} = 1 + \tfrac{1}{2}x + O(x^2)$$. So

\begin{align*} \sqrt{\cos x} &= \sqrt{1-\tfrac{x^2}{2} + O(x^4)} \\ &= \sqrt{1-\tfrac{x^2}{2}} + O(x^4) \\ &= 1 - \tfrac{x^2}{4} + O(x^4). \\ \end{align*}

Example: What’s the taylor series of $$1/\sqrt{\cos x}$$? We now know that $$1/\sqrt{1+x} = 1 - \tfrac{1}{2}x + O(x^2)$$. So

\begin{align*} 1/\sqrt{\cos x} &= 1/\sqrt{1-\tfrac{x^2}{2} + O(x^4)} \\ &= 1/\sqrt{1-\tfrac{x^2}{2}} + O(x^4) \\ &= 1 + \tfrac{x^2}{4} + O(x^4). \\ \end{align*}

We could’ve reasonbly guessed this expression from the previous example as $$\sqrt{\cos x} \frac{1}{\sqrt{\cos x}} = 1$$ and $$(1+x^2)(1-x^2) = 1 + O(x^4)$$.

You may find the general Leinbiz rule interesting. We can also formulate the taylor series of $$(1+x)^p$$ using Gamma functions.

Going further

More generally one can ask what the taylor series of $$f(g(x))$$ around $$x=0$$. Again we can get an explicit formula by calculating derivatives using the product rule, but for most cases better methods apply. Again we will assume $$f(x), g(x) > 0$$ on a ball around $$x=0$$.

Example: What’s the taylor series of $$\cos\left(\cos x\right)$$ around $$x=0$$? We have

\begin{align*} \cos\left(\cos x\right)&= \cos\left(1 - \tfrac{x^2}{2} + O(x^4)\right). \\ \end{align*}

Evidently we need the taylor series of $$\cos x$$ around $$x=1$$. We can compute that $$\cos(1+x) = \cos(1) - \sin(1) x + O(x^2)$$. As such

\begin{align*} \cos\left(\cos x\right)&= \cos(1) + \sin(1) \tfrac{x^2}{2} + O(x^4). \\ \end{align*}

In essence, you can deduce the chain rule using taylor series. Given $$f(g(x))$$, we can taylor expand it around some $$x=a$$. We will make use of two taylor series—The taylor series of $$g(x)$$ around $$x=a$$ and the taylor series of $$f(x)$$ around $$x=g(a)$$.

\begin{align*} g(a+x) &= g(a) + g'(a)x + O(x^2), \\ f\left(g(a)+x\right) &= f(g(a)) + f'(g(a))x + O(x^2). \end{align*}

Hence

\begin{align*} f(g(x+a)) &= f\left(g(a) + g'(a)x + O(x^2)\right) \\ &= f\left(g(a) + g'(a)x\right) + O(x^2) \\ &= f(g(a)) + f'(g(a))g'(a)x + O(x^2). \end{align*}