Unit 10 · Topic 10.14 · BC

Build Taylor and Maclaurin series

Builds on Taylor polynomials, the Lagrange error bound and the interval of convergence. 14 minutes.

  1. Example 1Recognize standard series
  2. Example 2Build a series by substitution or scaling
  3. Example 3Write the requested terms or general term
  4. Example 4State where the representation is valid

A function \(f\) with derivatives of every order at \(x=a\) has a Taylor polynomial \(\cy{P_n}\) of every degree \(n\) at the center \(a\) (topic 10.11). Each \(P_n\) is \(P_{n-1}\) plus one term, \(\frac{f^{(n)}(a)}{n!}(x-a)^n\). The polynomials are therefore the partial sums of one series, the Taylor series of \(f\) about \(x=a\):

\[\begin{aligned}&\sum_{n=0}^{\infty}\frac{f^{(n)}(a)}{n!}(x-a)^n\\&=f(a)+f'(a)(x-a)\\&\quad+\frac{f''(a)}{2!}(x-a)^2+\cdots\end{aligned}\]

A Taylor series about \(x=0\) is also called a Maclaurin series. The series equals \(f(x)\) at an input \(x\) when its partial sums \(P_n(x)\) approach \(f(x)\). This means that the remainder \(R_n(x)=f(x)-P_n(x)\) of topic 10.12 approaches 0 as \(n\) grows. This topic finds five standard series and where each equals its function, and it builds other series from them.

Five standard series

The chalk curve is e to the x, for x from −2 to 2, and the orange curve is its Taylor polynomial at 0 of the degree on the slider, from 1 to 12. At degree 3 the orange curve stays close to the chalk curve from about x = −1 to 1, and as the degree rises, the stretch where it stays close widens until it fills the figure. A button switches the chalk curve to the natural logarithm of 1 plus x, which falls without bound as x approaches −1. A teal band on the x-axis then marks x from −1 to 1, with an open ring at −1, a filled dot at 1 and a dashed teal line at each end. Inside the band the orange curve comes closer to the chalk curve as the degree rises, and to the right of the band high degrees put it far above or below the chalk curve.

Figure 1The chalk curve is \(e^x\), or \(\ln(1+x)\) after the button. The orange curve is its Taylor polynomial \(\cy{P_n}\) at 0, for the degree \(n\) on the slider. For \(\ln(1+x)\), a teal band between two dashed teal lines marks \(-1<x\le1\), where the series equals the function. The band includes 1, at the filled dot, but not \(-1\), at the open ring.

Raise the degree \(n\) in Figure 1. The stretch where the orange curve \(\cy{P_n}\) follows the chalk curve \(e^x\) widens until it fills the figure. Then switch to \(\ln(1+x)\) with the button. A teal band on the x-axis marks \(-1<x\le1\). Inside it, the orange curve comes closer to the chalk curve as \(n\) grows. To the right of the band, high degrees put it far above or below the chalk curve.

The \(n\)th derivative of \(\frac{1}{1-x}\) is \(\frac{n!}{(1-x)^{n+1}}\), which is \(n!\) at 0, so every coefficient is 1. The Maclaurin series \(1+x+x^2+\cdots\) is the geometric series with ratio \(x\). By topic 10.2, it converges to \(\frac{1}{1-x}\) when \(|x|<1\) and diverges when \(|x|\ge1\). Its general term, the term with index \(n\), is \(x^n\).

Every derivative of \(e^x\) is \(e^x\), which is 1 at 0, so the general term of its series is \(\frac{x^n}{n!}\). The derivatives of \(\sin x\) are \(\cos x\), \(-\sin x\), \(-\cos x\) and \(\sin x\) again, so their values at 0 repeat 1, 0, −1, 0. The series of \(\sin x\) therefore has only odd powers, with alternating signs, and its general term is \(\frac{(-1)^nx^{2n+1}}{(2n+1)!}\). After \(\cos 0=1\), the values for \(\cos x\) repeat 0, −1, 0, 1. Its series therefore has only even powers, with alternating signs, and its general term is \(\frac{(-1)^nx^{2n}}{(2n)!}\).

For these three functions, the Lagrange error bound of topic 10.12, which some books call Taylor’s inequality, shows that the remainder approaches 0. Between 0 and \(x\), every derivative of \(\sin x\) and of \(\cos x\) is at most 1 in size. Every derivative of \(e^x\) is at most \(e^{|x|}\) there. With \(M=1\) or \(M=e^{|x|}\), a bound that is the same for every \(n\),

\[|R_n(x)|\le M\,\frac{|x|^{n+1}}{(n+1)!}\]

At \(x=0\) the bound is 0. For \(x\ne0\), the series \(\sum\frac{|x|^n}{n!}\) converges by the ratio test, because the ratio \(\frac{|x|}{n+1}\) of consecutive terms approaches 0. The terms of a convergent series approach 0 (topic 10.3), so the bound approaches 0 too. The three series equal their functions at every \(x\).

For \(x>-1\), the derivatives of \(f(x)=\ln(1+x)\) are \(\frac{1}{1+x}\), \(\frac{-1}{(1+x)^2}\), \(\frac{2}{(1+x)^3}\) and so on, so \(f^{(n)}(0)=(-1)^{n-1}(n-1)!\) for \(n\ge1\), and \(f(0)=0\). Because \(\frac{(n-1)!}{n!}=\frac1n\), dividing by \(n!\) gives the general term \(\frac{(-1)^{n-1}x^n}{n}\). Its index starts at 1, because the series has no constant term.

To find where this series equals \(\ln(1+x)\), write \(\frac{1}{1+t}\) with a finite geometric sum. For \(t>-1\), the \(n\) terms \(1-t+t^2-\cdots+(-t)^{n-1}\) add to \(\frac{1-(-t)^n}{1+t}\) (topic 10.2), so

\[\begin{aligned}\frac{1}{1+t}&=1-t+\cdots+(-t)^{n-1}\\&\quad+\frac{(-t)^n}{1+t}\end{aligned}\]

For \(x>-1\), every part is continuous between 0 and \(x\), because \(1+t>0\) there. Integrate from 0 to \(x\). By the Fundamental Theorem of Calculus, the left side gives \(\ln(1+x)\), and the powers give the terms of \(P_n(x)\). The last part is the remainder:

\[R_n(x)=(-1)^n\int_0^x\frac{t^n}{1+t}\,dt\]

If \(0\le x\le1\), the integrand lies between 0 and \(t^n\), so \(|R_n(x)|\le\frac{x^{n+1}}{n+1}\le\frac{1}{n+1}\). If \(-1<x<0\), then \(1+t\ge1+x>0\) between \(x\) and 0, so the integrand is at most \(\frac{|t|^n}{1+x}\) in size, and \(|R_n(x)|\le\frac{|x|^{n+1}}{(n+1)(1+x)}\). Both bounds approach 0, so the series equals \(\ln(1+x)\) for \(-1<x\le1\). At \(x=-1\) it is the negative of the harmonic series (topic 10.5), and for \(|x|>1\) its terms do not approach 0, so it diverges at every other \(x\).

New series from the standard ones

Building the series of a function such as \(e^{-x^2}\) or \(\sin 3x\) needs no derivatives. Write the function as a standard function \(g(u)\), with \(u\) an expression \(h(x)\). Then replace \(u\) by \(h(x)\) in every term \(c_nu^n\) of the series of \(g\). At each \(x\), the new series is the series of \(g\) at the number \(h(x)\). It therefore equals \(g\big(h(x)\big)\) where \(h(x)\) lies in the interval where the series of \(g\) equals \(g\), and it diverges everywhere else.

If \(u=kx^m\) with \(m=1,2,3,\dots\), the term \(c_nu^n\) becomes \(c_nk^nx^{mn}\). The coefficient gains the factor \(k^n\), and the exponent of \(x\) is multiplied by \(m\), but \(c_n\), with its factorial, stays the same. A constant factor multiplies every coefficient, as in \(\frac{1}{4-x}=\frac14\cdot\frac{1}{1-x/4}\), and a factor \(x^p\) adds \(p\) to every exponent. For a center \(a\), write the function with \(x-a\), as in \(e^x=e^a\,e^{x-a}\).

The new series is the Taylor series of the new function. For \(u=k(x-a)\), the chain rule shows it. Each derivative of \(f(x)=g\big(k(x-a)\big)\) brings out a factor \(k\), so \(f^{(n)}(a)=k^ng^{(n)}(0)\). Because \(c_n=\frac{g^{(n)}(0)}{n!}\), dividing by \(n!\) gives \(k^nc_n\), the coefficient that the substitution gives. A constant factor multiplies every derivative too. The same holds for a substitution such as \(u=x^2\) and for a factor \(x^p\), which this page accepts without proof.

To write the general term, read the sign, the coefficient, the power of \(x-a\) and the denominator from the first terms. Choose where the index \(n\) starts. With \(n\) from 0, the factor \((-1)^n\) gives the signs \(+,-,+,\dots\), and with \(n\) from 1, so does \((-1)^{n-1}\), which equals \((-1)^{n+1}\). Substitute the first values of \(n\) to check the formula. When a question asks for the first nonzero terms, leave out every term whose coefficient is 0, as in the series of \(\sin x\).

Where a new series equals its function

Two number lines. On the upper line, for x from −2 to 2, a teal band covers −1 < x < 1 with an open ring at each end, and an orange point marks x, which the slider moves from −1.5 to 1.5. The lower line, for u from −2.5 to 2.5, has a teal band for −1 < u < 1 with open rings at its ends, and an orange point marks u = −x², joined to the point above by a faint dashed line. Below, teal dots joined by a line show the first twelve partial sums of 1 − x² + x⁴ − ⋯ at this x, and a faint horizontal dashed line marks the value of 1 over 1 plus x squared. At x = 0.6 the dots approach the line at about 0.735. When x is beyond 1 or −1, u is below −1, and the dots lie farther from the line at each step, on alternate sides.

Figure 2The orange point \(\cy{x}\) on the upper line moves the orange point \(u=-x^2\) on the lower line, and a faint dashed line joins them. The teal bands mark \(|x|<1\) and \(|u|<1\), without the ends that the open rings mark. Below, the \(n\)th teal dot is the sum of the first \(n\) terms of \(1-x^2+x^4-\cdots\) at this \(x\). A faint horizontal dashed line marks \(\frac{1}{1+x^2}\).

Figure 2 shows the series of \(\frac{1}{1+x^2}\), built from the geometric series with \(u=-x^2\). It is \(1-x^2+x^4-\cdots\), and it equals \(\frac{1}{1+x^2}\) exactly when \(|-x^2|<1\), that is, when \(|x|<1\). At \(x=0.6\), the teal dots approach the horizontal dashed line. Move the point \(\cy{x}\) past 1. The point \(u\) then leaves the teal band of the lower line, and the partial sums lie farther from the dashed line at each step. Yet \(\frac{1}{1+x^2}\) has a value at every \(x\). The interval comes from the standard series, not from the function.

To find the interval of a new series, put \(h(x)\) in place of \(u\) in the interval of the standard series. Then solve for \(x\), as in topic 10.13. At an end of the new interval, \(u\) is at an end of the old one. The new end is therefore included exactly when that old end is. Dividing by a negative number reverses the inequalities, so an included end can move to the other side.

Example 1

Recognize standard series

Find the sum of \(\displaystyle\sum_{n=0}^{\infty}\frac{(-1)^n\pi^{2n}}{3^{2n}(2n)!}\) and the sum of \(\displaystyle\sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n\,4^n}\).

