9 Sequences and Series

9.9 Taylor Polynomials

Consider a function y=f(x) and a point (c,f(c)). The derivative, f(c), gives the instantaneous rate of change of f at x=c. Of all lines that pass through the point (c,f(c)), the line that best approximates f at this point is the tangent line; that is, the line whose slope (rate of change) is f(c).

margin:

y=f(x)

y=p1(x)

-4

-2

2

4

-5

5

x

y
f(0) =2 f′′′(0) =-1 f(0) =1 f(4)(0) =-12 f′′(0) =2 f(5)(0) =-19
Figure 9.9.1: Plotting y=f(x) and a table of derivatives of f evaluated at 0.

In Figure 9.9.1, we see a function y=f(x) graphed. The table below the graph shows that f(0)=2 and f(0)=1; therefore, the tangent line to f at x=0 is p1(x)=1(x-0)+2=x+2. The tangent line is also given in the figure. Note that “near” x=0, p1(x)f(x); that is, the tangent line approximates f well.

One shortcoming of this approximation is that the tangent line only matches the slope of f; it does not, for instance, match the concavity of f. We can find a polynomial, p2(x), that does match the concavity without much difficulty, though. The table in Figure 9.9.1 gives the following information:

f(0)=2  f(0)=1  f′′(0)=2.

Therefore, we want our polynomial p2(x) to have these same properties. That is, we need

p2(0)=2  p2(0)=1  p2′′(0)=2.

This is simply an initial-value problem. We can solve this using the techniques first described in Section 5.1. To keep p2(x) as simple as possible, we’ll assume that not only p2′′(0)=2, but that p2′′(x)=2. That is, the second derivative of p2 is constant.

margin:

y=p2(x)

y=p4(x)

-4

-2

2

4

-5

5

x

y
Figure 9.9.2: Plotting f, p2, and p4.
margin:

y=p13(x)

-4

-2

2

4

-5

5

x

y
Figure 9.9.3: Plotting f and p13.

If p2′′(x)=2, then p2(x)=2x+C for some constant C. Since we have determined that p2(0)=1, we find that C=1 and so p2(x)=2x+1. Finally, we can compute p2(x)=x2+x+C. Using our initial values, we know p2(0)=2 so C=2. We conclude that p2(x)=x2+x+2. This function is plotted with f in Figure 9.9.2.

We can repeat this approximation process by creating polynomials of higher degree that match more of the derivatives of f at x=0. In general, a polynomial of degree n can be created to match the first n derivatives of f. Figure 9.9.2 also shows p4(x)=-x4/2-x3/6+x2+x+2, whose first four derivatives at 0 match those of f. (Using the table in Figure 9.9.1, start with p4(4)(x)=-12 and solve the related initial-value problem.)

As we use more and more derivatives, our polynomial approximation to f gets better and better. In this example, the interval on which the approximation is “good” gets bigger and bigger. Figure 9.9.3 shows p13(x); we can visually affirm that this polynomial approximates f very well on [-2,3]. The polynomial p13(x) is fairly complicated:

16901x136227020800+13x121209600-1321x1139916800-779x101814400-359x9362880+x8240+139x75040+11x6360-19x5120-x42-x36+x2+x+2.

The polynomials we have created are examples of Taylor polynomials, named after the British mathematician Brook Taylor who made important discoveries about such functions. While we created the above Taylor polynomials by solving initial-value problems, it can be shown that Taylor polynomials follow a general pattern that make their formation much more direct. This is described in the following definition.

Definition 9.9.1      Taylor Polynomial, Maclaurin Polynomial

Let f be a function whose first n derivatives exist at x=c.

  1. 1.

    The Taylor polynomial of degree n of f at x=c is

    pn(x) =f(c)+f(c)(x-c)+f′′(c)2!(x-c)2+f′′′(c)3!(x-c)3++f(n)(c)n!(x-c)n
    =k=0nf(k)(c)k!(x-c)k.
  2. 2.

    A special case of the Taylor polynomial is the Maclaurin polynomial, where c=0. That is, the Maclaurin polynomial of degree n of f is

    pn(x) =f(0)+f(0)x+f′′(0)2!x2+f′′′(0)3!x3++f(n)(0)n!xn
    =k=0nf(k)(0)k!xk.
