Skip to main content
Logo image

Coordinated Calculus

Section 7.8 Taylor Polynomials

Polynomial functions are the simplest possible functions in mathematics, in part because they require only addition and multiplication to evaluate. Consequently, in practical applications, it is often useful to approximate complicated functions using polynomials. In this section we will learn how to obtain polynomial approximations of functions, and how to determine how good an approximation is.
As an example, consider the geometric series
(7.21)1+x+x2++xk+=k=0xk.
Here we see something very interesting: because a geometric series converges whenever its ratio r satisfies |r|<1, and the sum of a convergent geometric series is a1r, we can say that for |x|<1,
(7.22)1+x+x2++xk+=11x.
Equation (7.22) states that the non-polynomial function 11x on the right is equal to the infinite polynomial expresssion on the left. Because the terms on the left get very small as k gets large, we can truncate the series and say, for example, that
1+x+x2+x311x
for small values of x. This shows one way that a polynomial function can be used to approximate a non-polynomial function; such approximations are one of the main themes in this section and the next.
In Example 7.52, we begin our exploration of approximating functions with polynomials.

Example 7.52.

Example 7.20 showed how we can approximate the number e using linear, quadratic, and other polynomial functions; we then used similar ideas in Example 7.35 to approximate ln(2). In this example, we review and extend the process to find the “best” quadratic approximation to the exponential function ex around the origin. Let f(x)=ex throughout this example.
  1. Find a formula for P1(x), the linearization of f(x) at x=0. (We label this linearization P1 because it is a first degree polynomial approximation.) Recall that P1(x) is a good approximation to f(x) for values of x close to 0. Plot f and P1 near x=0 to illustrate this fact.
  2. Since f(x)=ex is not linear, the linear approximation eventually is not a very good one. To obtain better approximations, we want to develop a different approximation that “bends” to make it more closely fit the graph of f near x=0. To do so, we add a quadratic term to P1(x). In other words, we let
    P2(x)=P1(x)+c2x2
    for some real number c2. We need to determine the value of c2 that makes the graph of P2(x) best fit the graph of f(x) near x=0.
    Remember that P1(x) was a good linear approximation to f(x) near 0; this is because P1(0)=f(0) and P1(0)=f(0). It is therefore reasonable to seek a value of c2 so that
    P2(0)=f(0),P2(0)=f(0),and P2(0)=f(0).
    Remember, we are letting P2(x)=P1(x)+c2x2.
    1. Calculate P2(0) to show that P2(0)=f(0).
    2. Calculate P2(0) to show that P2(0)=f(0).
    3. Calculate P2(x). Then find a value for c2 so that P2(0)=f(0).
    4. Explain why the condition P2(0)=f(0) will put an appropriate “bend” in the graph of P2 to make P2 fit the graph of f around x=0.
Solution.
  1. We know that
    P1(x)=f(0)+f(0)x=1+x.
    Since P1(0)=f(0)=1 and P1(0)=f(0)=1, the graphs of P1 and f agree at x=a and have the same slope at x=0 (which means they go in the same direction at x=0). This is why P1(x) is a good approximation to f(x) for values of x close to 0.
    1. Since
      P2(x)=P1(x)+c2(x)2=f(0)+f(0)x+c2x2
      we have that
      P2(0)=1=f(0)
      as desired.
    2. A simple calculation shows P2(x)=P1(x)+2c2x. So P2(0)=P1(0)=1=f(0) as desired.
    3. A simple calculation shows P2(x)=2c2. So P2(0)=2c2. To have P2(0)=f(0) we must have 2c2=f(0) or c2=f(0)2=12.
    4. The second derivative of a function tells us the concavity of the function. Concavity measures how the slopes of the tangent lines to the graph of the function are changing. This tells us how much bend there is in the graph. So if P2(0)=f(0), then P2 will have the same bend in it at x=0 as f does. This will make the graph of P2 mold to the graph of f around x=0.

Subsection 7.8.1 Taylor Polynomials

