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

12.1. ORTHOGONAL PROJECTIONS 311and so, from the first part, Py is indeed given by the claimed formula. MfBecause 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 thatyou 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 Y"_, (u,e;) e; where {e1,...,en} is an orthonormal basis for K.Proof: Suppose z is the closest point to wu in K. Then if w € K,|u— (c+tw)/? hasa minimum at t = 0. However, the function of ¢t has a derivative. The function of tequals |u —z|? — 2rRe(u—z,w) +t2|w|? and so its derivative is —2Re(u—z,w) +t|w|*and 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) +ilm(u—z,w) and so (u—z,iw) = Re(u—z,iw) +iIm(u — z, iw) which im-plies that —i(u—z,w) = —iRe(u—z,w) + Im(u—z,w) = Re(u—z,iw) + iIm(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|? = |u—z+z—w)? = |w—z|7+|z—w|? because 2Re(u—z,z—w) = 0 and so it follows that |w—z|* < |u—w)* for allwekK.It remains to verify that )"_, (e;,u) e; is as close as possible. From what was just shown,it suffices to verify that (u— 7, (u,e;) e;,ex) = 0 for all ex. However, this is just (u,e,) —Yi (u,é;) (€;,€x) = (u, ex) _ (u, ex) =0.Example 12.1.9 Consider X equal to the continuous functions defined on |—1, 7] and letthe inner product be given by[ feetiaxIt is left to the reader to verify that this is an inner product. Letting ex, be the function1 ik. _— n .x3 Tae *, define M = span ({ex };__,,) - Then you can verify that(ex,e ef (s e*) (s om) dx = =! ellm—k)x _ §ko my —_ _n J2n J2n a an a —_ kmthen for a given function f € X, the function from M which is closest to f in this innerproduct norm is g = Vi__, (f,ex) ex In this case (f,ex) = Ta IS (x)edx. These arethe Fourier coefficients. The above is the n'" partial sum of the Fourier series.To show how this kind of thing approximates a given function, let f (x) = x?. LetV20is of the form. 3M = span ({ em} ,) . Then, doing the computations, you find the closest pointLiss (1 3 ( (-1)'2 1,