29
MATH 4540: Analysis Two The Weierstrass Approximation Theorem James K. Peterson Department of Biological Sciences and Department of Mathematical Sciences Clemson University February 26, 2018

The Weierstrass Approximation Theorem

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

The Weierstrass Approximation Theorem

James K. Peterson

Department of Biological Sciences and Department of Mathematical SciencesClemson University

February 26, 2018

Page 2: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

Outline

1 The Wierstrass Approximation Theorem

2 MatLab Implementation

3 Compositions of Riemann Integrable Functions

Page 3: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

The Wierstrass Approximation Theorem

The next result is indispensable in modern analysis. Fundamentally, itstates that a continuous real-valued function defined on a compact setcan be uniformly approximated by a smooth function. This is usedthroughout analysis to prove results about various functions.

We can often verify a property of a continuous function, f , by proving ananalogous property of a smooth function that is uniformly close to f .

We will only prove the result for a closed finite interval in <. The general

result for a compact subset of a more general set called a Topological

Space is a modification of this proof which is actually not that more

difficult, but that is another story.

Page 4: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

The Wierstrass Approximation Theorem

Theorem

Let f be a continuous real-valued function defined on [0, 1]. Forany ε > 0, there is a polynomial, p, such that |f (t)− p(t)| < εfor all t ∈ [0, 1], that is || p − f ||∞< ε

Proof

We first derive some equalities. We will denote the interval [0, 1]by I . By the binomial theorem, for any x ∈ I , we have

n∑k=0

(n

k

)xk(1− x)n−k = (x + 1− x)n = 1. (α)

Page 5: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

The Wierstrass Approximation Theorem

Proof

Differentiating both sides of Equation α, we get

0 =n∑

k=0

(n

k

)(kxk−1(1− x)n−k − xk(n − k)(1− x)n−k−1

)

=n∑

k=0

(n

k

)xk−1(1− x)n−k−1

(k(1− x) − x(n − k)

)

=n∑

k=0

(n

k

)xk−1(1− x)n−k−1

(k − nx

)

Now, multiply through by x(1− x), to find

0 =n∑

k=0

(n

k

)xk(1− x)n−k(k − nx).

Differentiating again, we obtain

Page 6: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

The Wierstrass Approximation Theorem

Proof

0 =n∑

k=0

(n

k

)d

dx

(xk(1− x)n−k(k − nx)

).

This leads to a series of simplifications. It is pretty messy and many textsdo not show the details, but we think it is instructive.

0 =n∑

k=0

(n

k

)[−nxk(1− x)n−k

+(k − nx)(

(k − n)xk(1− x)n−k−1 + kxk−1(1− x)n−k)]

=n∑

k=0

(n

k

)[−nxk(1− x)n−k

+(k − nx)(1− x)n−k−1xk−1(

(k − n)x + k(1− x))]

Page 7: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

The Wierstrass Approximation Theorem

Proofor

0 =n∑

k=0

(n

k

)(− nxk(1− x)n−k + (k − nx)2(1− x)n−k−1xk−1

)= −n

n∑k=0

(n

k

)xk(1− x)n−k +

n∑k=0

(n

k

)(k − nx)2xk−1(1− x)n−k−1

Thus, since the first sum is 1, we have

n =n∑

k=0

(n

k

)(k − nx)2xk−1(1− x)n−k−1

and multiplying through by x(1− x), we have

nx(1− x) =n∑

k=0

(n

k

)(k − nx)2xk(1− x)n−k

Page 8: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

The Wierstrass Approximation Theorem

Proofor

x(1− x)

n=

n∑k=0

(n

k

)(k − nx

n

)2xk(1− x)n−k

This last equality then leads to the

n∑k=0

(n

k

)(x − k

n

)2xk(1− x)n−k =

x(1− x)

n(β)

We now define the nth order Bernstein Polynomial associated with f by

Bn(x) =n∑

k=0

(n

k

)xk(1− x)n−k f

(kn

).

Note f (x)− Bn(x) =∑n

k=0

(nk

)xk(1− x)n−k

[f (x)− f

(kn

)].

