312 CHAPTER 12. INNER PRODUCT SPACES, LEAST SQUARES
and now simplify to get13
π2 +
3
∑k=1
(−1)k(
4k2
)coskx
Then a graph of this along with the graph of y = x2 is given below. In this graph, the dashedgraph is of y = x2 and the solid line is the graph of the above Fourier series approximation.
If we had taken the partial sum up to n much bigger, it would havebeen very hard to distinguish between the graph of the partial sumof the Fourier series and the graph of the function it is approximating.This is in contrast to approximation by Taylor series in which you onlyget approximation at a point of a function and its derivatives. These arevery close near the point of interest but typically fail to approximate
the function on the entire interval.
12.2 Formula for Distance to a SubspaceLet V be a finite dimensional subspace of a real inner product space H, for the sake ofconvenience, and suppose a basis for V is {v1, ...,vn} . Thus this is a closed subspace. Theneach point of H has a closest point in V thanks to Proposition 12.1.8. I want a convenientformula for the distance to V .
Definition 12.2.1 If Gi j ≡ (vi,v j) where {v1, ...,vn} are vectors, then G is called the Gram-mian matrix, also the metric tensor. This matrix will also be denoted as G(v1, ...,vn) toindicate the vectors used in defining G. Thus, it is an n×n matrix.
Proposition 12.2.2 {v1, ...,vn} is linearly independent, if and only if G(v1, ...,vn) is invert-ible.
Proof: If G is invertible, then if ∑ni=1 xivi = 0,∑i (v j,vi)xi = 0 and so Gx= 0 which
can only hapen if x= 0 because G is invertible.If G is not invertible, then for some x ̸= 0, ∑ j Gi jx j = ∑ j (vi,v j)x j = 0 for each i.
However, this requires that(∑ j v jx j,vi
)= 0 for each vi and so ∑ j v jx j = 0 where x ̸= 0
so {v1, ...,vn} is not linearly independent.Thus, G is invertible if and only if {v1, ...,vn} isindependent. ■
Let V ≡ span(v1, ...,vn) where these spanning vectors constitute a linearly independentset. Suppose u ∈ H. I want to find a convenient formula for the distance between u and V .From Theorem 12.1.7, Pu≡ z, the projection of u onto V which is the closest point of V tou, is defined by (u− z,vi) = 0 for all vi or equivalently (u− z,v) = 0 for all v ∈ V . Thus,for d the distance from u to V,
|u|2 = |u− z|2 + |z|2 = d2 + |z|2 , (u,vi) = (z,vi) for each i (12.3)
Let z = ∑ni=1 zivi. Then in the above,
(u,vi) = (z,vi) =
(n
∑j=1
z jv j,vi
)=
n
∑j=1
Gi jz j
Letting z ≡(z1, ...,zn
)T and y ≡ ((u,v1) ,(u,v2) , ...,(u,v3)) ,
G(v1, ...,vn)z = y, zT G(v1, ...,vn) = yT (12.4)