Dressing Up Functions with the Taylor Series - Infinite Series - Calculus II For Dummies

Calculus II For Dummies, 2nd Edition (2012)

Part IV. Infinite Series

Chapter 13. Dressing Up Functions with the Taylor Series

In This Chapter

arrow Understanding elementary functions

arrow Seeing power series as polynomials with infinitely many terms

arrow Expressing functions as a Maclaurin series

arrow Discovering the Taylor series as a generalization of the Maclaurin series

arrow Approximating expressions with the Taylor and Maclaurin series

The infinite series known as the Taylor series is one of the most brilliant mathematical achievements you’ll ever come across. It’s also quite a lot to get your head around. Although many calculus books tend to throw you in the deep end with the Taylor series, I prefer to take you by the hand and help you wade in slowly.

The Taylor series is a specific form of the power series. In turn, it’s helpful to think of a power series as a polynomial with an infinite number of terms. So, in this chapter, I begin with a discussion of polynomials. I contrast polynomials with other elementary functions, pointing out a few reasons mathematicians like polynomials so much (often to the exclusion of their families and friends).

Then I move on to power series, showing you how to discover when a power series converges and diverges. I also discuss the interval of convergence for a power series, which is the set of x values for which that series converges. After that, I introduce you to the Maclaurin series — a simplified, but powerful, version of the Taylor series.

Finally, the main event: the Taylor series. First, I show you how to use the Taylor series to evaluate other functions; you’ll definitely need that for your final exam. I introduce you to the Taylor remainder term, which allows you to find the margin of error when making an approximation. To finish up the chapter, I show you why the Taylor series works, which helps to make sense of the series, but may not be strictly necessary for passing an exam.

Elementary Functions

Elementary functions are those familiar functions that you work with all the time in calculus. They include:

check Addition, subtraction, multiplication, and division

check Powers and roots

check Exponential functions and logarithms (usually the natural log)

check Trig and inverse trig functions

check All combinations and compositions of these functions

In this section, I discuss some of the difficulties of working with elementary functions. In contrast, I show you why a small subset of elementary functions — the polynomials — is much easier to work with. To finish, I consider the advantages of expressing elementary functions as polynomials when possible.

Knowing two drawbacks of elementary functions

The set of elementary functions is closed under the operation of differentiation. That is, when you differentiate an elementary function, the result is always another elementary function.

Unfortunately, this set isn’t closed under the operation of integration. For example, here’s an integral that can’t be evaluated as an elementary function:

9781118161708-eq13001.eps

So even though the set of elementary functions is large and complex enough to confuse most math students, for you — the calculus guru — it’s a rather small pool.

Another problem with elementary functions is that many of them are difficult to evaluate for a given value of x. Even the simple function sin x isn’t so simple to evaluate because (except for 0) every integer input value results in an irrational output for the function. For example, what’s the value of sin 3?

Appreciating why polynomials are so friendly

In contrast to other elementary functions, polynomials are just about the friendliest functions around. Here are just a few reasons:

check Polynomials are easy to integrate (see Chapter 4 to see how to compute the integral of every polynomial).

check Polynomials are easy to evaluate for any value of x.

check Polynomials are infinitely differentiable — that is, you can calculate the value of the first derivative, second derivative, third derivative, and so on, infinitely.

Representing elementary functions as polynomials

In Part II, I show you a set of tricks for computing and integrating elementary functions. Many of these tricks work by taking a function whose integral can’t be computed as such and tweaking it into a more friendly form.

For example, using the substitution u = sin x, you can turn the integral on the left into the one on the right:

9781118161708-eq13002.eps

In this case, you can turn the product of two trig functions into a polynomial, which is much simpler to work with and easy to integrate.

Representing elementary functions as series

The tactic of expressing complicated functions as polynomials (and other simple functions) motivates much of the study of infinite series.

Although series may seem difficult to work with — and, admittedly, they do pose their own specific set of challenges — they have two great advantages that make them useful for integration:

check An infinite series breaks easily into terms. So in most cases, you can use the Sum Rule to break a series into separate terms and evaluate these terms individually.

