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