margin: Note: The summations in this definition use the convention that x0=1 even when x=0 and that f(0)=f. They also use the definition that 0!=1.

Generally, we order the terms of a polynomial to have decreasing degrees, and that is how we began this section. This definition, and the rest of this chapter, reverses this order to reflect the greater importance of the lower degree terms in the polynomials that we will be finding.

We will practice creating Taylor and Maclaurin polynomials in the following examples.

Example 9.9.1 Finding and using Maclaurin polynomials


  1. 1.

    Find the nth Maclaurin polynomial for f(x)=ex.

  2. 2.

    Use p5(x) to approximate the value of e.

Solution

  1. 1.

    We start with creating a table of the derivatives of ex evaluated at x=0. In this particular case, this is relatively simple, as shown in Figure 9.9.4. margin: f(x) =ex f(0) =1 f(x) =ex f(0) =1 f′′(x) =ex f′′(0) =1 f(n)(x) =ex f(n)(0) =1 Figure 9.9.4: The derivatives of f(x)=ex evaluated at x=0. By the definition of the Maclaurin polynomial, we have

    pn(x)=k=0nf(k)(0)k!xk=k=0n1k!xk.
  2. 2.

    Using our answer from part 1, we have

    p5(x)=1+x+12x2+16x3+124x4+1120x5.

    To approximate the value of e, note that e=e1=f(1)p5(1). It is very straightforward to evaluate p5(1): margin:

    y=p5(x)

    -2

    2

    5

    10

    x

    y
    Figure 9.9.5: A plot of f(x)=ex and its 5th degree Maclaurin polynomial p5(x).

    p5(1)=1+1+12+16+124+1120=163602.71667.

    This is an error of about 0.0016, or 0.06% of the true value.

    A plot of f(x)=ex and p5(x) is given in Figure 9.9.5.

Example 9.9.2 Finding and using Taylor polynomials


  1. 1.

    Find the nth Taylor polynomial of y=lnx at x=1.

  2. 2.

    Use p6(x) to approximate the value of ln1.5.

  3. 3.

    Use p6(x) to approximate the value of ln2.

Solution

  1. 1.

    We begin by creating a table of derivatives of lnx evaluated at x=1. While this is not as straightforward as it was in the previous example, a pattern does emerge, as shown in Figure 9.9.6.

    Using Definition 9.9.1, we have

    pn(x)=k=0nf(k)(c)k!(x-c)k=k=1n(-1)k+1k(x-1)k.
  2. 2.

    We can compute p6(x) using our work above: margin: f(x) =lnx f(1) =0 f(x) =1/x f(1) =1 f′′(x) =-1/x2 f′′(1) =-1 f′′′(x) =2/x3 f′′′(1) =2 f(4)(x) =-6/x4 f(4)(1) =-6 f(n)(x) = f(n)(1) = (-1)n+1(n-1)!xn (-1)n+1(n-1)! Figure 9.9.6: Derivatives of lnx evaluated at x=1.

    p6(x)=(x-1)-12(x-1)2+13(x-1)3-14(x-1)4+15(x-1)5-16(x-1)6.

    Since p6(x) approximates lnx well near x=1, we approximate ln1.5p6(1.5): margin:

    y=lnx

    y=p6(x)

    1

    2

    3

    -4

    -2

    2

    x

    y
    Figure 9.9.7: A plot of y=lnx and its 6th degree Taylor polynomial at x=1.

    p6(1.5) =(1.5-1)-12(1.5-1)2+13(1.5-1)3
        -14(1.5-1)4+15(1.5-1)5-16(1.5-1)6
    =259640
    0.404688.

    This is a good approximation as a calculator shows that ln1.50.4055. Figure 9.9.7 plots y=lnx with y=p6(x). We can see that ln1.5p6(1.5).

  3. 3.

    We approximate ln2 with p6(2):

    p6(2) =(2-1)-12(2-1)2+13(2-1)3
        -14(2-1)4+15(2-1)5-16(2-1)6
    =1-12+13-14+15-16
    =3760
    0.616667.

    This approximation is not terribly impressive: a hand held calculator shows that ln20.693147. The graph in Figure 9.9.7 shows that p6(x) provides less accurate approximations of lnx as x gets close to 0 or 2.

    margin:

    y=lnx

    y=p20(x)

    1

    2

    3

    -4

    -2

    2

    x

    y
    Figure 9.9.8: A plot of y=lnx and its 20th degree Taylor polynomial at x=1.

    Surprisingly enough, even the 20th degree Taylor polynomial fails to approximate lnx for x>2, as shown in Figure 9.9.8. We’ll soon discuss why this is.