check Series tend to be built from a recognizable pattern. So if you can figure out how to integrate one term, you can usually generalize this method to integrate every term in the series.

Specifically, power series include many of the features that make polynomials easy to work with. I discuss power series in the next section.

Power Series: Polynomials on Steroids

In Chapter 11, I introduce the geometric series:

9781118161708-eq13003.eps

I also show you a simple formula to figure out whether the geometric series converges or diverges.

The geometric series is a simplified form of a larger set of series called the power series.

remember.epsA power series is any series of the following form:

9781118161708-eq13004.eps

Notice how the power series differs from the geometric series:

check In a geometric series, every term has the same coefficient.

check In a power series, the coefficients may be different — usually according to a rule that’s specified in the sigma notation.

Here are a few examples of power series:

9781118161708-eq13005.eps

You can think of a power series as a polynomial with an infinite number of terms. For this reason, many useful features of polynomials (which I describe earlier in this chapter) carry over to power series.

remember.epsThe most general form of the power series is as follows:

9781118161708-eq13006.eps

This form is for a power series that’s centered at a. Notice that when a = 0, this form collapses to the simpler version I introduce earlier in this section. So a power series in this form is centered at 0.

Integrating power series

In Chapter 4, I show you a three-step process for integrating polynomials. Because power series resemble polynomials, they’re simple to integrate using the same basic process:

1. Use the Sum Rule to integrate the series term by term.

2. Use the Constant Multiple Rule to move each coefficient outside its respective integral.

3. Use the Power Rule to evaluate each integral.

For example, take a look at the following integral:

9781118161708-eq13007.eps

At first glance, this integral of a series may look scary. But to give it a chance to show its softer side, I expand the series out as follows:

9781118161708-eq13008.eps

Now you can apply the three steps for integrating polynomials to evaluate this integral:

1. Use the Sum Rule to integrate the series term by term:

9781118161708-eq13009.eps

2. Use the Constant Multiple Rule to move each coefficient outside its respective integral:

9781118161708-eq13010.eps

3. Use the Power Rule to evaluate each integral:

9781118161708-eq13011.eps

Notice that this result is another power series, which you can turn back into sigma notation:

9781118161708-eq13012.eps

Understanding the interval of convergence

As with geometric series and p-series (which I discuss in Chapter 11), an advantage to power series is that they converge or diverge according to a well-understood pattern.

Unlike these simpler series, however, a power series often converges or diverges based on its x value. This leads to a new concept when dealing with power series: the interval of convergence.

The interval of convergence for a power series is the set of x values for which that series converges.

The interval of convergence is never empty

remember.epsEvery power series converges for some value of x. That is, the interval of convergence for a power series is never the empty set.

Although this fact has useful implications, it’s actually pretty much a no-brainer. For example, take a look at the following power series:

9781118161708-eq13013.eps

When x = 0, this series evaluates to 1 + 0 + 0 + 0 + ..., so it obviously converges to 1. Similarly, take a peek at this power series:

9781118161708-eq13014.eps

This time, when x = –5, the series converges to 0, just as trivially as the last example.

Note that in both of these examples, the series converges trivially at x = a for a power series centered at a (see the beginning of “Power Series: Polynomials on Steroids”).

Three varieties for the interval of convergence

remember.epsThree possibilities exist for the interval of convergence of any power series:

check The series converges only when x = a.

check The series converges on some interval (open or closed at either end) centered at a.

check The series converges for all real values of x.

For example, suppose that you want to find the interval of convergence for:

9781118161708-eq13015.eps

This power series is centered at 0, so it converges when x = 0. Using the ratio test (see Chapter 12), you can find out whether it converges for any other values of x. To start out, set up the following limit:

9781118161708-eq13016.eps

To evaluate this limit, start out by canceling xn in the numerator and denominator:

9781118161708-eq13017.eps

Next, distribute to remove the parentheses in the numerator:

9781118161708-eq13018.eps

As it stands, this limit is of the form 9781118161708-eq13019.eps, so apply L’Hopital’s Rule (see Chapter 2), differentiating over the variable n:

