1 Approximating Integrals using Taylor Polynomials

Seunghee Ye

Ma 8: Week 7

Nov 10

Week 7 Summary This week, we will learn how we can approximate integrals using Taylor series and numerical methods.

Topics

Page

1 Approximating Integrals using Taylor Polynomials

1

1.1 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.2 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

1.3 Approximating Integrals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Numerical Integration

5

1 Approximating Integrals using Taylor Polynomials

1.1 Definitions

When we first defined the derivative, recall that it was supposed to be the "instantaneous rate of change" of a function f (x) at a given point c. In other words, f gives us a linear approximation of f (x) near c: for small values of R, we have

f (c + ) f (c) + f (c)

But if f (x) has higher order derivatives, why stop with a linear approximation? Taylor series take this idea of linear approximation and extends it to higher order derivatives, giving us a better approximation of f (x) near c.

Definition (Taylor Polynomial and Taylor Series)

Let f (x) be a Cn function i.e. f is n-times continuously differentiable. Then, the n-th order Taylor

polynomial of f (x) about c is:

Tn(f )(x) =

n

f (k)(c) (x - c)k k!

k=0

The n-th order remainder of f (x) is:

Rn(f )(x) = f (x) - Tn(f )(x)

If f (x) is C, then the Taylor series of f (x) about c is:

T(f )(x) =

f (k)(c) (x - c)k k!

k=0

Note that the first order Taylor polynomial of f (x) is precisely the linear approximation we wrote down in the beginning.

Now that we defined Taylor polynomials as higher order extensions of the linear approximation, we have to justify our claim that Taylor polynomials are indeed approximations. So what does it mean for a Taylor polynomial Tn(f )(x) to be a good approximation of f (x)? It means that Tn(f )(x) should be close to the true value of f (x). In other words, we want f (x) - Tn(f )(x) to be close to 0. But we defined this difference to be something...

Theorem 1.1. Let Rn(f )(x) be the n-th order remainder of f (x). Then, Rn(f )(x) is o((x - c)n).

Page 1 of 6

Seunghee Ye

Ma 8: Week 7

Nov 10

Theorem 1.1 is saying precisely that Tn(f )(x) is very close to the real value of f (x) when x is near c. Hence, we have our justification for calling Taylor polynomials "higher order approximations" of f (x). Now, we look at another very useful theorem, which will actually let us compute Rn(f )(x).

Theorem 1.2. Suppose f (x) is (n + 1)-times continuously differentiable. Then,

Rn(f )(x) =

x

f (n+1)(y) (x

-

y)ndy

c

n!

With Theorem 1.2, we will be able to know exactly by how much Tn(f )(x) is off the true value of f (x).

1.2 Examples

Example 1.1. Compute the Taylor series for f (x) = ex about 0.

Solution. Recall that the Taylor series of f (x) is simply

f (k)(0) xk k!

k=0

However, for all k, f (k)(x) = ex. Hence, for all k, f (k)(0) = e0 = 1. Therefore,

ex = f (k)(0) xk = xk

k!

k!

k=0

k=0

as we already know.

Here are the Taylor series about 0 for some of the functions that we have come across several times. Try to do a couple of them as an exercise!

?

x3 x5 sin x = x - + - ? ? ? =

(-1)k

x2k+1

3! 5!

(2k + 1)!

k=0

?

x2 x4 cos x = 1 - + - ? ? ? =

(-1)k

x2k

2! 4!

(2k)!

k=0

?

1

= xk

1-x

k=0

Let's look closely at the Taylor series for sin x and cos x. It looks like we've split up the Taylor series of

ex

= 1+x+

x2 2!

+???

into

two

and

alternated

signs.

So

can

we

find

any

relation

between

these

three

Taylor

series?

The answer is yes and in fact, we will see something amazing come out of the inspection. Let i be the

imaginary number. If you have never seen i before, it's just some "number" (not real) with the property

that i2 = -1. As baffling as it might be to raise a number to a complex power, let's take a leap of faith and

Page 2 of 6

Seunghee Ye

Ma 8: Week 7

Nov 10

raise e to ix power and see what we get. Plugging in ix in the Taylor series for ex we get:

eix

=

(ix)2 (ix)3 (ix)4 (ix)5

1 + (ix) +

+

+

+

+???

(1)

2!

3!

4!

5!

x2 ix3 x4 ix5

= 2 + ix - - + + - ? ? ?

