quiz
play

Quiz Let W be a vector space, and let U be a subspace of W . Define - PowerPoint PPT Presentation

Quiz Let W be a vector space, and let U be a subspace of W . Define the orthogonal complement of U in W . Let W = R 3 . Let U = Span { [1 , 2 , 0] } . Give a basis for the orthogonal complement of U in W . Give a matrix A such that the


  1. Quiz ◮ Let W be a vector space, and let U be a subspace of W . Define the orthogonal complement of U in W . ◮ Let W = R 3 . Let U = Span { [1 , 2 , 0] } . Give a basis for the orthogonal complement of U in W . ◮ Give a matrix A such that the basis in the previous question is a basis for Null A . ◮ (Not required; no credit) Give a matrix B such that Null B = U .

  2. Orthogonal complement in R n and null space of a matrix Let A be an R × S matrix. Let W = R S and let U = Row A . S � �� �   A   For any vector v in the orthogonal complement of U with respect to W , inner product of each row with v equals zero, so by dot-product interpretation of matrix-vector mult, A v = 0 showing that orthogonal complement of U in R S is a subspace of Null A Conversely, if A v = 0 then inner product of each row of A with u equals zero, so inner product with v of any linear combination of rows of A is zero, so v is orthogonal to every vector in Row A , so v is in orthogonal complement of U showing Null A is a subspace of orthogonal complement of U in R S

  3. Computing the orthogonal complement Suppose we have a basis u 1 , . . . , u k for U and a basis w 1 , . . . , w n for W . How can we compute a basis for the orthogonal complement of U in W ? One way: use orthogonalize(vlist) with vlist = [ u 1 , . . . , u k , w 1 , . . . , w n ] Write list returned as [ u ∗ 1 , . . . , u ∗ k , w ∗ 1 , . . . , w ∗ n ] These span the same space as input vectors u 1 , . . . , u k , w 1 , . . . , w n , namely W , which has dimension n . Therefore exactly n of the output vectors u ∗ 1 , . . . , u ∗ k , w ∗ 1 , . . . , w ∗ n are nonzero. The vectors u ∗ 1 , . . . , u ∗ k have same span as u 1 , . . . , u k and are all nonzero since u 1 , . . . , u k are linearly independent. Therefore exactly n − k of the remaining vectors w ∗ 1 , . . . , w ∗ n are nonzero. Every one of them is orthogonal to u 1 , . . . , u n ... so they are orthogonal to every vector in U ... so they lie in the orthogonal complement of U . By Direct-Sum Dimension Lemma, orthogonal complement has dimension n − k , so the remaining nonzero vectors are a basis for the orthogonal complement.

  4. Finding basis for null space using orthogonal complement   a 1 .  .  To find basis for null space of an m × n matrix A =  , .  a m find orthogonal complement of Span { a 1 , . . . , a m } in R n : ◮ Let e 1 , . . . , e n be the standard basis vectors R n . ◮ Let [ a ∗ 1 , . . . , a ∗ m , e ∗ 1 , . . . , e ∗ n ] = orthogonalize ([ a 1 , . . . , a m , e 1 , . . . , e n ]) ◮ Find the nonzero vectors among e ∗ 1 , . . . , e ∗ n

  5. Augmenting project along def project_along(b, v): sigma = 0 if v.is_almost_zero() else (b*v)/(v*v) return sigma * v Want to also output the scalar that when multiplied by v gives the projection def project_along(b, v): sigma = 0 if v.is_almost_zero() else (b*v)/(v*v) return sigma * v, sigma

  6. Augmenting project onto def project_onto(b, vlist): return sum([project_along(b, v) for v in vlist], zero_vec(b.D)) Want to also output the dictionary (not Vec) that maps the index of each vector in vlist to the coefficient giving the projection of b onto that vector def aug_project_onto(b, vlist): L = [aug_project_along(b,v) for v in vlist] b_par = sum([v_proj for (v_proj, sigma) in L], zero_vec(b.D)) sigma_dict = {i:L[i][1] for i in range(len(L))} return b_par, sigma_dict

  7. Augmenting project orthogonal Suppose vlist =[ v ∗ 0 , . . . , v ∗ n − 1 ]. Let b || = projection of b onto Span { v ∗ 0 , . . . , v ∗ n − 1 } . Let b ⊥ = projection of b orthogonal to Span { v ∗ 0 , . . . , v ∗ n − 1 } . b || b ⊥ b = + b ⊥ σ 0 v ∗ 0 + · · · + σ n − 1 v ∗ = + n − 1   σ 0     .  .  .  b  v ∗  = b ⊥ v ∗   · · ·    0 n − 1 σ n − 1   1 The procedure project orthogonal(b, vlist) can be augmented to output the vector of coefficients. For technical reasons, we will represent the vector of coefficents as a dictionary, not a Vec .

  8. Augmenting project orthogonal   Must create and populate a dictionary. α 0     . ◮ One entry for each vector in vlist  .  .  b  =  v 0 b ⊥   · · · v n    ◮ One additional entry, 1, for b ⊥ α n   1 Initialize dictionary with the additional entry. def aug_project_onto(b, vlist): L = ... b_par = ... def aug_project_orthogonal(b, vlist): sigma_dict = {i:L[i][1] for i b_par, sigma_dict = aug_project_onto(b, in range(len(L))} sigma_dict[len(vlist)] = 1 return b_par, sigma_dict return b - b_par, sigma_dict def project_orthogonal(b, vlist): return b - project_onto(b, vlist)

  9. Augmenting orthogonalize(vlist) We will write a procedure aug orthogonalize(vlist) with the following spec: ◮ input: a list [ v 1 , . . . , v n ] of vectors ◮ output: the pair ([ v ∗ 1 , . . . , v ∗ n ] , [ r 1 , . . . , r n ]) of lists of vectors such that v ∗ 1 , . . . , v ∗ n are mutually orthogonal vectors whose span equals Span { v 1 , . . . , v n } , and        v 1  v ∗  r 1  = v ∗ v n r n · · · · · · · · ·   n 1 def aug_orthogonalize(vlist): vstarlist = [] sigma_vecs = [] def orthogonalize(vlist): D = set(range(len(vlist))) vstarlist = [] for v in vlist: for v in vlist: vstar, sigma_dict = vstarlist.append( aug_project_orthogonal(v, vstarlist) project_orthogonal(v, vstarlist)) vstarlist.append(vstar) return vstarlist sigma_vecs.append(Vec(D, sigma_dict)) return vstarlist, sigma_vecs

  10. Towards QR factorization We will now develop the QR factorization . We will show that certain matrices can be written as the product of matrices in special form. Matrix factorizations are useful mathematically and computationally: ◮ Mathematical: They provide insight into the nature of matrices—each factorization gives us a new way to think about a matrix. ◮ Computational: They give us ways to compute solutions to fundamental computational problems involving matrices.

  11. Matrices with mutually orthogonal columns         v ∗ T   � v ∗ 1 � 2 1   .   ...  .  v ∗ v ∗   · · · = .     n   1   � v ∗ v ∗ T   n � 2   n   Cross-terms are zero because of mutual orthogonality. To make the product into the identity matrix, can normalize the columns. Normalizing a vector means scaling it >>> def normalize(v): return v/sqrt(v*v) to make its norm 1. >>> q = normalize(list2vec[1,1,1]) >>> q * q Just divide it by its norm. 1.0000000000000002

  12. Matrices with mutually orthogonal columns         v ∗ T   � v ∗ 1 � 2 1   .   ...  .  v ∗ v ∗   · · · = .     n   1   � v ∗ v ∗ T   n � 2   n   Cross-terms are zero because of mutual orthogonality. To make the product into the identity matrix, can normalize the columns.                     v ∗ v ∗ Normalize columns · · · ⇒ q 1 · · · q n     1 n                

  13. Matrices with mutually orthogonal columns         q T   1 1   .   ...  .    q 1 q n · · · = .         q T   1   n                       v ∗ v ∗ Normalize columns · · · ⇒ q 1 · · · q n     1 n                

  14. Matrices with mutually orthogonal columns         q T   1 1   .   ...  .    q 1 q n · · · = .         q T   1   n   Proposition: If columns of Q are mutually orthogonal with norm 1 then Q T Q is identity matrix. Definition: Vectors that are mutually orthogonal and have norm 1 are orthonormal . Definition: If columns of Q are orthonormal then we call Q a column-orthogonal matrix. Should be called orthonormal but oh well Definition: If Q is square and column-orthogonal, we call Q an orthogonal matrix. Proposition: If Q is an orthogonal matrix then its inverse is Q T .

  15. Projection onto columns of a column-orthogonal matrix Suppose q 1 , . . . , q n are orthonormal vectors. � q j , b � Projection of b onto q j is b || q j = σ j q j where σ j = � q j , b � � q j , q j � = Vector [ σ 1 , . . . , σ n ] can be written using dot-product definition of matrix-vector multiplication:         q T q 1 · b σ 1 1   . . .    .   .   .   =  = b   . . .       q T   q n · b σ n n         σ 1   .    .  and linear combination σ 1 q 1 + · · · + σ n q n = q 1 · · · q n   .       σ n    

Recommend


More recommend