9781118161708-eq13020.eps

From this result, the ratio test tells you that the series:

check Converges when –1 < x < 1

check Diverges when x < –1 and x > 1

check May converge or diverge when x = 1 and x = –1

Fortunately, it’s easy to see what happens in these two remaining cases. Here’s what the series looks like when x = 1:

9781118161708-eq13021.eps

Clearly, the series diverges. Similarly, here’s what it looks like when x = –1:

9781118161708-eq13022.eps

This alternating series swings wildly between negative and positive values, so it also diverges.

As a final example, suppose that you want to find the interval of convergence for the following series:

9781118161708-eq13023.eps

As in the last example, this series is centered at 0, so it converges when x = 0. The real question is whether it converges for other values of x. Because this is an alternating series, I apply the ratio test to the positive version of it to see whether I can show that it’s absolutely convergent:

9781118161708-eq13024.eps

First off, I want to simplify this a bit:

9781118161708-eq13025.eps

Next, I expand out the exponents and factorials, as I show you in Chapter 12:

9781118161708-eq13026.eps

At this point, a lot of canceling is possible:

9781118161708-eq13027.eps

This time, the limit falls between –1 and 1 for all values of x. This result tells you that the series converges absolutely for all values of x, so the alternating series also converges for all values of x.

Expressing Functions as Series

In this section, you begin to explore how to express functions as infinite series. I begin by showing some examples of formulas that express sin x and cos x as series. These examples lead to a more general formula for expressing a wider variety of elementary functions as series.

This formula is the Maclaurin series, a simplified but powerful version of the more general Taylor series, which I introduce later in this chapter.

Expressing sin x as a series

Here’s an odd formula that expresses the sine function as an alternating series:

9781118161708-eq13028.eps

To make sense of this formula, use expanded notation:

9781118161708-eq13029.eps

Notice that this is a power series (which I discuss earlier in this chapter). To get a quick sense of how it works, here’s how you can find the value of sin 0 by substituting 0 for x:

9781118161708-eq13030.eps

As you can see, the formula verifies what you already know: sin 0 = 0.

You can use this formula to approximate sin x for any value of x to as many decimal places as you like. For example, look what happens when you substitute 1 for x in the first four terms of the formula:

9781118161708-eq13031.eps

Note that the actual value of sin 1 to six decimal places is 0.841471, so this estimate is correct to five decimal places — not bad!

Expressing cos x as a series

In the previous section, I show you a formula that expresses the value of sin x for all values of x as an infinite series. Differentiating both sides of this formula leads to a similar formula for cos x:

9781118161708-eq13044.eps

Now evaluate these derivatives:

9781118161708-eq13045.eps

Finally, simplify the result a bit:

9781118161708-eq13046.eps

As you can see, the result is another power series (which I discuss earlier in this chapter). Here’s how you write it with sigma notation:

9781118161708-eq13047.eps

To gain some confidence that this series really works as advertised, note that the substitution x = 0 provides the correct equation cos 0 = 1. Furthermore, substituting x = 1 into the first four terms gives you the following approximation:

9781118161708-eq13048.eps

This estimate is accurate to four decimal places.

Introducing the Maclaurin Series

In the previous two sections, I show you formulas for expressing both sin x and cos x as infinite series. You may begin to suspect that there’s some sort of method behind these formulas. Without further ado, here it is:

9781118161708-eq13049.eps

Behold the Maclaurin series, a simplified version of the much-heralded Taylor series, which I introduce in the next section.

The notation f(n) means “the nth derivative of f.” This should become clearer in the expanded version of the Maclaurin series:

9781118161708-eq13050.eps

The Maclaurin series is the template for the two formulas I introduce earlier in this chapter. It allows you to express many other functions as power series by following these steps:

1. Find the first few derivatives of the function until you recognize a pattern.

2. Substitute 0 for x into each of these derivatives.

3. Plug these values, term by term, into the formula for the Maclaurin series.

4. If possible, express the series in sigma notation.

For example, suppose that you want to find the Maclaurin series for ex.

