Skip to main content
\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)
Mathematics LibreTexts

8.8: Taylor Series


\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

In Section 8.6, we showed how certain functions can be represented by a power series function. In 8.7, we showed how we can approximate functions with polynomials, given that enough derivative information is available. In this section we combine these concepts: if a function \(f(x)\) is infinitely differentiable, we show how to represent it with a power series function.

Definition 39 taylor and maclaurin series

Let \(f(x)\) have derivatives of all orders at \(x=c\).

  1. The Taylor Series of \(f(x)\), centered at \(c\) is \[\sum_{n=0}^\infty \frac{f\,^{(n)}(c)}{n!}(x-c)^n.\]
  2. Setting \(c=0\) gives the Maclaurin Series of \(f(x)\): \[\sum_{n=0}^\infty \frac{f\,^{(n)}(0)}{n!}x^n.\]

The difference between a Taylor polynomial and a Taylor series is the former is a polynomial, containing only a finite number of terms, whereas the latter is a series, a summation of an infinite set of terms. When creating the Taylor polynomial of degree \(n\) for a function \(f(x)\) at \(x=c\),we needed to evaluate \(f\),and the first \(n\) derivatives of \(f\),at \(x=c\).When creating the Taylor series of \(f\), it helps to find a pattern that describes the \(n^\text{th}\) derivative of \(f\) at \(x=c\).We demonstrate this in the next two examples.

Example \(\PageIndex{1}\): The Maclaurin series of \(f(x) = \cos x\)

Find the Maclaurin series of \(f(x)=\cos x\).

In Example 8.7.4 we found the \(8^\text{th}\) degree Maclaurin polynomial of \(\cos x\).In doing so, we created the table shown in Figure 8.29.

Figure 8.29: 
A table of the derivatives of \(f(x)= \cos x\) evaluated at \(x=0\). 

Notice how \(f\,^{(n)}(0)=0\) when \(n\) is odd, \(f\,^{(n)}(0)=1\) when \(n\) is divisible by \(4\),and \(f\,^{(n)}(0)=-1\) when \(n\) is even but not divisible by 4. Thus the Maclaurin series of \(\cos x\) is

\[1-\frac{x^2}2+\frac{x^4}{4!}-\frac{x^6}{6!}+\frac{x^8}{8!} - \cdots\]

We can go further and write this as a summation. Since we only need the terms where the power of \(x\) is even, we write the power series in terms of \(x^{2n}\):

\[\sum_{n=0}^\infty (-1)^{n}\frac{x^{2n}}{(2n)!}.\]

Example \(\PageIndex{2}\): The Taylor series of \(f(x)=\ln x\) at \(x=1\)

Find the Taylor series of \(f(x) = \ln x\) centered at \(x=1\).

Figure 8.30 shows the \(n^\text{th}\) derivative of \(\ln x\) evaluated at \(x=1\) for \(n=0,\ldots,5\),along with an expression for the \(n^\text{th}\) term: \[f\,^{(n)}(1) = (-1)^{n+1}(n-1)!\quad \text{for \(n\geq 1\).}\] Remember that this is what distinguishes Taylor series from Taylor polynomials; we are very interested in finding a pattern for the \(n^\text{th}\) term, not just finding a finite set of coefficients for a polynomial.

Figure 8.30: 
Derivatives of \(\ln x\) evaluated at \(x=1\).

Since \(f(1) = \ln 1 = 0\),we skip the first term and start the summation with \(n=1\),giving the Taylor series for \(\ln x\),centered at \(x=1\),as 

\[\sum_{n=1}^\infty (-1)^{n+1}(n-1)!\frac{1}{n!}(x-1)^n = \sum_{n=1}^\infty (-1)^{n+1}\frac{(x-1)^n}{n}. \]

It is important to note that Definition 39 defines a Taylor series given a function \(f(x)\); however, we cannot yet state that \(f(x)\) is equal to its Taylor series. We will find that "most of the time'' they are equal, but we need to consider the conditions that allow us to conclude this.

Theorem 76 states that the error between a function \(f(x)\) and its \(n^\text{th}\)--degree Taylor polynomial \(p_n(x)\) is \(R_n(x)\),where

\[ \big|R_n(x)\big| \leq \frac{\max\left|\,f\,^{(n+1)}(z)\right|}{(n+1)!}\big|(x-c)^{(n+1)}\big|.\]

