Manipulating Taylor Series

by Justin Skycak on

To find the Taylor series of complicated functions, it's often easiest to manipulate the Taylor series of simpler functions.

This post is a chapter in the book Justin Math: Calculus. Suggested citation: Skycak, J. (2019). Manipulating Taylor Series. Justin Math: Calculus. https://justinmath.com/manipulating-taylor-series/


To find the Taylor series of complicated functions, it’s often easiest to manipulate the Taylor series of simpler functions, such as those given below.

$\begin{align*} & \frac{1}{1-x} = \sum_{n=0}^\infty x^n \hspace{.5cm} (-1 < x < 1) \\ & e^x = \sum_{n=0}^\infty \frac{x^n}{n!} \hspace{.5cm} (-\infty < x < \infty) \\ & \ln (1+x) = \sum_{n=1}^\infty \frac{(-1)^{n+1} }{n} x^n \hspace{.5cm} (-1 < x \leq 1) \\ & \sin x = \sum_{n=0}^\infty \frac{(-1)^{n} }{(2n+1)!} x^{2n+1} \hspace{.5cm} (-\infty < x < \infty) \\ & \cos x = \sum_{n=0}^\infty \frac{(-1)^n }{(2n)!}x^{2n} \hspace{.5cm} (- \infty < x < \infty) \\ & \arctan x = \sum_{n=0}^\infty \frac{(-1)^n }{2n+1}x^{2n+1} \hspace{.5cm} (- 1 \leq x \leq 1) \end{align*}$


Multiplying by a Constant

For example, to compute the Taylor series of $xe^x$ centered at $x=0$, we can take the elementary Taylor series $e^x=\sum_{n=0}^\infty \frac{x^n}{n!}$ and multiply it by $x$.

$\begin{align*} xe^x &= x \sum\limits_{n=0}^\infty \frac{x^n}{n!} \\ &= \sum\limits_{n=0}^\infty \frac{x^{n+1} }{n!} \end{align*}$


Though not strictly necessary, we can make the exponent on the match the index of summation by changing the index of summation to $k=n+1$.

$\begin{align*} xe^x = \sum\limits_{k=1}^\infty \frac{x^{k} }{(k-1)!} \end{align*}$


In this case, since we are multiplying the series by a constant, the interval of convergence of the series will stay the same: $-\infty < x < \infty$.

This is because a convergent series has a finite sum, and multiplying by a constant cannot cause a finite number to become infinite; whereas a divergent series has an infinite sum, and multiplying by a constant cannot cause an infinite number to become finite.

Multiplying Two Series

Similarly, to compute the Taylor series of $\frac{e^x}{1-x}$ around $x=0$, we can multiply the two elementary Taylor series $e^x = \sum_{n=0}^\infty \frac{x^n}{n!}$ and $\frac{1}{1-x} = \sum_{n=0}^\infty \frac{x^n}{n!}$.

$\begin{align*} \frac{e^x}{1-x} &= \left( \sum\limits_{n=0}^\infty \frac{x^n}{n!} \right) \left( \sum\limits_{k=0}^\infty x^k \right) \\ &= \sum\limits_{n,k=0}^\infty \frac{x^{n+k} }{n!} \end{align*}$


Defining a new index of summation $m=n+k$, we can write the series in order of increasing powers of $x$.

$\begin{align*} \frac{e^x}{1-x} &= \sum\limits_{n,k=0}^\infty \frac{x^{n+k} }{n!} \\ &= \sum\limits_{m,k=0}^\infty \frac{x^m}{(m-k)!} \\ &= \sum\limits_{m=0}^\infty \left( \sum\limits_{k=0}^m \frac{1}{(m-k)!} \right) x^m \end{align*}$


The interval of convergence of a product of series is at least the intersection of the series’ individual intervals of convergence.

Here, recalling that the interval of convergence of the Taylor series of $e^x$ is $(-\infty,\infty)$ and the interval of convergence of the Taylor series of $\frac{1}{1-x}$ is $(-\infty, \infty)$, we determine that the interval of convergence for the Taylor series of $\frac{e^x}{1-x}$ must be at least the intersection $(-\infty, \infty) \cap (-1,1) = (-1, 1)$.

If we go through the trouble of performing a test of convergence, it’s possible that we might find a larger interval of convergence – but just based on the intervals of convergence of the two series being multiplied, we can say with certainty that the product converges for at least $-1 < x < 1$, without needing to perform any tests of convergence.