Solution

In the first series, \(\frac{\pi^{2n}}{3^{2n}}=\left(\frac{\pi}{3}\right)^{2n}\). The powers are even, the signs alternate, and each power is divided by the factorial of its exponent. This is the series of \(\cos x\) at \(x=\frac{\pi}{3}\), and it equals \(\cos x\) at every \(x\):

\[\begin{aligned}&\sum_{n=0}^{\infty}\frac{(-1)^n}{(2n)!}\left(\frac{\pi}{3}\right)^{2n}\\&=\cos\frac{\pi}{3}=\frac12\end{aligned}\]

In the second series, \(\frac{1}{4^n}=\left(\frac14\right)^n\), and \((-1)^{n+1}=(-1)^{n-1}\). Every power appears from \(n=1\) on, the signs alternate, and each power is divided by its exponent, with no factorial. This is the series of \(\ln(1+x)\) at \(x=\frac14\), which lies in \(-1<x\le1\):

\[\begin{aligned}&\sum_{n=1}^{\infty}\frac{(-1)^{n-1}}{n}\left(\frac14\right)^n\\&=\ln\left(1+\frac14\right)=\ln\frac54\end{aligned}\]

Example 2

Build a series by substitution or scaling

Use the Maclaurin series for \(e^x\) to write the first four nonzero terms of the Maclaurin series for \(f(x)=e^{-x^2}\).