Page 9: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

The Wierstrass Approximation Theorem

Proof

Also note that f (0)− Bn(0) = f (1)− Bn(1) = 0, so f and Bn match atthe endpoints. It follows that

| f (x)− Bn(x) | ≤n∑

k=0

(n

k

)xk(1− x)n−k

∣∣∣f (x)− f(kn

)∣∣∣. (γ)

Now, f is uniformly continuous on I since it is continuous. So, givenε > 0, there is a δ > 0 such that |x − k

n | < δ ⇒ |f (x)− f ( kn )| < ε

2 .Consider x to be fixed in [0, 1]. The sum in Equation γ has only n + 1terms, so we can split this sum up as follows. Let {K1,K2} be a partitionof the index set {0, 1, ..., n} such that k ∈ K1 ⇒ |x − k

n | < δ and

k ∈ K2 ⇒ |x − kn | ≥ δ.

Page 10: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

The Wierstrass Approximation Theorem

Proof

Then

| f (x)− Bn(x) | ≤∑k∈K1

(n

k

)xk(1− x)n−k

∣∣∣f (x)− f(kn

)∣∣∣+∑k∈K2

(n

k

)xk(1− x)n−k

∣∣∣f (x)− f(kn

)∣∣∣.which implies

|f (x)− Bn(x)| ≤ ε

2

∑k∈K1

(n

k

)xk(1− x)n−k

+∑k∈K2

(n

k

)xk(1− x)n−k

∣∣∣f (x)− f(kn

)∣∣∣=

ε

2+∑k∈K2

(n

k

)xk(1− x)n−k

∣∣∣f (x)− f(kn

)∣∣∣.

Page 11: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

The Wierstrass Approximation Theorem

Proof

Now, f is bounded on I , so there is a real number M > 0 such that|f (x)| ≤ M for all x ∈ I . Hence∑

k∈K2

(n

k

)xk(1− x)n−k

∣∣∣f (x)− f(kn

)∣∣∣ ≤ 2M∑k∈K2

(n

k

)xk(1− x)n−k .

Since k ∈ K2 ⇒ |x − kn | ≥ δ, using Equation β, we have

δ2∑k∈K2

(n

k

)xk(1−x)n−k ≤

∑k∈K2

(n

k

)(x − k

n

)2xk(1−x)n−k ≤ x(1− x)

n.

This implies that ∑k∈K2

(n

k

)xk(1− x)n−k ≤ x(1− x)

δ2n.

Page 12: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

The Wierstrass Approximation Theorem

Proof

and so combining inequalities

2M∑k∈K2

(n

k

)xk(1− x)n−k ≤ 2Mx(1− x)

δ2n

We conclude then that∑k∈K2

(n

k

)xk(1− x)n−k

∣∣∣f (x)− f(kn

)∣∣∣ ≤ 2Mx(1− x)

δ2n.

Now, the maximum value of x(1− x) on I is 14 , so

∑k∈K2

(n

k

)xk(1− x)n−k

∣∣∣f (x)− f(kn

)∣∣∣ ≤ M

2δ2n.

Page 13: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

The Wierstrass Approximation Theorem

Proof

Finally, choose n so that n > Mδ2ε . Then M

nδ2 < ε implies M2nδ2 <

ε2 . So,

Equation γ becomes

| f (x)− Bn(x) |≤ ε

2+ε

2= ε.

Note that the polynomial Bn does not depend on x ∈ I , since n onlydepends on M, δ, and ε, all of which, in turn, are independent of x ∈ I .So, Bn is the desired polynomial, as it is uniformly within ε of f .

Comment

A change of variable translates this result to any closed interval [a, b].

Page 14: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

MatLab Implementation

Let’s write some code to implement Bernstein polynomials In Octave/MatLab. We use the function Bernstein (f,a,b,n) like this:

X = l i n s p a c e (0 ,10 ,401) ;f = @( x ) e .ˆ( − . 3∗ x ) . ∗ cos (2∗ x + 0 . 3 ) ;B3 = Be r n s t e i n ( f , 0 , 1 0 , 3 ) ;p l o t (X, f (X) ,X, B3(X) ) ;