Adding Two Series

Sometimes, we can take advantage of the fact that it’s easier to add or subtract series than to multiply series.

For example, to find the Taylor series of $e^x(1-e^x)$ around $x=0$, one option is to multiply the Taylor series of $e^x$ and $1-e^x$.

However, an easier route is to simplify the expression to $e^x-e^{2x}$, and then subtract the Taylor series of $e^{2x}$ from the Taylor series of $e^x$. To compute the Taylor series of $e^{2x}$, we can substitute $2x$ for $x$ in the Taylor series of $e^x$.

$\begin{align*} e^{x}&=\sum_{n=0}^\infty \frac{x^n}{n!} \\ e^{2x}&=\sum_{n=0}^\infty \frac{(2x)^n}{n!} \\ e^{2x}&=\sum_{n=0}^\infty \frac{2^n}{n!} x^n \end{align*}$


Then, we can proceed with subtracting the Taylor series.

$\begin{align*} e^x(1-e^x) &= e^x-e^{2x} \\ &= \sum_{n=0}^\infty \frac{x^n}{n!} - \sum_{n=0}^\infty \frac{2^n}{n!} x^n \\ &= \sum_{n=0}^\infty \frac{x^n}{n!} - \frac{2^n}{n!} x^n \\ &= \sum_{n=0}^\infty \left( \frac{1}{n!} - \frac{2^n}{n!} \right) x^n \\ &= \sum_{n=0}^\infty \frac{1-2^n}{n!} x^n \end{align*}$


Again, the interval of convergence of a sum or difference of series is at least the intersection of the series’ individual intervals of convergence.

The series for $e^x$ converges for $-\infty < x < \infty$, so the series for $e^{2x}$ converges for $-\infty < 2x < \infty$, which simplifies to $-\infty < x < \infty$. The intersection is given by $(-\infty, \infty) \cap (-\infty, \infty) = (-\infty, \infty)$, so the interval of convergence of the series for $e^x-e^{2x}$ is at least $-\infty < x < \infty$.

Note that this interval contains all real numbers, so the interval can’t get any bigger. Thus, the interval of convergence of the series for $e^x-e^{2x}$ is $-\infty < x < \infty$.

Using Differentiation and Integration

We can also use differentiation and integration to simplify the process of finding Taylor series. For example, to find the Taylor series of $\sin^2 x$, one option is to multiply the series of $\sin x$ by itself – but an easier option is to differentiate to yield a simpler result, then find the Taylor series of the simpler result, and then integrate the Taylor series to get back to the original function.

$\begin{align*} (\sin^2 x)' &= 2 \sin x \cos x \\ (\sin^2 x)' &= \sin 2x \\ (\sin^2 x)' &= \sum_{n=0}^\infty \frac{(-1)^n}{(2n+1)!}(2x)^{2n+1} \\ (\sin^2 x)' &= \sum_{n=0}^\infty \frac{(-1)^n2^{2n+1}}{(2n+1)!}x^{2n+1} \\ \int (\sin^2 x)' \, dx &= \int \sum_{n=0}^\infty \frac{(-1)^n(2)^{2n+1}}{(2n+1)!}x^{2n+1} \, dx \\ \sin^2 x &= C+ \sum_{n=0}^\infty \frac{(-1)^n(2)^{2n+1}}{(2n+1)!(2n+2)}x^{2n+2} \\ \sin^2 x &= C+ \sum_{n=0}^\infty \frac{(-1)^n(2)^{2n+1}}{(2n+2)!}x^{2n+2} \end{align*}$


To solve for the constant of integration, we can substitute $x=0$.

$\begin{align*} \sin^2 0 &= C+ \sum_{n=0}^\infty \frac{(-1)^n(2)^{2n+1}}{(2n+2)!}(0)^{2n+2} \\ 0 &= C + \sum_{n=0}^\infty 0 \\ 0 &= C \end{align*}$


Thus, we have

$\begin{align*} \sin^2 x &= \sum_{n=0}^\infty \frac{(-1)^n(2)^{2n+1}}{(2n+2)!}x^{2n+2}. \end{align*}$


Though not strictly necessary, we can clean up the series a bit by changing the index of summation to $k=n+1$.

$\begin{align*} \sin^2 x &= \sum_{k=0}^\infty \frac{(-1)^{k-1}(2)^{2k-1}}{(2k)!}x^{2k} \end{align*}$