Taylor polynomials are used to approximate functions f(x) in mainly two situations:

  1. 1.

    When f(x) is known, but perhaps “hard” to compute directly. For instance, we can define y=cosx as either the ratio of sides of a right triangle (“adjacent over hypotenuse”) or with the unit circle. However, neither of these provides a convenient way of computing cos2. A Taylor polynomial of sufficiently high degree can provide a reasonable method of computing such values using only operations usually hard-wired into a computer (+, -, × and ÷).

  2. 2.

    When f(x) is not known, but information about its derivatives is known. This occurs more often than one might think, especially in the study of differential equations.

margin: Note: Even though Taylor polynomials could be used in calculators and computers to calculate values of trigonometric functions, in practice they generally aren’t. Other more efficient and accurate methods have been developed, such as the CORDIC algorithm.

In both situations, a critical piece of information to have is “How good is my approximation?” If we use a Taylor polynomial to compute cos2, how do we know how accurate the approximation is?

We had the same problem when studying Numerical Integration. Theorem 8.7.1 provided bounds on the error when using, say, Simpson’s Rule to approximate a definite integral. These bounds allowed us to determine that, for example, using 10 subintervals provided an approximation within ±.01 of the exact value. The following theorem gives similar bounds for Taylor (and hence Maclaurin) polynomials.

Theorem 9.9.1      Taylor’s Theorem


  1. 1.

    Let f be a function whose (n+1)th derivative exists on an open interval I and let c be in I. Then, for each x in I, there exists zx between x and c such that

    f(x)=k=0nf(k)(c)k!(x-c)k+Rn(x),

    where Rn(x)=f(n+1)(zx)(n+1)!(x-c)n+1.

  2. 2.

    |Rn(x)|maxz|f(n+1)(z)|(n+1)!|x-c|n+1, where z is between x and c.

The first part of Taylor’s Theorem states that f(x)=pn(x)+Rn(x), where pn(x) is the nth order Taylor polynomial and Rn(x) is the remainder, or error, in the Taylor approximation. The second part gives bounds on how big that error can be. If the (n+1)th derivative is large, the error may be large; if x is far from c, the error may also be large. However, the (n+1)! term in the denominator tends to ensure that the error gets smaller as n increases.

The following example computes error estimates for the approximations of ln1.5 and ln2 made in Example 9.9.2.

Example 9.9.3 Finding error bounds of a Taylor polynomial

Use Theorem 9.9.1 to find error bounds when approximating ln1.5 and ln2 with p6(x), the Taylor polynomial of degree 6 of f(x)=lnx at x=1, as calculated in Example 9.9.2.

Solution

  1. 1.

    We start with the approximation of ln1.5 with p6(1.5). The theorem references max|f(n+1)(z)|. In our situation, this is asking “How big can the 7th derivative of y=lnx be on the interval [1,1.5]?” The seventh derivative is y=-6!/x7. The largest absolute value it attains on I is 720. Thus we can bound the error as:

    |R6(1.5)| max|f(7)(z)|7!|1.5-1|7
    7205040127
    0.001.

    We computed p6(1.5)=0.404688; using a calculator, we find ln1.50.405465, so the actual error is about 0.000778 (or 0.2%), which is less than our bound of 0.001. This affirms Taylor’s Theorem; the theorem states that our approximation would be within about one thousandth of the actual value, whereas the approximation was actually closer.

  2. 2.

    The maximum value of the seventh derivative of f on [1,2] again 720 (as the largest values come at x=1). Thus

    |R6(2)| max|f(7)(z)|7!|2-1|7
    720504017
    0.28.

    This bound is not as nearly as good as before. Using the degree 6 Taylor polynomial at x=1 will bring us within 0.3 of the correct answer. As p6(2)0.61667, our error estimate guarantees that the actual value of ln2 is somewhere between 0.33667 and 0.89667. These bounds are not particularly useful.

    In reality, our approximation was only off by about 0.07 (or 11%). However, we are approximating ostensibly because we do not know the real answer. In order to be assured that we have a good approximation, we would have to resort to using a polynomial of higher degree.

