33.4. MEAN SQUARE APPROXIMATION 645

Now taking the square root of both sides yields the desired inequality. ■The reason this is important is that if you have f close to g and h close to g, then you

have f close to h. Indeed,

∥ f −h∥ ≤ ∥ f −g∥+∥g−h∥

and if both of the terms on the right are small, then the term on the left is also.There are 2n+ 1 functions, 1√

2L, 1√

Lcos( kπ

L x), 1√

Lsin(

jπL x)

for k, j ∈ 1,2, · · · ,n. De-

note these functions as {φ k}2n+1k=1 to save on notation. It was shown above that

(φ k,φ j

)=

δ jk which is 1 if k = j and 0 if k ̸= j. Then for f a Riemann integrable function on [−L,L] ,our problem is to choose αk to minimize∣∣∣∣∣ f − 2n+1

∑k=1

αkφ k

∣∣∣∣∣2

= (A+B,A+B)

where A = f −∑2n+1k=1 ( f ,φ k)φ k,B = ∑

2n+1k=1 (( f ,φ k)−αk)φ k. Thus the above is

|A|2 +2(A,B)+ |B|2 (*)

Consider the middle term.(f −

2n+1

∑k=1

( f ,φ k)φ k,φ j

)=

(f ,φ j

)−∑

k( f ,φ k)

(φ k,φ j

)=

(f ,φ j

)−(

f ,φ j

)= 0

and so the middle term of ∗ equals 0 because(f −

2n+1

∑k=1

( f ,φ k)φ k,2n+1

∑k=1

akφ k

)= 0

for any choice of ak which includes the case of (A,B). Thus ∗ implies∣∣∣∣∣ f − 2n+1

∑k=1

αkφ k

∣∣∣∣∣2

=

∣∣∣∣∣ f − 2n+1

∑k=1

( f ,φ k)φ k

∣∣∣∣∣2

+

∣∣∣∣∣2n+1

∑k=1

(( f ,φ k)−αk)φ k

∣∣∣∣∣2

From the definition of the norm, the second term is

∑j,k(( f ,φ k)−αk)

((f ,φ j

)−α j

)(φ k,φ j

)= ∑

k(( f ,φ k)−αk)

2

Hence ∣∣∣∣∣ f − 2n+1

∑k=1

αkφ k

∣∣∣∣∣2

=

∣∣∣∣∣ f − 2n+1

∑k=1

( f ,φ k)φ k

∣∣∣∣∣2

+2n+1

∑k=1

(( f ,φ k)−αk)2 (**)

which shows that the left side is minimized exactly when αk = ( f ,φ k). It is clear then thatcorresponding to 1√

Lcos( kπx

L

), you would have

αk =∫ L

−Lf (x)

1√L

cos(

kπxL

)dx

33.4. MEAN SQUARE APPROXIMATION 645Now taking the square root of both sides yields the desired inequality. HiThe reason this is important is that if you have f close to g and h close to g, then youhave f close to h. Indeed,lf All <|lf—sll+llg—Aland if both of the terms on the right are small, then the term on the left is also.There are 2n + | functions, Tm Jz 00s (42x), Tr sin (7 x) for k,j € 1,2,---,n. De-note these functions as {@ et6 jx which is 1 if k = j and O if k A j. Then for f a Riemann integrable function on [—L,L],our problem is to choose ; to minimizeto save on notation. It was shown above that , wo i) =2f- ¥ o,| =(A+B,A+B)k=1| 2n+1where A = f — yet (f, 0%) 9,,B = at ((f,0,) — Gx) @,. Thus the above is4? +2(4,B) + |B)? (*)Consider the middle term.(1 E'v.00%9) = (f6))-Luk=1 k04)= (401) - (40) =0and so the middle term of « equals 0 because2n+1 2n+1[- y (F,94) OE, y a0) =0k=1 k=1(1)for any choice of a, which includes the case of (A,B). Thus * implies2n+1 2 2n+1 2 font 2) y ad,| = ) YY (F,04) Oe Y ((f.04) — Mk) O%k=l k=l k=lFrom the definition of the norm, the second term isY((F.44) — a8) ((F.6;) — 27) (44:6;) =D 60) -ik kHencentl 2 n+l 2 on4tf- Y aco, |r; » (F,94) Pe) + » ( (f,04) — Oe)” (**)k=1which shows that the left side is minimized exactly when oa; = (f,@;). It is clear then thatcorresponding to Tr cos Ez ), you would havea= [ f(x VE (=) dx