Neither differentiating nor integrating a Taylor series changes its interval of convergence, so the interval of convergence of the series for $\sin^2 x$ is the same as the interval of convergence of the series for $\sin 2x$, which is $-\infty < x < \infty$.

Substitution

In the previous examples, we computed the series for $\sin 2x$ and $e^{2x}$ by substituting $2x$ for $x$ in the series for $\sin x$ and $e^x$. We can extend this idea to more clever substitutions.

For example, to compute the series of the function $\frac{1}{2+x^5}$, we can substitute $-\frac{x^5}{2}$ for $x$ in the elementary series $\frac{1}{1-x} = \sum_{n=0}^\infty x^n$.

$\begin{align*} \frac{1}{2+x^5} &= \frac{1}{2} \cdot \frac{1}{1- \left( -\frac{x^5}{2} \right)} \\ &= \frac{1}{2} \sum_{n=0}^\infty \left( -\frac{x^5}{2} \right)^n \\ &= \sum_{n=0}^\infty \frac{(-1)^n}{2^{n+1} } x^{5n} \end{align*}$


After substitution, the interval of convergence becomes $-1 < -\frac{x^5}{2} < 1$, which simplifies to $-\sqrt[5]{2} < x < \sqrt[5]{2}$.

Exercises

Compute the Taylor series for the following functions, centered at $x=0$. (You can view the solution by clicking on the problem.)

$\begin{align*} 1) \hspace{.5cm} f(x) = x \ln (1+x^2) \end{align*}$
Solution:
$\begin{align*} &\sum\limits_{n=1}^\infty \frac{(-1)^{n+1} }{n}x^{2n+1} \\ & -1 < x \leq 1 \end{align*}$


$\begin{align*} 2) \hspace{.5cm} f(x) = \frac{1}{x^2} \arctan (2x^3) \end{align*}$
Solution:
$\begin{align*} &\sum\limits_{n=0}^\infty \frac{(-1)^n 2^{2n+1} }{2n+1}x^{6n+1} \\ & -\sqrt[3]{\frac{1}{2} } \leq x \leq \sqrt[3]{\frac{1}{2} } \end{align*}$


$\begin{align*} 3) \hspace{.5cm} f(x) = \frac{1}{1+2x} \end{align*}$
Solution:
$\begin{align*} &\sum\limits_{n=0}^\infty (-2)^n x^n \\ & -\frac{1}{2} < x < \frac{1}{2} \end{align*}$


$\begin{align*} 4) \hspace{.5cm} f(x) = \cos \left( \sqrt{ \pi x } \right) \end{align*}$
Solution:
$\begin{align*} &\sum\limits_{n=0}^\infty \frac{(-1)^n \pi^n}{(2n)!}x^n \\ & 0 \leq x \leq \infty \end{align*}$


$\begin{align*} 5) \hspace{.5cm} f(x) = \ln (e+x) \end{align*}$
Solution:
$\begin{align*} & 1+\sum\limits_{n=1}^\infty \frac{(-1)^{n+1} }{ne^n}x^n \\ & -e < x \leq e \end{align*}$


$\begin{align*} 6) \hspace{.5cm} f(x) = (\cos x + \sin x)(\cos x - \sin x) \end{align*}$
Solution:
$\begin{align*} &\sum\limits_{n=0}^\infty \frac{(-1)^n 2^{2n} }{(2n)!}x^{2n} \\ & -\infty < x < \infty \end{align*}$


$\begin{align*} 7) \hspace{.5cm} f(x) = \sin^2 (3x) \end{align*}$
Solution:
$\begin{align*} &\sum\limits_{n=1}^\infty \frac{(-1)^{n+1} 3^{2n} 2^{2n-1} }{(2n)!}x^{2n} \\ & -\infty < x < \infty \end{align*}$


$\begin{align*} 8) \hspace{.5cm} f(x) = \cos^2 (\pi x) \end{align*}$
Solution:
$\begin{align*} & 1 + \sum\limits_{n=1}^\infty \frac{(-1)^n \pi^{2n} 2^{2n-1} }{(2n)!}x^{2n} \\ & -\infty < x < \infty \end{align*}$



This post is a chapter in the book Justin Math: Calculus. Suggested citation: Skycak, J. (2019). Manipulating Taylor Series. Justin Math: Calculus. https://justinmath.com/manipulating-taylor-series/