(2)

2! 3! 4! 5!

x2 x4 x6

ix3 ix5 ix7

= 1 - + - + ? ? ? + ix - + - + ? ? ?

(3)

2 4! 6!

3! 5! 7!

x2 x4 x6

x3 x5 x7

= 1- + - +??? +i x- + - +???

(4)

2 4! 6!

3! 5! 7!

=

(-1)k

x2k

+i

(-1)k

x2k+1

(5)

(2k)!

(2k + 1)!

k=0

k=0

= cos x + i sin x

(6)

So there we have it!

eix = cos x + i sin x

If you are still not convinced that this formula is the most beautiful thing you've seen in math, try plugging in x = . If we let x = , what do we get?

ei = cos + i sin = -1 ei + 1 = 0

This equation is called the Euler's formula and dubbed "the most beautiful equation in mathematics". 0, 1, , e, and i are arguably the five most important numbers in all of math and to see them appear in one equation is indeed quite amazing!

1.3 Approximating Integrals

Now, we will see how Taylor polynomials can help us approximate integrals. For example, consider the Gaussian integral e-x2 dx called the Gaussian for short. The Gaussian is a very important integral, one of

the properties being that it is the curve that represents the normal distribution a.k.a. the bell curve.

We would like to evaluate the Gaussian but there is one problem: there is no elementary antiderivative of e-x2 . This means that we cannot rely on the Fundamental Theorem of Calculus to evaluate the integral.

But using Taylor series, we can approximate the value of this integral.

1

Example 1.2. Approximate 3 e-x2 dx to within 10-6 of its actual value.

0

Solution. To simplify notation, we will write Tn(x) and Rn(x) for Tn(e-x2 )(x) and Rn(e-x2 )(x), respectively. For any n, we have e-x2 = Tn(x) + Rn(x). By integrating both sides, we obtain

1

1

1

3 e-x2 dx =

3

Tn(x)dx +

3

Rn(x)dx

0

0

0

1

3

Now, Tn(x) is just a polynomial. Therefore, Tn(x)dx is an integral that we can explicitly compute. On

0

the other hand, we know that Rn(x) goes to 0 as n increases. So the idea is to make | Rn(x)dx| small by

increasing n: In our case, we want to find n such that |

1/3 0

Rn(x)dx|

<

10-6.

By Theorem 1.2, we have

Rn(e-x)(x) =

x(-1)n+1 e-y (x - y)ndy

0

n!

Page 3 of 6

Seunghee Ye

Ma 8: Week 7

Nov 10

However, note that

Rn(x) = e-x2 - Tn(x) = e-x2 -

n (-x2)k k!

k=0

= Rn(e-x)(x2)

Hence, we see that

Rn(x) =

x2

(-1)n+1

e-y

(x2

-

y)ndy

0

n!

Unfortunately, this is not something we can easily integrate. However, we are not interested in the actual

value of the integral. We are only interested in making this integral close to 0.

How do we bound Rn(x)? First, note that for any y [0, x2], e-y e0 = 1; and (x2 - y)n (x2 - 0)n =

x2n.

Note

also

that

for

all

y

[0, x2],

we

have

2-y n!

(x2

-

y)n

0.

This

gives

us

|Rn(x)| =

x2

(-1)n+1

e-y

(x2

-

y)ndy

0

n!

=

x2 e-y (x2 - y)ndy

0 n!

x2 1 x2ndy

0 n!

x2n x2

=

y

n! 0

x2n+2 =

n!

(7) (8) (9) (10) (11)

In our case, we want

1 3

Rn(x)dx

0

1 3

x2n+2

dx =

0 n!

1

x2n+3

3

< 10-6

(2n + 3)n! 0

Therefore, we need to find a value of n for which

1

1

2n+3

< 10-6

(2n + 3)n! 3

Checking small values of n = 1, 2... we see that when n = 3, the inequality is satisfied.

1

1

This means that

3

T3(x)dx is within 10-6 of the true value of

3 e-x2 dx. First, let's compute T3(x)

which

is

easy

since

0

we already

know

that

Taylor

series

of

ex:

0

T3(x)

=

1

- x2

+

x4 2

-

x6 3!

We

can

now

integrate

T3(x)

over

[0,

1 3

]

to

approximate

the

Gaussian:

1 3

T3(x)dx =

0

1 3

1 - x2

+

x4

-