We practice again. This time, we use Taylor’s theorem to find n that guarantees our approximation is within a certain amount.

Example 9.9.4 Finding sufficiently accurate Taylor polynomials

Find n such that the nth Taylor polynomial of f(x)=cosx at x=0 approximates cos2 to within 0.001 of the actual answer. What is pn(2)?

SolutionFollowing Taylor’s theorem, we need bounds on the size of the derivatives of f(x)=cosx. In the case of this trigonometric function, this is easy. All derivatives of cosine are ±sinx or ±cosx. In all cases, these functions are never greater than 1 in absolute value. We want the error to be less than 0.001. To find the appropriate n, consider the following inequalities:

max|f(n+1)(z)|(n+1)!|2-0|n+1 0.001
1(n+1)!2n+1 0.001

We find an n that satisfies this last inequality with trial-and-error. When n=8, we have 28+1(8+1)!0.0014; when n=9, we have 29+1(9+1)!0.000282<0.001. Thus we want to approximate cos2 with p9(2).

We now set out to compute p9(x). We again need a table of the derivatives of f(x)=cosx evaluated at x=0. A table of these values is given in Figure 9.9.9. Notice how the derivatives, evaluated at x=0, follow a certain pattern. All the odd powers of x in the Taylor polynomial will disappear as their coefficient is 0. While our error bounds state that we need p9(x), our work shows that this will be the same as p8(x). margin: f(x) =cosx f(0) =1 f(x) =-sinx f(0) =0 f′′(x) =-cosx f′′(0) =-1 f′′′(x) =sinx f′′′(0) =0 f(4)(x) =cosx f(4)(0) =1 f(5)(x) =-sinx f(5)(0) =0 f(6)(x) =-cosx f(6)(0) =-1 f(7)(x) =sinx f(7)(0) =0 f(8)(x) =cosx f(8)(0) =1 f(9)(x) =-sinx f(9)(0) =0 Figure 9.9.9: A table of the derivatives of f(x)=cosx evaluated at x=0.

Since we are forming our polynomial at x=0, we are creating a Maclaurin polynomial, and:

p8(x)=k=08f(k)(0)k!xk=1-12!x2+14!x4-16!x6+18!x8
margin:

y=p8(x)

-5

-4

-3

-2

-1

1

2

3

4

5

-1

1

x

y

f(x)=cosx
Figure 9.9.10: A graph of f(x)=cosx and its degree 8 Maclaurin polynomial.

We finally approximate cos2:

cos2p8(2)=-131315-0.41587.

Our error bound guarantee that this approximation is within 0.001 of the correct answer. Technology shows us that our approximation is actually within about 0.0003 (or 0.07%) of the correct answer.

Figure 9.9.10 shows a graph of y=p8(x) and y=cosx. Note how well the two functions agree on about (-π,π).

Example 9.9.5 Finding and using Taylor polynomials


  1. 1.

    Find the degree 4 Taylor polynomial, p4(x), for f(x)=x at x=4.

  2. 2.

    Use p4(x) to approximate 3.

  3. 3.

    Find bounds on the error when approximating 3 with p4(3).

Solution

  1. 1.

    We begin by evaluating the derivatives of f at x=4. This is done in Figure 9.9.11. These values allow us to form the Taylor polynomial p4(x): margin: f(x) =x f(4) =2 f(x) =12x f(4) =14 f′′(x) =-14x3/2 f′′(4) =-132 f′′′(x) =38x5/2 f′′′(4) =3256 f(4)(x) =-1516x7/2 f(4)(4) =-152048 Figure 9.9.11: A table of the derivatives of f(x)=x evaluated at x=4.

    p4(x)=2+14(x-4)+-1/322!(x-4)2+3/2563!(x-4)3+-15/20484!(x-4)4.
  2. 2.

    As p4(x)x near x=4, we approximate 3 with p4(3)=1.73212.

  3. 3.

    The largest value the fifth derivative of f(x)=x takes on [3,4] is when x=3, at about 0.0234. Thus

    |R4(3)|0.02345!|3-4|50.00019.
    margin:

    y=x

    y=p4(x)

    5

    10

    1

    2

    3

    x

    y
    Figure 9.9.12: A graph of f(x)=x and its degree 4 Taylor polynomial at x=4.

    This shows our approximation is accurate to at least the first 2 places after the decimal. It turns out that our approximation has an error of 0.00007, or 0.004%. A graph of f(x)=x and p4(x) is given in Figure 9.9.12. Note how the two functions are nearly indistinguishable on (2,7).