5 B10 = Be r n s t e i n ( f , 0 , 1 0 , 10 ) ;p l o t (X, f (X) ,X, B3(X) ,X, B10 (X) ) ;B25 = Be r n s t e i n ( f , 0 , 1 0 , 25 ) ;p l o t (X, f (X) ,X, B3(X) ,X, B10 (X) ,X, B25 (X) ) ;B45 = Be r n s t e i n ( f , 0 , 1 0 , 45 ) ;

10 p l o t (X, f (X) ,X, B3(X) ,X, B10 (X) ,X, B25 (X) ,X, B45 (X) ) ;B150 = Be r n s t e i n ( f , 0 , 10 , 150 ) ;p l o t (X, f (X) ,X, B3(X) ,X, B10 (X) ,X, B25 (X) ,X, B45 (X) ,X

, B150 (X) ) ;l egend ( ’f ’ , ’B3 ’ , ’B10 ’ , ’B25 ’ , ’B45 ’ , ’B140 ’ ) ;x l a b e l ( ’x ’ ) ; y l a b e l ( ’y ’ ) ;

15 t i t l e ( ’f(x) = e^{ -3 x} cos (2 x + 0.3) on [0 ,10] and

Bernstein Polynomials ’ ) ;

Page 15: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

MatLab Implementation

f u n c t i o n p = Be r n s t e i n ( f , a , b , n )% compute Be r n s t e i n po l y nom i a l app rox ima t i on% of o r d e r n on the i n t e r v a l [ a , b ] to f% f i s the f u n c t i o n

5 % n i s the o r d e r o f the Be r n s t e i n po l y nom i a lp = @( x ) 0 ;f o r i = 1 : n+1

k = i −1;% conve r t the i n t e r v a l [ a , b ] to [ 0 , 1 ] he re

10 y = @( x ) ( x−a ) /(b−a ) ;% conve r t the p o i n t s we e v a l u a t e f at to be

i n [ a , b ]% i n s t e a d o f [ 0 , 1 ]z = a + k ∗ ( b−a ) /n ;q = @( x ) nchoosek (n , k ) ∗ ( y ( x ) . ˆ k ) .∗((1 − y ( x ) )

. ˆ ( n−k ) ) ∗ f ( z ) ;15 p = @( x ) ( p ( x ) + q ( x ) ) ;

endend

Page 16: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

MatLab Implementation

We deliberately tried to approximate an oscillating function with theBernstein polynomials and we expected this to be difficult because wechose the interval [0, 10] to work on.

The Bernstein polynomials require us to calculate the binomial

coefficients. When n is large. such as in our example with n = 150,

running this code generates errors about the possible loss of precision in

the use of nchoosek which is the binomial coefficient function. You can

see how we did with the approximations in the next figure.

Page 17: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

MatLab Implementation

Page 18: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

MatLab Implementation

Example

If∫ ba f (s)snds = 0 for all n with f continuous, then f = 0 on [a, b].

Solution

Let Bn(f ) be the Bernstein polynomial of order n associated with

f . From the assumption, we see∫ ba f (s)Bn(f )(s)ds = 0 for all n

also. Now consider∣∣∣∣∫ b

af 2(s)ds −

∫ b

af (s)Bn(f )(s)ds

∣∣∣∣ =

∣∣∣∣∫ b

af (s)(f (s)− Bn(f )(s))ds

∣∣∣∣≤

∫ b

a||f − Bn(f )||∞ |f (s)|ds

Then given ε > 0, there is a N so that n > N implies||f − Bn(f )||∞ < ε/((||f ||∞ + 1)(b − a)).Then we have n > N implies

Page 19: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

MatLab Implementation

Solution

∣∣∣∣∫ b

a

f 2(s)ds −∫ b

a

f (s)Bn(f )(s)ds

∣∣∣∣ < ε

(||f ||∞ + 1)(b − a)

∫ b

a

|f (s)|ds

(||f ||∞ + 1)(b − a)||f ||∞ (b − a) < ε

