412 CHAPTER 17. INNER PRODUCT SPACES
Example 17.3.4 Let V denote the real inner product space consisting of continuous func-tions defined on [0,1] with the inner product
⟨ f ,g⟩ ≡∫ 1
0f (x)g(x)dx.
Let U = span(1,x,x2
). It is desired to find the vector (function) in U which is closest to sin
in the norm determined by this inner product. Thus it is desired to minimize(∫ 1
0|sin(x)− p(x)|2 dx
)1/2
out of all functions p contained in U.
By Example 17.2.3, an orthonormal basis for U is{1, 2√
3x−√
3, 6√
5x2−6√
5x+√
5}
Then by Theorem 17.3.2, the closest vector (function) in U to sin can be computed asfollows. First determine the Fourier coefficients.∫ 1
01sin(x)dx = 1− cos(1)
∫ 1
0
(2√
3x−√
3)
sin(x)dx =√
3(−cos1+2sin1−1)∫ 1
0
(6√
5x2−6√
5x+√
5)
sin(x)dx =√
5(11cos1+6sin1−11)
Next, from Theorem 17.3.2, the closest point to sin is
(1− cos(1))+(√
3(−cos1+2sin1−1))(
2√
3x−√
3)
+(√
5(11cos1+6sin1−11))(
6√
5x2−6√
5x+√
5)
Simplifying and approximating things like sin1, this yields the following for the approxi-mation to sinx.
−0.23546x2 +1.0913x−7.4649×10−3
If this is graphed along with sinx for x ∈ [0,1] the result is as follows. One of the functionsis represented by the solid line and the other by the dashed line.
There are two graphs. The left is the least squares approximation of the given function andthe right is the result of using the Taylor series, both up to degree 2. You see the differ-ence. The approximation using the inner product norm, called mean square approximation,attempts to approximate the given function on the whole interval while the Taylor seriesapproximation is only good for small x.