Loading [MathJax]/jax/output/CommonHTML/jax.js

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

nk=0akxk.

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

nk=0akxk

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)=nk=0f(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)!

.

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

Finite Difference Approximation

For a differentiable function f:RR, the derivative is defined as

f(x)=limh0f(x+h)f(x)h

Let’s consider the finite difference approximation to the first derivative as

f(x)f(x+h)f(x)h

where h is often called a “perturbation”, i.e., a “small” change to the variable x (small when compared to the magnitude of x). By the Taylor’s theorem, we can write

f(x+h)=f(x)+f(x)h+f(ξ)h22

for some ξ[x,x+h]. Rearranging the above we get

f(x)=f(x+h)f(x)hf(ξ)h2

Therefore, the truncation error of the finite difference approximation is bounded by Mh/2, where M is a bound on |f(ξ)| for ξ near x.

Reference text: “Scientific Computing: an introductory survey” by Michael Heath

Review Questions

ChangeLog