If \(R_n(x)\) goes to 0 for each \(x\) in an interval \(I\) as \(n\) approaches infinity, we conclude that the function is equal to its Taylor series expansion.

theorem 77 function and taylor series equality

Let \(f(x)\) have derivatives of all orders at \(x=c\),let \(R_n(x)\) be as stated in Theorem 76, and let \(I\) be an interval on which the Taylor series of \(f(x)\) converges. 

If \(\lim\limits_{n\to\infty} R_n(x) = 0\) for all \(x\) in \(I\),then \[f(x) = \sum_{n=0}^\infty \frac{f\,^{(n)}(c)}{n!}(x-c)^n\ \text{ on \(I\).}\]

We demonstrate the use of this theorem in an example.

Example \(\PageIndex{3}\): Establishing equality of a function and its Taylor series

Show that \(f(x) = \cos x\) is equal to its Maclaurin series, as found in Example 8.8.1, for all \(x\).


Given a value \(x\),the magnitude of the error term \(R_n(x)\) is bounded by

\[ \big|R_n(x)\big| \leq \frac{\max\left|\,f\,^{(n+1)}(z)\right|}{(n+1)!}\big|x^{n+1}\big|.\]

Since all derivatives of \(\cos x\) are \(\pm \sin x\) or \(\pm\cos x\),whose magnitudes are bounded by \(1\),we can state

\[ \big|R_n(x)\big| \leq \frac{1}{(n+1)!}\big|x^{n+1}\big|\]

which implies

\[ -\frac{|x^{n+1}|}{(n+1)!} \leq R_n(x) \leq\frac{|x^{n+1}|}{(n+1)!}.\label{eq:coseqtaylor}\]

For any \(x\),\(\lim\limits_{n\to\infty} \frac{x^{n+1}}{(n+1)!} = 0\). Applying the Squeeze Theorem to Equation \ref{eq:coseqtaylor}, we conclude that \( \lim\limits_{n\to\infty} R_n(x) = 0\) for all \(x\),and hence

\[\cos x = \sum_{n=0}^\infty (-1)^{n}\frac{x^{2n}}{(2n)!}\quad \text{for all \(x\)}.\]

It is natural to assume that a function is equal to its Taylor series on the series' interval of convergence, but this is not the case. In order to properly establish equality, one must use Theorem 77. This is a bit disappointing, as we developed beautiful techniques for determining the interval of convergence of a power series, and proving that \(R_n(x)\to 0\) can be cumbersome as it deals with high order derivatives of the function.

There is good news. A function \(f(x)\) that is equal to its Taylor series, centered at any point the domain of \(f(x)\),is said to be an analytic function, and most, if not all, functions that we encounter within this course are analytic functions. Generally speaking, any function that one creates with elementary functions (polynomials, exponentials, trigonometric functions, etc.) that is not piecewise defined is probably analytic. For most functions, we assume the function is equal to its Taylor series on the series' interval of convergence and only use Theorem 77 when we suspect something may not work as expected.

We develop the Taylor series for one more important function, then give a table of the Taylor series for a number of common functions.

Example \(\PageIndex{4}\): The Binomial Series

Find the Maclaurin series of \(f(x) = (1+x)^k\),\(k\neq 0\).


When \(k\) is a positive integer, the Maclaurin series is finite. For instance, when \(k=4\),we have 

\[f(x) = (1+x)^4 = 1+4x+6x^2+4x^3+x^4.\]

The coefficients of \(x\) when \(k\) is a positive integer are known as the binomial coefficients, giving the series we are developing its name.

When \(k=1/2\),we have \(f(x) = \sqrt{1+x}\).Knowing a series representation of this function would give a useful way of approximating \(\sqrt{1.3}\),for instance.

To develop the Maclaurin series for \(f(x) = (1+x)^k\) for any value of \(k\neq0\),we consider the derivatives of \(f\) evaluated at \(x=0\):


Thus the Maclaurin series for \(f(x) = (1+x)^k\) is

\[1+ k + \frac{k(k-1)}{2!} + \frac{k(k-1)(k-2)}{3!} + \ldots + \frac{k(k-1)\cdots\big(k-(n-1)\big)}{n!}+\ldots\]

It is important to determine the interval of convergence of this series. With 

\[a_n = \frac{k(k-1)\cdots\big(k-(n-1)\big)}{n!}x^n,\]

we apply the Ratio Test:

\lim\limits_{n\to\infty}\frac{|a_{n+1}|}{|a_n|}&=\lim\limits_{n\to\infty} \left|\frac{k(k-1)\cdots(k-n)}{(n+1)!}x^{n+1}\right|\Bigg/\left|\frac{k(k-1)\cdots\big(k-(n-1)\big)}{n!}x^n\right|\\
&=\lim\limits_{n\to\infty} \left|\frac{k-n}{n}x\right|\\
&= |x|.

The series converges absolutely when the limit of the Ratio Test is less than 1; therefore, we have absolute convergence when \(|x|<1\).

While outside the scope of this text, the interval of convergence depends on the value of \(k\).When \(k>0\),the interval of convergence is \([-1,1]\).When \(-1<k<0\),the interval of convergence is \([-1,1)\).If \(k\leq -1\),the interval of convergence is \((-1,1)\).

We learned that Taylor polynomials offer a way of approximating a "difficult to compute'' function with a polynomial. Taylor series offer a way of exactly representing a function with a series. One probably can see the use of a good approximation; is there any use of representing a function exactly as a series? 

While we should not overlook the mathematical beauty of Taylor series (which is reason enough to study them), there are practical uses as well. They provide a valuable tool for solving a variety of problems, including problems relating to integration and differential equations. 

In Key Idea 32 (on the following page) we give a table of the Taylor series of a number of common functions. We then give a theorem about the "algebra of power series,'' that is, how we can combine power series to create power series of new functions. This allows us to find the Taylor series of functions like \(f(x) = e^x\cos x\) by knowing the Taylor series of \(e^x\) and \(\cos x\).

Before we investigate combining functions, consider the Taylor series for the arctangent function (see Key Idea 32). Knowing that \(\tan^{-1}(1) = \pi/4\),we can use this series to approximate the value of \(\pi\):

\frac{\pi}4 &= \tan^{-1}(1) = 1-\frac13+\frac15-\frac17+\frac19-\cdots\\
\pi &= 4\left(1-\frac13+\frac15-\frac17+\frac19-\cdots\right)
\end{align} \]

Unfortunately, this particular expansion of \(\pi\) converges very slowly. The first 100 terms approximate \(\pi\) as \(3.13159\),which is not particularly good.




Let \( f(x) = \sum_{n=0}^\infty a_nx^n\) and \( g(x) = \sum_{n=0}^\infty b_nx^n\) converge absolutely for \(|x|<R\),and let \(h(x)\) be continuous.

  1. \( f(x)\pm g(x) = \sum_{n=0}^\infty (a_n\pm b_n)x^n\) \quad for \(|x|<R\).
  2. \( f(x)g(x) = \left(\sum_{n=0}^\infty a_nx^n\right)\left(\sum_{n=0}^\infty b_nx^n\right) = \sum_{n=0}^\infty\big(a_0b_n+a_1b_{n-1}+\ldots a_nb_0\big)x^n \text{ for }|x|<R\).
  3. \( f\big(h(x)\big) = \sum_{n=0}^\infty a_n\big(h(x)\big)^n \quad \text{ for }|h(x)|<R\).

Example \(\PageIndex{5}\): Combining Taylor series

Write out the first 3 terms of the Taylor Series for \(f(x) = e^x\cos x\) using Key Idea 32 and Theorem 78.


Key Idea 32 informs us that 

\[e^x = 1+x+\frac{x^2}{2!}+\frac{x^3}{3!}+\cdots\quad \text{and}\quad \cos x = 1-\frac{x^2}{2!}+\frac{x^4}{4!}+\cdots.\]

Applying Theorem 78, we find that 

e^x\cos x &= \left(1+x+\frac{x^2}{2!}+\frac{x^3}{3!}+\cdots\right)\left(1-\frac{x^2}{2!}+\frac{x^4}{4!}+\cdots\right).\\
\text{Distribute}&\text{ the right hand expression across the left:} \\ 
&= 1\left(1-\frac{x^2}{2!}+\frac{x^4}{4!}+\cdots\right)+x\left(1-\frac{x^2}{2!}+\frac{x^4}{4!}+\cdots\right)+\frac{x^2}{2!}\left(1-\frac{x^2}{2!}+\frac{x^4}{4!}+\cdots\right)\\
&+\frac{x^3}{3!}\left(1-\frac{x^2}{2!}+\frac{x^4}{4!}+\cdots\right) + \frac{x^4}{4!}\left(1-\frac{x^2}{2!}+\frac{x^4}{4!}+\cdots\right)+\cdots \\ 
&\text{Distribute again and collect like terms.}\\
&= 1 + x -\frac{x^3}{3}-\frac{x^4}{6} - \frac{x^5}{30}+\frac{x^7}{630}+\cdots