Example 7.52 illustrates the first steps in the process of approximating functions with polynomials. Using this process we can approximate trigonometric, exponential, logarithmic, and other nonpolynomial functions as closely as we like (for certain values of x) with polynomials. This is extraordinarily useful in that it allows us to calculate values of these functions to whatever precision we like using only the operations of addition, subtraction, multiplication, and division, which can be easily programmed in a computer.
We next extend the approach in Example 7.52 to arbitrary functions at arbitrary points. Let f be a function that has as many derivatives as we need at a point x=a. Recall that P1(x) is the tangent line to f at (a,f(a)) and is given by the formula
P1(x)=f(a)+f(a)(xa).
P1(x) is the linear approximation to f near a that has the same slope and function value as f at the point x=a.
We next want to find a quadratic approximation
P2(x)=P1(x)+c2(xa)2
so that P2(x) more closely models f(x) near x=a. Consider the following calculations of the values and derivatives of P2(x):
P2(x)=P1(x)+c2(xa)2P2(a)=P1(a)=f(a)P2(x)=P1(x)+2c2(xa)P2(a)=P1(a)=f(a)P2(x)=2c2P2(a)=2c2.
To make P2(x) fit f(x) better than P1(x), we want P2(x) and f(x) to have the same concavity at x=a, in addition to having the same slope and function value. That is, we want to have
P2(a)=f(a).
This implies that
2c2=f(a)
and thus
c2=f(a)2.
Therefore, the quadratic approximation P2(x) to f centered at x=a is
P2(x)=f(a)+f(a)(xa)+f(a)2!(xa)2.
This approach extends naturally to polynomials of higher degree. We define polynomials
P3(x)=P2(x)+c3(xa)3,P4(x)=P3(x)+c4(xa)4,P5(x)=P4(x)+c5(xa)5,
and in general
Pn(x)=Pn1(x)+cn(xa)n.
The defining property of these polynomials is that for each n, Pn(x) and all its first n derivatives must agree with those of f at x=a. In other words we require that
Pn(k)(a)=f(k)(a)
for all k from 0 to n.
To see the conditions under which this happens, suppose
Pn(x)=c0+c1(xa)+c2(xa)2++cn(xa)n.
Then
Pn(0)(a)=c0Pn(1)(a)=c1Pn(2)(a)=2c2Pn(3)(a)=(2)(3)c3Pn(4)(a)=(2)(3)(4)c4Pn(5)(a)=(2)(3)(4)(5)c5
and, in general,
Pn(k)(a)=(2)(3)(4)(k1)(k)ck=k!ck.
So having Pn(k)(a)=f(k)(a) means that k!ck=f(k)(a) and therefore
ck=f(k)(a)k!
for each value of k. Using this expression for ck, we have found the formula for the polynomial approximation of f that we seek. Such a polynomial is called a Taylor polynomial.

Taylor Polynomials.