This tells us∫ b

af (s)Bn(f )(s)ds →

∫ b

af 2(s)ds. Since∫ b

af (s)Bn(f )(s)ds = 0 for all n, we see

∫ b

af 2(s)ds = 0. It then follows

that f = 0 on [a, b] using this argument.

Assume f 2 is not zero at some point c in [a, b]. We can assume c is aninterior point as the argument at an endpoint is similar. Since f 2(c) > 0and f is continuous, there is r with (r − c , r + c) ⊂ [a, b] andf 2(x) > f 2(c)/2 on that interval. Hence

Page 20: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

MatLab Implementation

Solution

0 =

∫ b

a

f 2(s)ds =

∫ c−r

a

f 2ds +

∫ c+r

c−rf 2(s)ds +

∫ b

c+r

f 2(s)ds

> (2r)f 2(c)/2 > 0

This is a contradiction and so f 2 = 0 on [a, b] implying f = 0 on [a, b].

Page 21: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

Compositions of Riemann Integrable Functions

We already know that continuous functions and monotone functions are

classes of functions which are Riemann Integrable on the interval [a, b].

Hence, since f (x) =√x is continuous on [0,M] for any positive M, we

know f is Riemann integrable on this interval. What about the

composition√g where g is just known to be non negative and Riemann

integrable on [a, b]? If g were continuous, since compositions of

continuous functions are also continuous, we would have immediately

that√g is Riemann Integrable. However, it is not so easy to handle the

case where we only know g is Riemann integrable.

Page 22: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

Compositions of Riemann Integrable Functions

Let’s try this approach. Using the Weierstrass Approximation Theorem,we know given a finite interval [c , d ], there is a sequence of polynomials{pn(x)} which converge in || · ||∞ to

√x on [c , d ]. Of course, the

polynomials in this sequence will change if we change the interval [c , d ],but you get the idea.

To apply this here, note that since g is Riemann Integrable on [a, b], gmust be bounded. Since we assume g is non negative, we know thatthere is a positive number M so that g(x) is in [0,M] for all x in [a, b].Thus, there is a sequence of polynomials {pn} which converge in || · ||∞to√· on [0,M].

Next, we know a polynomial in g is also Riemann integrable on [a, b](f 2 = f · f so it is integrable and so on). Hence, pn(g) is Riemannintegrable on [a, b]. Then given ε > 0, we know there is a positive N sothat

| pn(u)−√u | < ε, if n > N and u ∈ [0,M].

Page 23: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

Compositions of Riemann Integrable Functions

Thus, in particular, since g(x) ∈ [0,M], we have

| pn(g(x))−√g(x) | < ε, if n > N and x ∈ [a, b].

We have therefore proved that pn ◦ g converges || · ||∞ to√g on [0,M].

What we need next is a new theorem: If fn converges to f in || · ||∞ on[a, b] with all fn Riemann integrable, then the limit function f is also

Riemann integrable and∫ b

afn(s)ds →

∫ b

af (s)ds.

We can indeed prove such a theorem. Hence, we know√g is Riemann

integrable when g is Riemann Integrable. Note the kind of arguments weuse here. The ideas of functions converging in the sup norm and thequestions what properties are retained in the limit are of greatimportance.

Note this kind of proof makes us think that compositions of a continuous

function ( like√· ) with a Riemann integrable function will give us new

Riemann integrable functions as the argument we used above would

translate easily to the new context. We will explore this more later.

Page 24: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

Compositions of Riemann Integrable Functions

In general, the composition of Riemann Integrable functions is notRiemann integrable. Here is the standard counterexample. Define f on[0, 1] by

f (y) =

