12.1. ORTHOGONAL PROJECTIONS 311
and so, from the first part, Py is indeed given by the claimed formula. ■Because of this theorem, Py is called the orthogonal projection.What if H is not complete but K is a finite dimensional subspace? Is it still the case that
you can obtain a projection?
Proposition 12.1.8 Let H be an inner product space, not necessarily complete and let Kbe a finite dimensional subspace. Then if u ∈ H, a point z ∈ K is the closest point to u ifand only if (u− z,w) = 0 for all w ∈ K. Furthermore, there exists a closest point and it isgiven by ∑
ni=1 (u,ei)ei where {e1, ...,en} is an orthonormal basis for K.
Proof: Suppose z is the closest point to u in K. Then if w ∈ K, |u− (z+ tw)|2 hasa minimum at t = 0. However, the function of t has a derivative. The function of tequals |u− z|2− 2t Re(u− z,w) + t2 |w|2 and so its derivative is −2Re(u− z,w) + t |w|2and when t = 0 this is to be zero so Re(u− z,w) = 0 for all w ∈ K. Now (u− z,w) =Re(u− z,w)+ i Im(u− z,w) and so (u− z, iw) = Re(u− z, iw)+ i Im(u− z, iw) which im-plies that −i(u− z,w) = −iRe(u− z,w) + Im(u− z,w) = Re(u− z, iw) + i Im(u− z, iw)so Im(u− z,w) = Re(u− z, iw) and this shows that Im(u− z,w) = 0 = Re(u− z,w) so(u− z,w) = 0.
Next suppose (u− z,w) = 0 for all w ∈K. Then |u−w|2 = |u− z+ z−w|2 = |u− z|2+|z−w|2 because 2Re(u− z,z−w) = 0 and so it follows that |u− z|2 ≤ |u−w|2 for allw ∈ K.
It remains to verify that ∑ni=1 (ei,u)ei is as close as possible. From what was just shown,
it suffices to verify that (u−∑ni=1 (u,ei)ei,ek) = 0 for all ek. However, this is just (u,ek)−
∑i (u,ei)(ei,ek) = (u,ek)− (u,ek) = 0. ■
Example 12.1.9 Consider X equal to the continuous functions defined on [−π,π] and letthe inner product be given by ∫
π
−π
f (x)g(x)dx
It is left to the reader to verify that this is an inner product. Letting ek be the functionx→ 1√
2πeikx, define M ≡ span
({ek}n
k=−n). Then you can verify that
(ek,em) =∫
π
−π
(1√2π
e−ikx)(
1√2π
emix
)dx =
12π
∫π
−π
ei(m−k)x = δ km
then for a given function f ∈ X , the function from M which is closest to f in this innerproduct norm is g = ∑
nk=−n ( f ,ek)ek In this case ( f ,ek) =
1√2π
∫π
−πf (x)eikxdx. These are
the Fourier coefficients. The above is the nth partial sum of the Fourier series.
To show how this kind of thing approximates a given function, let f (x) = x2. Let
M = span({
1√2π
e−ikx}3
k=−3
). Then, doing the computations, you find the closest point
is of the form
13
√2π
52
(1√2π
)+
3
∑k=1
((−1)k 2
k2
)√
2√
π1√2π
e−ikx
+3
∑k=1
((−1)k 2
k2
)√
2√
π1√2π
eikx