The nth order Taylor polynomial of f centered at x=a is given by
Pn(x)=(f(a)+f(a)(xa)+f(a)2!(xa)2++f(n)(a)n!(xa)n=(k=0nf(k)(a)k!(xa)k.
This degree n polynomial approximates f(x) near x=a and has the property that Pn(k)(a)=f(k)(a) for k=0,1,,n.

Example 7.53.

Determine the third order Taylor polynomial for f(x)=ex, as well as the general nth order Taylor polynomial for f centered at x=0.
Solution.
We know that f(x)=ex and so f(x)=ex and f(x)=ex. Thus,
f(0)=f(0)=f(0)=f(0)=1.
So the third order Taylor polynomial of f(x)=ex centered at x=0 is
P3(x)=f(0)+f(0)(x0)+f(0)2!(x0)2+f(0)3!(x0)3=1+x+x22+x36.
In general, for the exponential function f we have f(k)(x)=ex for every positive integer k. Thus, the kth term in the nth order Taylor polynomial for f(x) centered at x=0 is
f(k)(0)k!(x0)k=1k!xk.
Therefore, the nth order Taylor polynomial for f(x)=ex centered at x=0 is
Pn(x)=1+x+x22!++1n!xn=k=0nxkk!.

Example 7.54.

We have just seen that the nth order Taylor polynomial centered at a=0 for the exponential function ex is
k=0nxkk!.
In this example, we determine small order Taylor polynomials for several other familiar functions, and look for general patterns.
  1. Let f(x)=11x.
    1. Calculate the first four derivatives of f(x) at x=0. Then find the fourth order Taylor polynomial P4(x) for 11x centered at 0.
    2. Based on your results from part (i), determine a general formula for f(k)(0).
  2. Let f(x)=cos(x).
    1. Calculate the first four derivatives of f(x) at x=0. Then find the fourth order Taylor polynomial P4(x) for cos(x) centered at 0.
    2. Based on your results from part (i), find a general formula for f(k)(0). (Think about how k being even or odd affects the value of the kth derivative.)
  3. Let f(x)=sin(x).
    1. Calculate the first four derivatives of f(x) at x=0. Then find the fourth order Taylor polynomial P4(x) for sin(x) centered at 0.
    2. Based on your results from part (i), find a general formula for f(k)(0). (Think about how k being even or odd affects the value of the kth derivative.)
Answer.
    1. f(k)(0)=k!.
    2. Pn(x)=k=0nxk.
    1. fk(0)=0 if k is odd, and f2k(0)=(1)k.
    2. Pn(x)=1x22+x44!x66!++(1)n/2xnn! if n is even and Pn(x)=1x22+x44!x66!++(1)(n1)/2x(n1)(n1)! if n is odd.
    1. fk(0)=0 if k is even and f2k+1(0)=(1)k.
    2. Pn(x)=xx33!+x55!x77!++(1)(n1)/2xnn! if n is odd and Pn(x)=xx33!+x55!x77!++(1)n/2+1xn1(n1)! if n is even.
Solution.
    1. The first four derivatives of f(x) at x=0 are
      f(x)=11xf(0)=1f(x)=1(1x)2f(0)=1f(x)=2(1x)3f(0)=2f(3)(x)=3!(1x)4f(3)(0)=3!f(4)(x)=4!(1x)5f(4)(0)=4!.
      It appears that the pattern is
      f(k)(0)=k!.
    2. The nth order Taylor polynomial for f at x=0 is
      k=0nf(k)k!xk=k=0nk!k!xk=k=0nxk.
      This makes sense since f(x) is the sum of the geometric series with ratio x, so the nth order Taylor polynomial should just be the nth partial sum of this geometric series.
    1. The first four derivatives of f(x) at x=0 are
      f(x)=cos(x)f(0)=1f(x)=sin(x)f(0)=0f(x)=cos(x)f(0)=1f(3)(x)=sin(x)f(3)(0)=0f(4)(x)=cos(x)f(4)(0)=1.
      It appears that the odd derivatives of f(x) are all plus or minus sin(x) and so have values of 0 at x=0 and the even derivatives are ±cos(x) and have alternating values of 1 and 1 at x0. Since the even numbers can be represented in the form 2k where k is an integer we have fk(0)=0 if k is odd and f2k(0)=(1)k.
    2. Based on the previous part of this problem the nth order Taylor polynomial for cos(x) is
      1x22+x44!x66!++(1)n/2xnn!
      if n is even and
      1x22+x44!x66!++(1)(n1)/2xn1(n1)!
      if n is odd.
    1. The first four derivatives of f(x) at x=0 are
      f(x)=sin(x)f(0)=0f(x)=cos(x)f(0)=1f(x)=sin(x)f(0)=0f(3)(x)=cos(x)f(3)(0)=1f(4)(x)=sin(x)f(4)(0)=0.
      It appears that the even derivatives of f(x) are all plus or minus sin(x) and so have values of 0 at x=0 and the odd derivatives are ±cos(x) and have alternating values of 1 and 1 at x=0. Since the odd numbers can be represented in the form 2k+1 where k is an integer we have fk(0)=0 if k is even and f2k+1(0)=(1)k.
    2. Based on the previous part of this problem the nth order Taylor polynomial for sin(x) is
      xx33!+x55!x77!++(1)(n1)/2xnn!
      if n is odd and
      xx33!+x55!x77!++(1)n/2+1xn1(n1)!
      if n is even.
It is possible that an nth order Taylor polynomial is not a polynomial of degree n; that is, the order of the approximation can be different from the degree of the polynomial. For example, in Example 7.56 we found that the second order Taylor polynomial P2(x) centered at 0 for sin(x) is P2(x)=x. In this case, the second order Taylor polynomial is a degree 1 polynomial.

Subsection 7.8.2 Summary

  • We can use Taylor polynomials to approximate functions. This allows us to approximate values of functions using only addition, subtraction, multiplication, and division of real numbers. The nth order Taylor polynomial centered at x=a of a function f is
    Pn(x)=(f(a)+f(a)(xa)+f(a)2!(xa)2++f(n)(a)n!(xa)n=(k=0nf(k)(a)k!(xa)k.

Exercises 7.8.3 Exercises

1. Determining Taylor polynomials from a function formula.

Find the Taylor polynomials of degree n approximating cos(4x) for x near 0:
For n=2, P2(x)=
For n=4, P4(x)=
For n=6, P6(x)=

2. Determining Taylor polynomials from given derivative values.

Suppose g is a function which has continuous derivatives, and that g(7)=2,g(7)=1, g(7)=4, g(7)=1.
(a) What is the Taylor polynomial of degree 2 for g near 7?
P2(x)=
(b) What is the Taylor polynomial of degree 3 for g near 7?
P3(x)=
(c) Use the two polynomials that you found in parts (a) and (b) to approximate g(6.9).
With P2, g(6.9)
With P3, g(6.9)