{1 if y = 00 if 0 < y ≤ 1

and g on [0, 1] by

g(x) =

1 if x = 01/q if x = p/q, (p, q) = 1, x ∈ (0, 1] and x is rational0 if x ∈ (0, 1] and x is irrational

Let’s show g is RI on [0,1]. First define g to be 0 at x = 1. If we show

this modification of g is RI, g will be too. Let q be a prime number

bigger than 2. Then form the uniform partition

πq = {0, 1/q, . . . , (q − 1)/q, 1}. On each subinterval of this partition, we

see mj = 0. Inside the subinterval [(j − 1)/q, j/q], the maximum value of

g is 1/q. Hence, we have Mj = 1/q.

Page 25: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

Compositions of Riemann Integrable Functions

This gives

U(g ,πq)− L(g ,πq) =∑πq

(1/q)∆xi = 1/q

Given ε > 0, there is an N so that 1/N < ε. Thus if q0 is a prime withq0 > N, we have U(g ,πq0)− L(g ,πq0) < ε.

So if π is any refinement of πq0 , we have U(g ,π)− L(g ,π) < ε also,Thus g satisfies the Riemann Criterion and so g is RI on [0, 1]. It is also

easy to see∫ 1

0g(s)ds = 0. Now f ◦ g becomes

f (g(x)) =

f (1) if x = 0f (1/q) if x = p/q, (p, q) = 1, x ∈ (0, 1] and x rationalf (0) if 0 < x < 1 and x irrational

=

1 if x = 00 if if x rational ∈ (0, 1)1 if if x irrational ∈ (0, 1)

The function f ◦ g above is not Riemann integrable as U(f ◦ g) = 1 and

L(f ◦ g) = 0. Thus, we have found two Riemann integrable functions

whose composition is not Riemann integrable!

Page 26: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

Compositions of Riemann Integrable Functions

Homework 18

18.1 For f (x) = sin2(3x), graph the Bernstein polynomials B5(f ), B10(f )and B15(f ) along with f simultaneously on the interval [−2, 4] onthe same graph in MatLab. This is a word doc report so write yourcode, document it and print out the graph as part of your report.

18.2 For f (x) = sin(x) +√x , graph the Bernstein polynomials B5(f ),

B10(f ) and B15(f ) along with f simultaneously on the interval [0, 6]on the same graph in MatLab. This is a word doc report so writeyour code, document it and print out the graph as part of yourreport.

Page 27: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

Compositions of Riemann Integrable Functions

Homework 18

18.3 Fix x 6= 0 in <. Let the sequence (an) be defined by an = cos(3nx).Prove this sequence does not always have a limit but it does have atleast one subsequential limit. Of course, because of periodicity, it isenough to look at points x ∈ [0, 2π]. For example, there is a limit ifx = π/2 and other special points. Let’s look at x = 1 carefully.Prove this sequence does not have a limit but it does have at leastone subsequential limit.

Hint

The Bolzano - Weierstrass Theorem tells us there is a subsequence(cos(3nk ) which converges to a number α in [−1, 1].

There are identities which show us cos(3θ) = 4 cos3(θ)− 4 cos(θ).Hence, we know

cos(3 (3nk )) −→ 4α3 − 4α

Page 28: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

Compositions of Riemann Integrable Functions

Homework 18

18.3 Continued

Hint

If α 6= 0, use the above fact to show the subsequences cos(3nk+1)and cos(3nk ) converge to different values. This implies the limit cannot exist.

If α = 0, the argument is harder. This tells us sin(3nk ) −→ 1. Nowshow sin(3θ) = sin(θ) (4 cos2(θ)− 1) and also show that the sin(3θ)identity implies sin(3n) can not have a limit.

Finally, since sin(θ) = ±√

1− cos2(θ), if we assume the limit ofcos(3n) exists and equals β, then by looking at all the quadrantchoices that the value of β implies, we find the limit of sin(3n) mustexist. This is a contradiction and so the limit of cos(3n) does notexist.

Page 29: The Weierstrass Approximation Theorem

MATH 4540: Analysis Two

Compositions of Riemann Integrable Functions

Homework 18

18.3 Continued

Hint

This sequence is hard to analyze as using the 2π periodicty of cos we canrecast the sequence using remainders.

3nk = Lnk 2π + rnk , rnk ∈ (0, 1)

cos(3nk ) = cos(Lnk 2π + rnk ) = cos(2πrnk )

We have no idea how the remainder terms rnk are distributed in (0, 1)and that is why this analyis is very nontrivial.