While this process is a bit tedious, it is much faster than evaluating all the necessary derivatives of \(e^x\cos x\) and computing the Taylor series directly.

Because the series for \(e^x\) and \(\cos x\) both converge on \((-\infty,\infty)\),so does the series expansion for \(e^x\cos x\).

Example \(\PageIndex{6}\): Creating new Taylor series

Use Theorem 78 to create series for \(y=\sin(x^2)\) and \(y=\ln (\sqrt{x})\).

Given that 

\[\sin x = \sum_{n=0}^\infty (-1)^n\frac{x^{2n+1}}{(2n+1)!} = x-\frac{x^3}{3!}+\frac{x^5}{5!} -\frac{x^7}{7!}+\cdots,\]

we simply substitute \(x^2\) for \(x\) in the series, giving

\[\sin (x^2) = \sum_{n=0}^\infty (-1)^n\frac{(x^2)^{2n+1}}{(2n+1)!} = x^2-\frac{x^6}{3!}+\frac{x^{10}}{5!} -\frac{x^{14}}{7!}\cdots.\]

Since the Taylor series for \(\sin x\) has an infinite radius of convergence, so does the Taylor series for \(\sin(x^2)\).

The Taylor expansion for \(\ln x\) given in Key Idea 32 is centered at \(x=1\),so we will center the series for \(\ln (\sqrt{x})\) at \(x=1\) as well.

\[\ln x = \sum_{n=1}^\infty(-1)^{n+1}\frac{(x-1)^n}{n} = (x-1)- \frac{(x-1)^2}{2} +\frac{(x-1)^3}{3}-\cdots,\]

we substitute \(\sqrt{x}\) for \(x\) to obtain

\[\ln (\sqrt{x}) = \sum_{n=1}^\infty(-1)^{n+1}\frac{(\sqrt{x}-1)^n}{n} = (\sqrt{x}-1)- \frac{(\sqrt{x}-1)^2}{2} +\frac{(\sqrt{x}-1)^3}{3}-\cdots.\]

While this is not strictly a power series, it is a series that allows us to study the function \(\ln(\sqrt{x})\).Since the interval of convergence of \(\ln x\) is \((0,2]\),and the range of \(\sqrt{x}\) on \((0,4]\) is \((0,2]\),the interval of convergence of this series expansion of \(\ln(\sqrt{x})\) is \((0,4]\).

Note: In Example 8.8.6, one could create a series for \(\ln(\sqrt{x})\) by simply recognizing that \(\ln(\sqrt{x}) = \ln (x^{1/2}) = 1/2\ln x\),and hence multiplying the Taylor series for \(\ln x\) by \(1/2\).This example was chosen to demonstrate other aspects of series, such as the fact that the interval of convergence changes.

Example \(\PageIndex{7}\): Using Taylor series to evaluate definite integrals

Use the Taylor series of \(e^{-x^2}\) to evaluate \( \int_0^1e^{-x^2}\ dx\).


We learned, when studying Numerical Integration, that \(e^{-x^2}\) does not have an antiderivative expressible in terms of elementary functions. This means any definite integral of this function must have its value approximated, and not computed exactly.

We can quickly write out the Taylor series for \(e^{-x^2}\) using the Taylor series of \(e^x\):

e^x &= \sum_{n=0}^\infty \frac{x^n}{n!} = 1+x+\frac{x^2}{2!}+\frac{x^3}{3!}+\cdots \\
\text{and so}& \\
e^{-x^2} &= \sum_{n=0}^\infty \frac{(-x^2)^n}{n!} \\
&= \sum_{n=0}^\infty (-1)^n\frac{x^{2n}}{n!}\\
&= 1-x^2+\frac{x^4}{2!}-\frac{x^6}{3!}+\cdots.

We use Theorem 75 to integrate:

\[\int e^{-x^2}\ dx = C + x - \frac{x^3}{3}+\frac{x^5}{5\cdot2!}-\frac{x^7}{7\cdot3!}+\cdots +(-1)^n\frac{x^{2n+1}}{(2n+1)n!}+\cdots\]

This is the antiderivative of \(e^{-x^2}\);while we can write it out as a series, we cannot write it out in terms of elementary functions. We can evaluate the definite integral \( \int_0^1e^{-x^2}\ dx\) using this antiderivative; substituting 1 and 0 for \(x\) and subtracting gives

