11.07.2015 Views

The Gram-Schmidt Procedure and Orthogonal Projections 1 ...

The Gram-Schmidt Procedure and Orthogonal Projections 1 ...

The Gram-Schmidt Procedure and Orthogonal Projections 1 ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Show that proj v (u) is the orthogonal projection of the vector u on the linear subspace spannedby the vector v. (Hint: show that the “error” u − proj v (u) is orthogonal to v, <strong>and</strong> hence isorthogonal to every vector in the linear subspace spanned by v.)In Matlab or Octave, the inner product between vectors u <strong>and</strong> v can be computed usingdot(u, v). Write a function (saving it in the file ‘PROJ.m’)function w = PROJ(u,v)that implements the projection operator proj v . (Caution: in Matlab, dot works correctlyfor real-valued <strong>and</strong> for complex-valued vectors, but in Octave, dot is incorrectly implementedfor complex-valued vectors. Throughout this lab, we will only use real-valuedvectors in R n .)Test that your function PROJ works correctly by computing the following projections:PROJ([1 2 3],[1 1 1]) =PROJ([1 2 3],[0 0 0]) =PROJ([1 2 3],[1 1 -1]) =<strong>The</strong> <strong>Gram</strong>-<strong>Schmidt</strong> procedure takes in a finite set of vectors {v 1 , . . . , v n } (not all ⃗0) in aninner-product space V <strong>and</strong> produces an orthonormal set {w 1 , . . . , w m }, m ≤ n, such thatL({w 1 , . . . , w m }) = L({v 1 , . . . , v n }), where L(·) denotes the linear span, i.e., the subspaceobtained from all possible linear combinations of the elements of the corresponding set.In a “naive” implementation, the <strong>Gram</strong>-<strong>Schmidt</strong> procedure would compute as follows(keeping only the nonzero w i ’s that are produced):u 1 = v 1 w 1 = u 1 /‖u 1 ‖ (or ⃗0 if u 1 = ⃗0)u 2 = v 2 − proj w1(v 2 ) w 2 = u 2 /‖u 2 ‖ (or ⃗0 if u 2 = ⃗0)u 3 = v 3 − proj w1(v 3 ) − proj w2(v 3 ) w 3 = u 3 /‖u 3 ‖ (or ⃗0 if u 3 = ⃗0).u i = v i − ∑ i−1k=1 proj w k(v i ) w i = u i /‖u i ‖.(or ⃗0 if u i = ⃗0)2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!