Solution

The series of \(e^u\) equals \(e^u\) for every \(u\). Replace \(u\) by \(-x^2\) in every term. Each power becomes \(\left(-x^2\right)^n=(-1)^nx^{2n}\), and the factorial \(n!\) stays the same:

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

No term is 0, so the terms for \(n=0\) to 3 are the first four nonzero terms:

\[e^{-x^2}=1-x^2+\frac{x^4}{2}-\frac{x^6}{6}+\cdots\]

As a check, \(f''(x)=\left(4x^2-2\right)e^{-x^2}\), so \(\frac{f''(0)}{2!}=-1\), which is the coefficient of \(x^2\).

Example 3

Write the requested terms or general term

Write the first four terms and the general term of the Taylor series for \(f(x)=\dfrac1x\) about \(x=2\).

Solution

A series about 2 uses powers of \(x-2\). Write \(x\) as \(2+(x-2)\). Then factor out 2 to reach the form \(\frac{1}{1-u}\):

\[\begin{aligned}\frac1x&=\frac{1}{2+(x-2)}\\&=\frac12\cdot\frac{1}{1-\left(-\frac{x-2}{2}\right)}\end{aligned}\]

Here \(u=-\frac{x-2}{2}\) is a constant times \(x-2\), so the series that it builds is the Taylor series about 2. Each term \(\frac12u^n\) is \(\frac{(-1)^n(x-2)^n}{2^{n+1}}\), with \(n\) from 0:

\[\begin{aligned}\frac1x&=\sum_{n=0}^{\infty}\frac{(-1)^n(x-2)^n}{2^{n+1}}\\&=\frac12-\frac{x-2}{4}+\frac{(x-2)^2}{8}\\&\quad-\frac{(x-2)^3}{16}+\cdots\end{aligned}\]

As a check, \(f^{(n)}(x)=\frac{(-1)^nn!}{x^{n+1}}\), so the coefficient \(\frac{f^{(n)}(2)}{n!}\) is \(\frac{(-1)^n}{2^{n+1}}\), as above.

Example 4

State where the representation is valid

Write the Maclaurin series for \(f(x)=\ln(1-2x)\) in sigma notation, and find all values of \(x\) for which the series equals \(f(x)\).

Solution

Replace \(u\) by \(-2x\) in the series of \(\ln(1+u)\). Each term \(\frac{(-1)^{n-1}u^n}{n}\) becomes \(\frac{(-1)^{n-1}(-2)^nx^n}{n}\). Because \((-1)^{n-1}(-1)^n=-1\), every coefficient is negative:

\[\ln(1-2x)=-\sum_{n=1}^{\infty}\frac{2^nx^n}{n}\]

The series of \(\ln(1+u)\) equals \(\ln(1+u)\) exactly when \(-1<u\le1\), so the new series equals \(\ln(1-2x)\) exactly when \(-1<-2x\le1\). Dividing by \(-2\) reverses both inequalities:

\[\begin{aligned}&-1<-2x\le1\\&\iff-\frac12\le x<\frac12\end{aligned}\]

The included end \(u=1\) comes from \(x=-\frac12\), and the excluded end \(u=-1\) comes from \(x=\frac12\). The series equals \(\ln(1-2x)\) for \(-\frac12\le x<\frac12\).

Each example is one of the four skills of topic 10.14 in Which & Why: AP Calculus.