\[\int_0^1e^{-x^2}\ dx = 1-\frac{1}{3}+\frac{1}{5\cdot 2!}-\frac{1}{7\cdot3!} + \frac{1}{9\cdot4!}\cdots.\]

Summing the 5 terms shown above give the approximation of \(0.74749.\) Since this is an alternating series, we can use the Alternating Series Approximation Theorem, (Theorem 71), to determine how accurate this approximation is. The next term of the series is \( 1/(11\cdot5!) \approx 0.00075758\).Thus we know our approximation is within \(0.00075758\) of the actual value of the integral. This is arguably much less work than using Simpson's Rule to approximate the value of the integral.

Example \(\PageIndex{8}\): Using Taylor series to solve differential equations

Solve the differential equation \(y^{\prime}=2y\) in terms of a power series, and use the theory of Taylor series to recognize the solution in terms of an elementary function.


We found the first 5 terms of the power series solution to this differential equation in Example 8.6.5 in Section 8.6. These are:

\[a_0=1,\quad a_1 = 2,\quad a_2 = \frac42=2,\quad a_3=\frac{8}{2\cdot3}=\frac43,\quad a_4=\frac{16}{2\cdot3\cdot4} = \frac23.\]

We include the "unsimplified'' expressions for the coefficients found in Example 8.6.5 as we are looking for a pattern. It can be shown that \(a_n = 2^n/n!\).Thus the solution, written as a power series, is

\[y = \sum_{n=0}^\infty \frac{2^n}{n!}x^n = \sum_{n=0}^\infty \frac{(2x)^n}{n!}.\]

Using Key Idea 32 and Theorem 78, we recognize \(f(x) = e^{2x}\):

\[e^x = \sum_{n=0}^\infty \frac{x^n}{n!} \qquad \Rightarrow \qquad e^{2x} = \sum_{n=0}^\infty \frac{(2x)^n}{n!}.\]

Finding a pattern in the coefficients that match the series expansion of a known function, such as those shown in Key Idea 32, can be difficult. What if the coefficients in the previous example were given in their reduced form; how could we still recover the function \(y=e^{2x}\)?

Suppose that all we know is that 

\[a_0=1,\quad a_1=2,\quad a_2=2,\quad a_3=\frac43,\quad a_4=\frac23.\]

Definition 39 states that each term of the Taylor expansion of a function includes an \(n!\).This allows us to say that

\[a_2=2=\frac{b_2}{2!},\quad a_3 = \frac43=\frac{b_3}{3!},\quad \text{and}\quad a_4 = \frac23=\frac{b_4}{4!}\]

for some values \(b_2\),\(b_3\) and \(b_4\).

Solving for these values, we see that \(b_2=4\),\(b_3 = 8\) and \(b_4=16\).That is, we are recovering the pattern we had previously seen, allowing us to write 

f(x) = \sum_{n=0}^\infty a_nx^n &= \sum_{n=0}^\infty \frac{b_n}{n!}x^n \\
&= 1+2x+ \frac{4}{2!}x^2 + \frac{8}{3!}x^3+\frac{16}{4!}x^4 + \cdots

From here it is easier to recognize that the series is describing an exponential function.

There are simpler, more direct ways of solving the differential equation \(y^{\prime} = 2y\).We applied power series techniques to this equation to demonstrate its utility, and went on to show how sometimes we are able to recover the solution in terms of elementary functions using the theory of Taylor series. Most differential equations faced in real scientific and engineering situations are much more complicated than this one, but power series can offer a valuable tool in finding, or at least approximating, the solution.

This chapter introduced sequences, which are ordered lists of numbers, followed by series, wherein we add up the terms of a sequence. We quickly saw that such sums do not always add up to "infinity,'' but rather converge. We studied tests for convergence, then ended the chapter with a formal way of defining functions based on series. Such "series--defined functions'' are a valuable tool in solving a number of different problems throughout science and engineering. 

Coming in the next chapters are new ways of defining curves in the plane apart from using functions of the form \(y=f(x)\).Curves created by these new methods can be beautiful, useful, and important. 


  • Gregory Hartman (Virginia Military Institute). Contributions were made by Troy Siemers and Dimplekumar Chalishajar of VMI and Brian Heinold of Mount Saint Mary's University. This content is copyrighted by a Creative Commons Attribution - Noncommercial (BY-NC) License.