Taylor Series


Learning Objectives

Degree n Polynomial

A polynomial in a variable x can always be written (or rewritten) in the form

anxn+an1xn1++a2x2+a1x+a0

where ai (0in) are constants.

Using the summation notation, we can express the polynomial concisely by

k=0nakxk.

If an0, the polynomial is called an n-th degree polynomial.

Degree n Polynomial as a Linear Combination of Monomials

A monomial in a variable x is a power of x where the exponent is a nonnegative integer (i.e. xn where n is a nonnegative integer). You might see another definition of monomial which allows a nonzero constant as a coefficient in the monomial (i.e. axn where a is nonzero and n is a nonnegative integer). Then an n-th degree polynomial

k=0nakxk

can be seen as a linear combination of monomials xi | 0in.

Taylor Series Expansion, Infinite

A Taylor series is a representation of a function as an infinite sum of terms that are calculated from the values of the function’s derivatives at a single point. The Taylor series expansion about x=x0 of a function f(x) that is infinitely differentiable at x0 is the power series

f(x0)+f(x0)1!(xx0)+f(x0)2!(xx0)2+f(x0)3!(xx0)3+

Using the summation notation, we can express the Taylor series concisely by

k=0f(k)(x0)k!(xx0)k.

(Recall that 0!=1)

Taylor Series Expansion, Finite

In practice, however, we often cannot compute the (infinite) Taylor series of the function, or the function is not infinitely differentiable at some points. Therefore, we often have to truncate the Taylor series (use a finite number of terms) to approximate the function.

Taylor Series Approximation of Degree n

If we use the first n+1 terms of the Taylor series, we will get

Tn(x)=k=0nf(k)(x0)k!(xx0)k,

which is called a Taylor polynomial of degree n.

Error Bound when Truncating a Taylor Series

Suppose that f(x) is an n+1 times differentiable function of x, and Tn(x) is the Taylor polynomial of degree n for f(x) centered at x0. Then when h=|xx0|0, we obtain the truncation error bound by |f(x)Tn(x)|Chn+1=O(hn+1)

We will see the exact expression of C in the next section: Taylor Remainder Theorem.

Taylor Remainder Theorem

Suppose that f(x) is an n+1 times differentiable function of x. Let Rn(x) denote the difference between f(x) and the Taylor polynomial of degree n for f(x) centered at x0. Then

Rn(x)=f(x)Tn(x)=f(n+1)(ξ)(n+1)!(xx0)n+1

for some ξ between x and x0. Thus, the constant C mentioned above is

maxξ|f(n+1)(ξ)|(n+1)!

.

Asymptotic behavior of the error

Let’s say we have f(x) approximated using tn(x). Suppose the given interval is h1 between x0 and x and the error associated with it is e1. Let’s say we have another interval h2 and we need to find the error e2 associated with it.

Using the formula e=O(hn+1), we get

e1h1n+1 e2h2n+1

e1e2=(h1h2)n+1

e2=(h2h1)n+1e1

Examples

Example of a Taylor Series Expansion

Suppose we want to expand f(x)=cosx about the point x0=0. Following the formula

f(x)=f(x0)+f(x0)1!(xx0)+f(x0)2!(xx0)2+f(x0)3!(xx0)3+

we need to compute the derivatives of f(x)=cosx at x=x0.

f(x0)=cos(0)=1f(x0)=sin(0)=0f(x0)=cos(0)=1f(x0)=sin(0)=0f(4)(x0)=cos(0)=1

Then

cosx=f(0)+f(0)1!x+f(0)2!x2+f(0)3!x3+=1+012x2+0+=k=0(1)k(2k)!x2k

Example of Using a Truncated Taylor Series to Approximate a Function

Suppose we want to approximate f(x)=sinx at x=2 using a degree-4 Taylor polynomial about (centered at) the point x0=0. Following the formula

f(x)f(x0)+f(x0)1!(xx0)+f(x0)2!(xx0)2+f(x0)3!(xx0)3+f(4)(x0)4!(xx0)4,

we need to compute the first 4 derivatives of f(x)=sinx at x=x0.

f(x0)=sin(0)=0f(x0)=cos(0)=1f(x0)=sin(0)=0f(x0)=cos(0)=1f(4)(x0)=sin(0)=0

Then

sinxf(0)+f(0)1!x+f(0)2!x2+f(0)3!x3+f(4)(0)4!x4=0+x+013!x3+0=x16x3

Using this truncated Taylor series centered at x0=0, we can approximate f(x)=sin(x) at x=2. To do so, we simply plug x=2 into the above formula for the degree 4 Taylor polynomial giving

sin(2)2162328623.

Example of an Error Bound

Suppose we want to approximate f(x)=sinx using a degree-4 Taylor polynomial expanded about the point x0=0. We want to compute the error bound for this approximation. Following Taylor Remainder Theorem,

R4(x)=f(5)(ξ)5!(xx0)5

for some ξ between x0 and x.

If we want to find the upper bound for the absolute error, we are looking for an upper bound for |f(5)(ξ)|.

Since f(5)(x)=cosx, we have |f(5)(ξ)|1. Then |R4(x)|=|f(5)(ξ)5!(xx0)5|=|f(5)(ξ)|5!|x|51120|x|5

Example of error predictions

Suppose you expand x10 in a Taylor polynomial of degree 3 about the center x0=12. For h1=0.5, you find that the Taylor truncation error is about 104.

We can use e2=(h2h1)n+1e1 to find the Taylor truncation error for h2=0.25.

Here, n=3 and hence e2=(0.250.5)4104=0.625105.

Review Questions

ChangeLog