Most of this chapter has been devoted to the study of infinite series. This section has stepped aside from this study, focusing instead on finite summation of terms. In the next section, we will combine power series and Taylor polynomials into Taylor Series, where we represent a function with an infinite series.

Exercises 9.9

 

Terms and Concepts

  1. 1.

    What is the difference between a Taylor polynomial and a Maclaurin polynomial?

  2. 2.

    T/F: In general, pn(x) approximates f(x) better and better as n gets larger.

  3. 3.

    For some function f(x), the Maclaurin polynomial of degree 4 is p4(x)=6+3x-4x2+5x3-7x4. What is p2(x)?

  4. 4.

    For some function f(x), the Maclaurin polynomial of degree 4 is p4(x)=6+3x-4x2+5x3-7x4. What is f′′′(0)?

Problems

In Exercises 5–12, find the Maclaurin polynomial of degree n for the given function.

  1. 5.

    f(x)=e-x,n=3

  2. 6.

    f(x)=sinx,n=8

  3. 7.

    f(x)=xex,n=5

  4. 8.

    f(x)=tanx,n=6

  5. 9.

    f(x)=e2x,n=4

  6. 10.

    f(x)=11-x,n=4

  7. 11.

    f(x)=11+x,n=4

  8. 12.

    f(x)=11+x,n=7

In Exercises 13–20, find the Taylor polynomial of degree n, at x=c, for the given function.

  1. 13.

    f(x)=x,n=4,c=1

  2. 14.

    f(x)=ln(x+1),n=4,c=1

  3. 15.

    f(x)=cosx,n=6,c=π/4

  4. 16.

    f(x)=sinx,n=5,c=π/6

  5. 17.

    f(x)=1x,n=5,c=2

  6. 18.

    f(x)=1x2,n=8,c=1

  7. 19.

    f(x)=1x2+1,n=3,c=-1

  8. 20.

    f(x)=x2cosx,n=2,c=π

In Exercises 21–24, approximate the function value with the indicated Taylor polynomial and give approximate bounds on the error.

  1. 21.

    Approximate sin0.1 with the Maclaurin polynomial of degree 3.

  2. 22.

    Approximate cos1 with the Maclaurin polynomial of degree 4.

  3. 23.

    Approximate 10 with the Taylor polynomial of degree 2 centered at x=9.

  4. 24.

    Approximate ln1.5 with the Taylor polynomial of degree 3 centered at x=1.

Exercises 25–28 ask for an n to be found such that pn(x) approximates f(x) within a certain bound of accuracy.

  1. 25.

    Find n such that the Maclaurin polynomial of degree n of f(x)=ex approximates e within 0.0001 of the actual value.

  2. 26.

    Find n such that the Taylor polynomial of degree n of f(x)=x, centered at x=4, approximates 3 within 0.0001 of the actual value.

  3. 27.

    Find n such that the Maclaurin polynomial of degree n of f(x)=cosx approximates cosπ/3 within 0.0001 of the actual value.

  4. 28.

    Find n such that the Maclaurin polynomial of degree n of f(x)=sinx approximates cosπ within 0.0001 of the actual value.

In Exercises 29–34, find the xn term of the indicated Taylor polynomial.

  1. 29.

    Find a formula for the xn term of the Maclaurin polynomial for f(x)=ex.

  2. 30.

    Find a formula for the xn term of the Maclaurin polynomial for f(x)=cosx.

  3. 31.

    Find a formula for the xn term of the Maclaurin polynomial for f(x)=sinx.

  4. 32.

    Find a formula for the xn term of the Maclaurin polynomial for f(x)=11-x.

  5. 33.

    Find a formula for the xn term of the Maclaurin polynomial for f(x)=11+x.

  6. 34.

    Find a formula for the xn term of the Taylor polynomial for f(x)=lnx centered at c=1.

In Exercises 35–36, approximate the solution to the given differential equation with a degree 4 Maclaurin polynomial.

  1. 35.

    y=y,   y(0)=1

  2. 36.

    y=2y,  y(0)=1

Modern Campus CMS