x6 dx

0

26

(12)

1

x3 x5 x7 3

= x- + -

(13)

3 10 42 0

147604

=

(14)

459270

Page 4 of 6

Seunghee Ye Therefore, we conclude that

Ma 8: Week 7

1

3 e-x2 dx = 147604 ? 10-6

0

459270

Nov 10

This example shows that Taylor polynomials can be used effectively to approximate integrals. However,

we should note that approximating with Taylor polynomials works well near the point about which we are

2

writing the Taylor polynomial. For example, if we were to approximate e-x2 dx to within 10-1 of its true

0 2

value using Taylor polynomials, we would need to compute T11(x)dx.

0

In our example, the third order Taylor polynomial was good enough to approximate the integral to

within

10-6.

However,

as

we

get

farther

away

from

0

(for

us

from

1 3

to

2),

we

need

the

eleventh

order

Taylor

polynomial just to get a value that is within 10-1 of the true value.

2 Numerical Integration

In Section 1, we saw how we can use Taylor polynomials to approximate integrals. Now, we see a few other numerical methods we can use to approximate integrals.

Recall that the integral was defined as the greatest lower bound of all the upper Riemann sums. Equivalently, we saw that it was the limit of the upper Riemann sums associated to the uniform partitions as n . Numerical integration tries to approximate the integral by a sum that resembles the Riemann sums.

Midpoint rule Let f be a function on [a, b] and consider the uniform partition Pn of [a, b]. Then, define

mj

=

a

+

(j

-

1 2

)(b

n

-

a)

In other words, we define mj to be the midpoint of the subinterval (tj-1, tj). Now, define

n b-a

J2 =

n f (mj)

j=1

Note that J2 looks like the Riemann sum except we have replaced sup f (x) with f (mj). It turns out that

J2 provides a decent approximation of

b a

f

(x)dx.

In

fact,

we

have

b

1

J2 - f (x)dx = O

a

n2

Instead of proving this theorem, let's look at a more advanced numerical integration method:

Simpson's rule

Again, we start with a funciton f (x) defined on [a, b] and let Pn be a uniform partition of [a, b]. Hence, we

have

j(b - a) xj = a + n

Again, let mj be the midpoint of [xj-1, xj] i.e.

mj

=

xj-1, xj 2

Page 5 of 6

Seunghee Ye

Ma 8: Week 7

Nov 10

Now, we consider

J3 =

n

f (xj-1) + 4f (mj) + f (xj) ? 6

b-a n

j=1

Note that this time, we chose a weighted average of f (xj-1, f (mj) and f (xj) instead of choosing a particular point. Why is this a good idea? Let's look at the following lemma.

Lemma

2.1.

Let

I

= [a, b]

be

any

interval

and

let

q(x)

be

a

quadratic

polynomial

on

I.

Let

m=

b-a 2

be

the

midpoint of I. Then,

b

b-a

q(x)dx =

(q(a) + 4q(m) + q(b))

a

6

Before we prove the lemma, note that this lemma says that if f is a quadratic polynomial, then J3 is in fact equal to f (x)dx.

Proof. Suppose q(x) is quadratic. By considering p(x) = q(x - m), we can assume without loss of generality that the interval [a, b] is of the form [-a, a]. Suppse p(x) = c0 + c1x + c2x2. Then, we get

a

c0 + c1x + c2x2dx =

-a

c0x

+

c1x2 2

+

c2x3 3

a -a

=

2c0a

+

2c2a3 3

(15) (16)

Computing the right hand side, we see that the equality is indeed satisfied.

Now, suppose f (x) is C2. Then, we can consider the second order Taylor polynomial of f (x):

f T2(f )(x) = f (mj) + f (mj)(x - mj) +

(mj 2

)

(x

-

mj

)2

By Theorem 1.1, we know that R2(f )(x) is o((x - mj)2). In fact, R2(f )(x) is O((x - mj)3). Since T2(f )(x) is a quadratic polynomial, by Lemma 2.1, we know that

xj xj-1

T2(f )(x)dx

=

T2(xj-1)

+

4T2(f )(mj) 6

+

T2(f )(xj) (xj

-

xj-1)

xj

In particular, if we consider the difference between

f (x)dx and the j-th term in J3, the difference is

xj-1

b-a n

O

1 n3

. Hence, the difference between

f (x)dx and J3 is O

1 n3

.

Page 6 of 6

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download