1. Find the first few derivatives of ex until you recognize a pattern:

f'(x) = ex

f"(x) = ex

f(x) = ex

...

f(n)(x) = ex

2. Substitute 0 for x into each of these derivatives.

f'(0) = e0

f"(0) = e0

f(0) = e0

...

f(n)(x) = e0

3. Plug these values, term by term, into the formula for the Maclaurin series:

9781118161708-eq13051.eps

4. If possible, express the series in sigma notation:

9781118161708-eq13052.eps

To check this formula, use it to estimate e0 and e1 by substituting 0 and 1, respectively, into the first six terms:

9781118161708-eq13053.eps

This exercise nails e0 exactly, and approximates e1 to two decimal places. And, as with the formulas for sin x and cos x that I show you earlier in this chapter, the Maclaurin series for ex allows you to calculate this function for any value of x to any number of decimal places.

As with the other formulas, however, the Maclaurin series for ex works best when x is close to 0. As x moves away from 0, you need to calculate more terms to get the same level of precision.

But now, you can begin to see why the Maclaurin series tends to provide better approximations for values close to 0: The number 0 is “hardwired” into the formula as f(0), f'(0), f"(0), and so forth.

Figure 13-1 illustrates this point. The first graph shows sin x approximated by using the first two terms of the Maclaurin series — that is, as the third-degree polynomial 9781118161708-eq13054.eps. The subsequent graph shows an approximation of sin x with four terms.

As you can see, each successive approximation improves on the previous one. Furthermore, each equation tends to provide its best approximation when x is close to 0.

A tale of three series

It’s easy to get confused about the three categories of series that I discuss in this chapter. Here’s a helpful way to think about them:

check The power series is a subcategory of infinite series.

check The Taylor series (named for mathematician Brook Taylor) is a subcategory of power series.

check The Maclaurin series (named for mathematician Colin Maclaurin) is a subcategory of Taylor series.

After you have that down, consider that the power series has two basic forms:

check The specific form, which is centered at zero, so a drops out of the expression.

check The general form, which isn’t centered at zero, so a is part of the expression.

Furthermore, each of the other two series uses one of these two forms of the power series:

check The Maclaurin series uses the specific form, so it’s less powerful and simpler to work with.

check The Taylor series uses the general form, so it’s more powerful and harder to work with.

Introducing the Taylor Series

Like the Maclaurin series (which I introduce in the previous section), the Taylor series provides a template for representing a wide variety of functions as power series.

In fact, the Taylor series is really a more general version of the Maclaurin series. The advantage of the Maclaurin series is that it’s a bit simpler to work with. The advantage to the Taylor series is that you can tailor it to obtain a better approximation of many functions.

Here’s the Taylor series in all its glory:

9781118161708-eq13055.eps

As with the Maclaurin series, the Taylor series uses the notation f(n) to indicate the nth derivative. Here’s the expanded version of the Taylor series:

9781118161708-eq13056.eps

Notice that the Taylor series includes the variable a, which isn’t found in the Maclaurin series. Or, more precisely, in the Maclaurin series, a = 0, so it drops out of the expression.

The explanation for this variable can be found earlier in this chapter, in “Power Series: Polynomials on Steroids.” In that section, I show you two forms of the power series:

check A simpler form centered at 0, which corresponds to the Maclaurin series

check A more general form centered at a, which corresponds to the Taylor series

In the next section, I show you the advantages of working with this extra variable.

Computing with the Taylor series

The presence of the variable a makes the Taylor series more complex to work with than the Maclaurin series. But this variable provides the Taylor series with greater flexibility, as the next example illustrates.

In “Expressing Functions as Series” earlier in this chapter, I attempt to approximate the value of sin 10 with the Maclaurin series. Unfortunately, taking this calculation out to eight terms still results in a poor estimate. This problem occurs because the Maclaurin series always takes a default value of a = 0, and 0 isn’t close enough to 10.

This time, I use only four terms of the Taylor series to make a much better approximation. The key to this approximation is a shrewd choice for the variable a:

Let a = 3π

This choice has two advantages: First, this value of a is close to 10 (the value of x), which makes for a better approximation. Second, it’s an easy value for calculating sines and cosines, so the computation shouldn’t be too difficult.

To start off, substitute 10 for x and 3π for a in the first four terms of the Taylor series:

9781118161708-eq13057.eps

Next, substitute in the first, second, and third derivatives of the sine function and simplify:

9781118161708-eq13058.eps

The good news is that sin 3π = 0, so the first and third terms fall out:

9781118161708-eq13059.eps

At this point, you probably want to grab your calculator:

9781118161708-eq13060.eps

This approximation is correct to two decimal places — quite an improvement over the estimate from the Maclaurin series!

Examining convergent and divergent Taylor series

Earlier in this chapter, I show you how to find the interval of convergence for a power series — that is, the set of x values for which that series converges.

remember.epsBecause the Taylor series is a form of power series, you shouldn’t be surprised that every Taylor series also has an interval of convergence. When this interval is the entire set of real numbers, you can use the series to find the value of f(x) for every real value of x.

warning_bomb.epsHowever, when the interval of convergence for a Taylor series is bounded — that is, when it diverges for some values of x — you can use it to find the value of f(x) only on its interval of convergence.

For example, here are the three important Taylor series I’ve introduced so far in this chapter:

9781118161708-eq13061.eps

All three of these series converge for all real values of x (you can check this by using the ratio test, as I show you earlier in this chapter), so each equals the value of its respective function.

Now consider the following function:

9781118161708-eq13062.eps

I express this function as a Maclaurin series, using the steps that I outline earlier in this chapter in “Expressing Functions as Series”:

1. Find the first few derivatives of 9781118161708-eq13063.eps until you recognize a pattern:

9781118161708-eq13064.eps

2. Substitute 0 for x into each of these derivatives:

f'(0) = 1

f"(0) = 2

f(0) = 6

...

f(n)(0) = n!

3. Plug these values, term by term, into the formula for the Maclaurin series:

9781118161708-eq13065.eps

4. If possible, express the series in sigma notation:

9781118161708-eq13066.eps

To test this formula, I use it to find f(x) when x = 9781118161708-eq13067.eps.

9781118161708-eq13068.eps

You can test the accuracy of this expression by substituting 9781118161708-eq13069.eps into 9781118161708-eq13070.eps:

9781118161708-eq13071.eps

As you can see, the formula produces the correct answer. Now I try to use it

to find f(x) when x = 5, noting that the correct answer should be 9781118161708-eq13072.eps:

f(5) = 1 + 5 + 25 + 125 + ... = ∞ WRONG!

What happened? This series converges only on the interval (–1, 1), so the formula produces only the value f(x) when x is in this interval. When x is outside this interval, the series diverges, so the formula is invalid.

Expressing functions versus approximating functions

It’s important to be crystal clear in your understanding about the difference between two key mathematical practices:

check Expressing a function as an infinite series

check Approximating a function by using a finite number of terms of series

Both the Taylor series and the Maclaurin series are variations of the power series. You can think of a power series as a polynomial with infinitely many terms. Also, recall that the Maclaurin series is a specific form of the more general Taylor series, arising when the value of a is set to 0.

Every Taylor series (and, therefore, every Maclaurin series) provides the exact value of a function for all values of x where that series converges. That is, for any value of x on its interval of convergence, a Taylor series converges to f(x).

In practice, however, adding up an infinite number of terms simply isn’t possible. Nevertheless, you can approximate the value of f(x) by adding a finite number from the appropriate Taylor series. You do this earlier in the chapter to estimate the value of sin 10 and other expressions.

An expression built from a finite number of terms of a Taylor series is called a Taylor polynomial, Tn(x). Like other polynomials, a Taylor polynomial is identified by its degree. For example, here’s the fifth-degree Taylor polynomial, T5(x), that approximates ex:

9781118161708-eq13073.eps

Generally speaking, a higher-degree polynomial results in a better approximation. And because this polynomial comes from the Maclaurin series, where a = 0, it provides a much better estimate for values of ex when x is near 0. For the value of ex when x is near 100, however, you get a better estimate by using a Taylor polynomial for ex with a = 100:

9781118161708-eq13074.eps

To sum up, remember the following:

check A convergent Taylor series expresses the exact value of a function.

check A Taylor polynomial, Tn(x), from a convergent series approximates the value of a function.

Calculating error bounds for Taylor polynomials

In the previous section, I discuss how a Taylor polynomial approximates the value of a function:

9781118161708-eq13075.eps

In many cases, it’s helpful to measure the accuracy of an approximation. This information is provided by the Taylor remainder term:

f(x) = Tn(x) + Rn(x)

Notice that the addition of the remainder term Rn(x) turns the approximation into an equation. Here’s the formula for the remainder term:

9781118161708-eq13076.eps

warning_bomb.epsIt’s important to be clear that this equation is true for one specific value of c on the interval between a and x. It does not work for just any value of c on that interval.

Ideally, the remainder term gives you the precise difference between the value of a function and the approximation Tn(x). However, because the value of c is uncertain, in practice the remainder term really provides a worst-case scenario for your approximation.

An example should help to make this idea clear. I use the sixth-degree Taylor polynomial for cos x:

9781118161708-eq13077.eps

Suppose that I use this polynomial to approximate cos 1:

9781118161708-eq13078.eps

How accurate is this approximation likely to be? To find out, use the remainder term:

cos 1 = T6(x) + R6(x)

Adding the associated remainder term changes this approximation into an equation. Here’s the formula for the remainder term:

9781118161708-eq13079.eps

So substituting 1 for x gives you:

9781118161708-eq13080.eps

At this point, you’re apparently stuck, because you don’t know the value of sin c. However, you can plug in c = 0 and c = 1 to give you a range of possible values:

9781118161708-eq13081.eps

This simplifies to provide a very close approximation:

0 ≤ R6 (1) ≤ 0.00017

Thus, the remainder term predicts that the approximate value calculated above will be within 0.00017 of the actual value. And, in fact, 9781118161708-eq13083.eps, so:

9781118161708-eq13084.eps

As you can see, the approximation is within the error bounds predicted by the remainder term.

Understanding Why the Taylor Series Works

The best way to see why the Taylor series works is to see how it’s constructed in the first place. If you read through this chapter until this point, you should be ready to go.

To make sure that you understand every step along the way, however, I construct the Maclaurin series, which is just a tad more straightforward. This construction begins with the key assumption that a function can be expressed as a power series in the first place:

f(x) = c0 + c1x + c2x2 + c3x3 + ...

The goal now is to express the coefficients on the right side of this equation in terms of the function itself. To do this, I make another relatively safe assumption that 0 is in the domain of f(x). So when x = 0, all but the first term of the series equal 0, leaving the following equation:

f(0) = c0

This process gives you the value of the coefficient c0 in terms of the function. Now differentiate f(x):

f'(x) = c1 + 2c2x + 3c3x2 + 4c4x3...

At this point, when x = 0, all the x terms drop out:

f'(0) = c1

So you have another coefficient, c1, expressed in terms of the function. To continue, differentiate f'(x):

f"(x) = 2c2 + 6c3x + 12c4x2 + 20c5x3 + ...

Again, when x = 0, the x terms disappear:

9781118161708-eq13085.eps

By now, you’re probably noticing a pattern: You can always get the value of the next coefficient by differentiating the previous equation and substituting 0 for x into the result:

9781118161708-eq13086.eps

Furthermore, the coefficients also have a pattern:

9781118161708-eq13087.eps

Substituting these coefficients into the original equation results in the familiar Maclaurin series from earlier in this chapter:

9781118161708-eq13088.eps

technicalstuff.epsTo construct the Taylor series, use a similar line of reasoning, starting with the more general form of the power series:

f(x) = c0 + c1(xa) + c2(xa)2 + c3(xa)3 + ...

In this case, setting x = a gives you the first coefficient:

f(a) = c0

Continue to find coefficients by differentiating f(x) and then repeating the process.