. = V c = V [x]v (5.1) c 1. c k

Similar documents
Linear Algebra Fundamentals

MATH 20F: LINEAR ALGEBRA LECTURE B00 (T. KEMP)

Linear Algebra- Final Exam Review

Chapter 6: Orthogonality

Solutions to Final Practice Problems Written by Victoria Kala Last updated 12/5/2015

Chapter 7: Symmetric Matrices and Quadratic Forms

Designing Information Devices and Systems II

235 Final exam review questions

Linear Algebra Primer

2. Every linear system with the same number of equations as unknowns has a unique solution.

Math 102, Winter Final Exam Review. Chapter 1. Matrices and Gaussian Elimination

MIT Final Exam Solutions, Spring 2017

DIAGONALIZATION. In order to see the implications of this definition, let us consider the following example Example 1. Consider the matrix

SUMMARY OF MATH 1600

33AH, WINTER 2018: STUDY GUIDE FOR FINAL EXAM

Math 520 Exam 2 Topic Outline Sections 1 3 (Xiao/Dumas/Liaw) Spring 2008

Math 4A Notes. Written by Victoria Kala Last updated June 11, 2017

MATH 583A REVIEW SESSION #1

Final Review Written by Victoria Kala SH 6432u Office Hours R 12:30 1:30pm Last Updated 11/30/2015

LINEAR ALGEBRA 1, 2012-I PARTIAL EXAM 3 SOLUTIONS TO PRACTICE PROBLEMS

LINEAR ALGEBRA SUMMARY SHEET.

5.) For each of the given sets of vectors, determine whether or not the set spans R 3. Give reasons for your answers.

Conceptual Questions for Review

Glossary of Linear Algebra Terms. Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

Notes on Eigenvalues, Singular Values and QR

DS-GA 1002 Lecture notes 0 Fall Linear Algebra. These notes provide a review of basic concepts in linear algebra.

Review problems for MA 54, Fall 2004.

IMPORTANT DEFINITIONS AND THEOREMS REFERENCE SHEET

Practice problems for Exam 3 A =

Solutions to Review Problems for Chapter 6 ( ), 7.1

(a) If A is a 3 by 4 matrix, what does this tell us about its nullspace? Solution: dim N(A) 1, since rank(a) 3. Ax =

1 Last time: least-squares problems

LINEAR ALGEBRA REVIEW

No books, no notes, no calculators. You must show work, unless the question is a true/false, yes/no, or fill-in-the-blank question.

A Review of Linear Algebra

Final Review Sheet. B = (1, 1 + 3x, 1 + x 2 ) then 2 + 3x + 6x 2

IMPORTANT DEFINITIONS AND THEOREMS REFERENCE SHEET

7. Symmetric Matrices and Quadratic Forms

PRACTICE PROBLEMS FOR THE FINAL

MATH 240 Spring, Chapter 1: Linear Equations and Matrices

4. Linear transformations as a vector space 17

REVIEW FOR EXAM III SIMILARITY AND DIAGONALIZATION

Dot Products, Transposes, and Orthogonal Projections

[Disclaimer: This is not a complete list of everything you need to know, just some of the topics that gave people difficulty.]

CS 143 Linear Algebra Review

MATH 31 - ADDITIONAL PRACTICE PROBLEMS FOR FINAL

MATH 1120 (LINEAR ALGEBRA 1), FINAL EXAM FALL 2011 SOLUTIONS TO PRACTICE VERSION

Orthogonality. 6.1 Orthogonal Vectors and Subspaces. Chapter 6

Dot Products. K. Behrend. April 3, Abstract A short review of some basic facts on the dot product. Projections. The spectral theorem.

Linear Algebra. Session 12

Summer Session Practice Final Exam

Pseudoinverse & Moore-Penrose Conditions

2018 Fall 2210Q Section 013 Midterm Exam II Solution

MAT2342 : Introduction to Applied Linear Algebra Mike Newman, fall Projections. introduction

Stat 159/259: Linear Algebra Notes

ft-uiowa-math2550 Assignment OptionalFinalExamReviewMultChoiceMEDIUMlengthForm due 12/31/2014 at 10:36pm CST

Ir O D = D = ( ) Section 2.6 Example 1. (Bottom of page 119) dim(v ) = dim(l(v, W )) = dim(v ) dim(f ) = dim(v )

COMP 558 lecture 18 Nov. 15, 2010

WI1403-LR Linear Algebra. Delft University of Technology

22m:033 Notes: 7.1 Diagonalization of Symmetric Matrices

1. What is the determinant of the following matrix? a 1 a 2 4a 3 2a 2 b 1 b 2 4b 3 2b c 1. = 4, then det

NONCOMMUTATIVE POLYNOMIAL EQUATIONS. Edward S. Letzter. Introduction

7. Dimension and Structure.

UNIT 6: The singular value decomposition.

Lecture notes: Applied linear algebra Part 1. Version 2

Math 308 Practice Test for Final Exam Winter 2015

I. Multiple Choice Questions (Answer any eight)

Study Guide for Linear Algebra Exam 2

Definitions for Quizzes

Then x 1,..., x n is a basis as desired. Indeed, it suffices to verify that it spans V, since n = dim(v ). We may write any v V as r

1. General Vector Spaces

Linear Algebra Highlights

The Singular Value Decomposition

PRACTICE FINAL EXAM. why. If they are dependent, exhibit a linear dependence relation among them.

Linear Algebra Review. Fei-Fei Li

The Singular Value Decomposition and Least Squares Problems

Diagonalizing Matrices

BASIC ALGORITHMS IN LINEAR ALGEBRA. Matrices and Applications of Gaussian Elimination. A 2 x. A T m x. A 1 x A T 1. A m x

The Fundamental Theorem of Linear Algebra

Review of some mathematical tools

EE731 Lecture Notes: Matrix Computations for Signal Processing

Linear Systems. Class 27. c 2008 Ron Buckmire. TITLE Projection Matrices and Orthogonal Diagonalization CURRENT READING Poole 5.4

Linear Algebra Review. Vectors

Linear Algebra, Summer 2011, pt. 3

ANSWERS. E k E 2 E 1 A = B

MATH 304 Linear Algebra Lecture 34: Review for Test 2.

MAT 1302B Mathematical Methods II

Linear Algebra Massoud Malek

Solving a system by back-substitution, checking consistency of a system (no rows of the form

Chapter 6 - Orthogonality

TBP MATH33A Review Sheet. November 24, 2018

Linear Algebra Review

Announcements Monday, October 29

MATH 1553 PRACTICE FINAL EXAMINATION

ANSWERS (5 points) Let A be a 2 2 matrix such that A =. Compute A. 2

Warm-up. True or false? Baby proof. 2. The system of normal equations for A x = y has solutions iff A x = y has solutions

Summary of Week 9 B = then A A =

Eigenvalues, Eigenvectors, and Diagonalization

Eigenvalues and Eigenvectors A =

Worksheet for Lecture 25 Section 6.4 Gram-Schmidt Process

Transcription:

Chapter 5 Linear Algebra It can be argued that all of linear algebra can be understood using the four fundamental subspaces associated with a matrix Because they form the foundation on which we later work, we want an explicit method for analyzing these subspaces- That method will be the Singular Value Decomposition (SVD) It is unfortunate that most first courses in linear algebra do not cover this material, so we do it here Again, we cannot stress the importance of this decomposition enough- We will apply this technique throughout the rest of this text 5 Representation, Basis and Dimension Let us quickly review some notation and basic ideas from linear algebra First, a basis is a linearly independent spanning set, and the dimension of a subspace is the number of basis vectors it needs Suppose we have a subspace H IR n, and a basis for H in the columns of matrix V By the definition of a basis, every vector in the subspace H can be written as a linear combination of the basis elements In particular, if x H, then we can write: x = c v + + c k v k = V c = V [x]v (5) where c is sometimes denoted as [x] V, and is referred to as the coordinates of x with respect to the basis in V Therefore, every vector in our subset of IR n can be identified with a point in IR k, which gives us a function that we ll call the coordinate mapping: x x 2 x = IRn x n c c k = c IR k If k is small (with respect to n) we think of c is the low dimensional representation of the vector x, and that H is isomorphic to IR k (Isormorphic meaning one to one and onto linear map is the isormorphism) Example 5 If v i, v j are two linearly independent vectors, then the subspace created by their span is isomorphic to the plane IR 2 - but is not equal to the plane The isomorphism is the coordinate mapping Generally, finding the coordinates of x with respect to an arbitrary basis (as columns of a matrix V ) means that we have to solve Equation 5 However, if the columns of V are orthogonal, then it is very simple to compute the coordinates Start with Equation 5: x = c v + + c k v k 5

Now take the inner product of both sides with v j : x v j = c v v j + + c j v j v j + + c k v k v j All the dot products are (due to orthogonality) except for the dot product with x and v j leading to the formula: c j = x v j v j v j And we see that this is the scalar projection of x onto v j Recall the formula from Calc III: Proj v (u) = u v v v v Therefore, we can think of the linear combination as the following, which simplifies if we use orthonormal basis vectors: x = Proj v (x) + Proj v2 (x) + + Proj vk (x) (52) = (x v )v + (x v 2 )v 2 + + (x v k )v k IMPORTANT NOTE: In the event that x is NOT in H, then Equation 52 gives the (orthogonal) projection of x into H Projections Consider the following example If a matrix U = [u,, u k ] has orthonormal columns (so if U is n k, then that requires k n), then u T u T u u T u 2 u T u k U T U = u T 2 u u T 2 u 2 u T 2 u k [u,, u k ] = = = I k u k u T k u u T k u 2 u T k u k But UU T (which is n n) is NOT the identity if k = n (If k = n, then the previous computation proves that the inverse is the transpose) Here is a computation one might make for UU T (these are OUTER products): u T UU T = [u,, u k ] = u u T + u 2 u T 2 + + u k u T k u k Example 52 Consider the following computations: U = U T U = UU T = If UU T is not the identity, what is it? Consider the following computation: UU T x = u u T x + u 2 u T 2 x + + u k u T k x = u (u T x) + u 2 (u T 2 x) + + u k (u T k x) which we recognize as the projection of x into the space spanned by the orthonormal vectors of U summary, we can think of: the following matrix form for the coordinates: In [x] U = c = U T x and the projection matrix P that takes a vector x and produces the projection of x into the space spanned by the orthonormal columns of U is P = UU T 52

Exercises Let the subspace H be formed by the span of the vectors v, v 2 given below Given the point x, x 2 below, find which one belongs to H, and if it does, give its coordinates (NOTE: The basis vectors are NOT orthonormal) v = 2 v 2 = 2 Show that the plane H defined by: H = α is isormorphic to IR 2 2 + α 2 x = 7 4 x 2 = 4 3 such that α, α 2 IR 3 Let the subspace G be the plane defined below, and consider the vector x, where: G = α 3 + α 2 3 such that α, α 2 IR x = 2 2 (a) Find the projector P that takes an arbitrary vector and projects it (orthogonally) to the plane G (b) Find the orthogonal projection of the given x onto the plane G (c) Find the distance from the plane G to the vector x 4 If the low dimensional representation of a vector x is [9, ] T and the basis vectors are [,, ] T and [3,, ] T, then what was the original vector x? (HINT: it is easy to compute it directly) 5 If the vector x = [, 4, 2] T and the basis vectors are [,, ] T and [3,, ] T, then what is the low dimensional representation for x? 6 Let a = [, 3] T Find a square matrix P so that P x is the orthogonal projection of x onto the span of a 7 To prove that we have an orthogonal projection, the vector Proj u (x) x should be orthogonal to u Use this definition to show that our earlier formula was correct- that is, is the orthogonal projection of x onto u Proj u (x) = x u u u u 8 Continuing with the last exercise, show that UU T x is the orthogonal projection of x into the space spanned by the columns of U by showing that (UU T x x) is orthogonal to u i for any i =, 2,, k 52 The Four Fundamental Subspaces Given any m n matrix A, we consider the mapping A : IR n IR m by: x Ax = y The four subspaces allow us to completely understand the domain and range of the mapping We will first define them, then look at some examples 53

Definition 52 The Four Fundamental Subspaces The row space of A is a subspace of IR n formed by taking all possible linear combinations of the rows of A Formally, Row(A) = x IR n x = A T y y IR m The null space of A is a subspace of IR n formed by Null(A) = {x IR n Ax = } The column space of A is a subspace of IR m formed by taking all possible linear combinations of the columns of A Col(A) = {y IR m y = Ax IR n } The column space is also the image of the mapping Notice that Ax is simply a linear combination of the columns of A: Ax = x a + x 2 a 2 + + x n a n Finally, we define the null space of A T can be defined in the obvious way (see the Exercises) The fundamental subspaces subdivide the domain and range of the mapping in a particularly nice way: Theorem 52 Let A be an m n matrix Then The nullspace of A is orthogonal to the row space of A The nullspace of A T is orthogonal to the columnspace of A Proof: We ll prove the first statement, the second statement is almost identical to the first To prove the first statement, we have to show that if we take any vector x from nullspace of A and any vector y from the row space of A, then x y = Alternatively, if we can show that x is orthogonal to each and every row of A, then we re done as well (since y is a linear combination of the rows of A) In fact, now we see a strategy: Write out what it means for x to be in the nullspace using the rows of A For ease of notation, let a j denote the j th row of A, which will have size n Then: Ax = a a 2 a m x = a x a 2 x a m x = Therefore, the dot product between any row of A and x is zero, so that x is orthogonal to every row of A Therefore, x must be orthogonal to any linear combination of the rows of A, so that x is orthogonal to the row space of A Before going further, let us recall how to construct a basis for the column space, row space and nullspace of a matrix A We ll do it with a particular matrix: Example 52 Construct a basis for the column space, row space and nullspace of the matrix A below that is row equivalent to the matrix beside it, RREF(A): A = 2 5 7 3 2 2 2 3 5 8 2 RREF(A) = 54

The first two columns of the original matrix form a basis for the columnspace (which is a subspace of IR 3 ): Col(A) = span 2 2, 2 2 3 3 A basis for the row space is found by using the row reduced rows corresponding to the pivots (and is a subspace of IR 4 ) You should also verify that you can find a basis for the null space of A, given below (also a subspace of IR 4 ) If you re having any difficulties here, be sure to look it up in a linear algebra text: Row(A) = span, Null(A) = span, We will often refer to the dimensions of the four subspaces dimension of the column space- That is, the rank We recall that there is a term for the Definition 522 The rank of a matrix A is the number of independent columns of A In our previous example, the rank of A is 2 Also from our example, we see that the rank is the dimension of the column space, and that this is the same as the dimension of the row space (all three numbers correspond to the number of pivots in the row reduced form of A) Finally, a handy theorem for counting is the following The Rank Theorem Let the m n matrix A have rank r Then r + dim (Null(A)) = n This theorem says that the number of pivot columns plus the other columns (which correspond to free variables) is equal to the total number of columns Example 522 The Dimensions of the Subspaces Given a matrix A that is m n with rank k, then the dimensions of the four subspaces are shown below dim (Row(A)) = k dim (Null(A)) = n k dim (Col(A)) = k dim Null(A T ) = m k There are some interesting implications of these theorems to matrices of data- For example, suppose A is m n With no other information, we do not know whether we should consider this matrix as n points in IR m, or m points in IR n In one sense, it doesn t matter! The theorems we ve discussed shows that the dimension of the columnspace is equal to the dimension of the rowspace Later on, we ll find out that if we can find a basis for the columnspace, it is easy to find a basis for the rowspace We ll need some more machinery first 53 Exercises Show that Null(A T ) Col(A) Hint: You may use what we already proved 2 If A is m n, how big can the rank of A possibly be? 3 Show that multiplication by an orthogonal matrix preserves lengths: Qx 2 = x 2 (Hint: Use properties of inner products) Conclude that multiplication by Q represents a rigid rotation 55

4 Prove the Pythagorean Theorem by induction: Given a set of n orthogonal vectors {x i } n x i 2 2 = n i= i= x i 2 2 The case where n = is trivial, so you might look at n = 2 first Try starting with x + y 2 = (x + y) T (x + y) = and then simplify to get x 2 + y 2 Now try the induction step on your own 5 Let A be an m n matrix where m > n, and let A have rank n Let y, ŷ IR m, such that ŷ is the orthogonal projection of y onto the column space of A We want a formula for the matrix P : IR m IR m so that Py = ŷ The following image shows the relevant subspaces: (a) Why is the projector not P = AA T? (b) Since ŷ y is orthogonal to the column space of A, show that A T (ŷ y) = (53) (c) Show that there exists x IR n so that Equation (53) can be written as: A T (Ax y) = (54) (d) Argue that A T A (which is n n) is invertible, so that Equation (54) implies that x = A T A A T y (e) Finally, show that this implies that P = A A T A A T Note: If A has rank k = n, then we will need something different, since A T A will not be full rank The missing piece is the singular value decomposition, to be discussed later 6 The Orthogonal Decomposition Theorem: if x IR n and W is a (non-zero) subspace of IR n, then x can be written uniquely as x = w + z where w W and z W To prove this, let {u i } p i= be an orthonormal basis for W, define w = (x u )u + + (x u p )u p, and define z = x w Then: 56

(a) Show that z W by showing that it is orthogonal to every u i (b) To show that the decomposition is unique, suppose it is not That is, there are two decompositions: x = w + z, x = w 2 + z 2 Show this implies that w w 2 = z 2 z, and that this vector is in both W and W What can we conclude from this? 7 Use the previous exercises to prove the The Best Approximation Theorem If W is a subspace of IR n and x IR n, then the point closest to x in W is the orthogonal projection of x into W 54 The Decomposition Theorems The matrix factorization that arises from an eigenvector/eigenvalue decomposition is useful in many applications, so we ll briefly review it here and build from it until we get to our main goal, the Singular Value Decomposition 54 The Eigenvector/Eigenvalue Decomposition First we have a basic definition: Let A be an n n matrix If there exists a scalar λ and non-zero vector v so that Av = λv then we say that λ is an eigenvalue and v is an associated eigenvector An equivalent formulation of the problem is to solve Av v =, or, factoring v out, (A λi)v = This equation always has the zero solution (letting v = ), however, we need to have non-trivial solutions, and the only way that will happen is if A λi is non-invertible, or equivalently, det(a λi) = which, when multiplied out, is a polynomial equation in λ that is called the characteristic equation Therefore, we find the eigenvalues first, then for each λ, there is an associated subspace- The null space of A λi, or the eigenspace associated with λ, denoted by E λ The way to finish the problem is to give a nice basis for the eigenspace- If you re working by hand, try one with integer values If you re on the computer, it is often convenient to make them unit vectors Some vocabulary associated with eigenvalues: Solving the characteristic equation will mean that we can have repeated solutions The number of repetitions is the algebraic multiplicity of λ On the other hand, for each λ, we find the eigenspace which will have a certain dimension- The dimension of the eigenspace is the geometric multiplicity of λ Examples: Compute the eigenvalues and eigenvectors for the 2 2 identity matrix SOLUTION: The eigenvalue is (a double root), so the algebraic multiplicity of is 2 On the other hand, if we take A λi, we simply get the zero matrix, which implies that every vector in IR 2 is an eigenvector Therefore, we can take any basis of IR 2 is a basis for E, and the geometric multiplicity is 2 57

2 Consider the matrix 2 Again, the eigenvalue is a double eigenvalue (so the algebraic multiplicity is 2), but solving (A λi)v = gives us: 2v 2 = v 2 = That means v is free, and the basis for E is [, ] T Therefore, the algebraic multiplicity is Definition: A matrix for which the algebraic and geometric multiplicities are not equal is called defective There is a nice theorem relating eigenvalues: Theorem: If X is square and invertible, then A and X AX have the same eigenvalues Sometimes this method of characterizing eigenvalues in terms of the determinant and trace of a matrix: det(a) = Π n i=λ i trace(a) = Symmetric Matrices and the Spectral Theorem There are some difficulties working with eigenvalues and eigenvectors of a general matrix For one thing, they are only defined for square matrices, and even when they are defined, we may get real or complex eigenvalues If a matrix is symmetric, beautiful things happen with the eigenvalues and eigenvectors, and it is summarized below in the Spectral Theorem The Spectral Theorem: If A is an n n symmetric matrix, then: A has n real eigenvalues (counting multiplicity) 2 For each distinct λ, the algebraic and geometric multiplicities are the same 3 The eigenspaces are mutually orthogonal- both for distinct eigenvalues, and we ll take each E λ to have an orthonormal basis 4 A is orthogonally diagonalizeable, with D = diag(λ, λ 2,, λ n ) That is, if V is the matrix whose columns are the (othornormal) eigenvectors of A, then Some remarks about the Spectral Theorem: A = V DV T If a matrix is real and symmetric, the Spectral Theorem says that its eigenvectors form an orthonormal basis for IR n The first part is somewhat difficult to prove in that we would have to bring in more machinery than we would like If you would like to see a proof, it comes from the Schur Decomposition, which is given, for example, in Matrix Computations by Golub and Van Loan The following is a proof of the third part Supply justification for each step: Let v, v 2 be eigenvectors from distinct eigenvalues, λ, λ 2 We show that v v 2 = : Now, (λ λ 2 )v v 2 = i= λ v v 2 = (Av ) T v 2 = v T A T v 2 = v T Av 2 = λ 2 v v 2 58 λ i

The Spectral Decomposition: Since A is orthogonally diagonalizable, then λ q T λ 2 q T 2 A = (q q 2 q n ) λ n q T n so that: A = (λ q λ 2 q 2 λ n q n ) q T q T 2 so finally: q T n A = λ q q T + λ 2q 2 q T 2 + + λ nq n q T n That is, A is a sum of n rank one matrices, each of which is a projection matrix Exercises Prove that if X is invertible and matrix A is square, then A and X AX have the same eigenvalues Matlab Exercise: Verify the spectral decomposition for a symmetric matrix Type the following into Matlab (the lines that begin with a % denote comments that do not have to be typed in) %Construct a random, symmetric, 6 x 6 matrix: for i=:6 for j=:i A(i,j)=rand; A(j,i)=A(i,j); end end %Compute the eigenvalues of A: [Q,L]=eig(A); %NOTE: A = Q L Q %L is a diagonal matrix %Now form the spectral sum S=zeros(6,6); for i=:6 S=S+L(i,i)*Q(:,i)*Q(:,i) ; end max(max(s-a)) Note that the maximum of S A should be a very small number! (By the spectral decomposition theorem) 542 The Singular Value Decomposition There is a special matrix factorization that is extremely useful, both in applications and in proving theorems This is mainly due to two facts, which we shall investigate in this section: () We can use this factorization on any matrix, (2) The factorization defines explicitly the rank of the matrix, and gives orthonormal bases for all four matrix subspaces In what follows, assume that A is an m n matrix (so A maps IR n to IR m and is not square) 59

Although A itself is not symmetric, A T A is n n and symmetric, so the Spectral Theorem applies In particular, A T A is orthogonally diagonalizable Let {λ i } n i= and V = [v, v 2,, v n ] be the eigenvalues and orthonormal eigenvectors so that A T A = V DV T and D is the diagonal matrix with λ i along the diagonal 2 Exercise: Show that λ i for i = n by showing that Av i 2 2 = λ i As a starting point, you might rewrite Av i 2 = (Av) T Av 3 Definition: We define the singular values of A by: where λ i is an eigenvalue of A T A σ i = λ i 4 In the rest of the section, we will assume any list (or diagonal matrix) of eigenvals of A T A (or singular values of A) will be ordered from highest to lowest: λ λ 2 λ n 5 Exercise: Prove that, if v i and v j are distinct eigenvectors of A T A, then their corresponding images, Av i and Av j, are orthogonal 6 Exercise: Prove that, if x = α v + α n v n, then Ax 2 = α 2 λ + + α 2 n λ n 7 Exercise: Let W be the subspace generated by the basis {v j } n j=k+, where v j are the eigenvectors associated with the zero eigenvalues of A T A (therefore, we are assuming that the first k eigenvalues are NOT zero) Show that W = Null(A) Hint: To show this, take an arbitrary vector x from W Rather than showing directly that Ax =, instead show that the magnitude of Ax is zero We also need to show that if we take any vector from the nullspace of A, then it is also in W 8 Exercise: Prove that if the rank of A T A is r, then so is the rank of A Hint: How does the previous exercise help? 9 Define the columns of a matrix U as: u i = and let U be the matrix whose i th column is u i Av i 2 Av i = σ i Av i We note that this definition only makes sense sense for the first r vectors v (otherwise, Av i = ) Thus, we ll have to extend the basis to span all of IR m, which can be done using Gram-Schmidt Exercise: Show that u i is an eigenvector of AA T whose eigenvalue is also λ i Exercise: Show that A T u i = σ i v i 2 So far, we have shown how to construct two matrices, U and V given a matrix A That is, the matrix V is constructed by the eigenvectors of A T A, and the matrix U can be constructed using the v s or by finding the eigenvectors of AA T 6

5 5 v 2 σ 2 u 2 2 8 v 6 5 4 2 5 σ u 2 5 4 6 5 8 2 25 2 5 5 5 5 2 25 Figure 5: The geometric meaning of the right and left singular vectors of the SVD decomposition Note that Av i = σ i u i The mapping x Ax will map the unit circle on the left to the ellipse on the right 3 Exercise: Let A be m n Define the m n matrix Σ = diag(σ,, σ n ) where σ i is the i th singular value of the matrix A Show that AV = UΣ 4 Theorem: The Singular Value Decomposition (SVD) Let A be any m n matrix of rank r Then we can factor the matrix A as the following product: A = UΣV T where U, Σ, V are the matrices defined in the previous exercises That is, U is an orthogonal m m matrix, Σ is a diagonal m n matrix, and V is an orthogonal n n matrix The u s are called the left singular vectors and the v s are called the right singular vectors 5 Keep in mind the following relationship between the right and left singular vectors: Av i = σ i u i A T u i = σ i v i 6 Computing The Four Subspaces to a matrix A Let A = UΣV T be the SVD of A which has rank r Be sure that the singular values are ordered from highest to lowest Then: (a) A basis for the columnspace of A, Col(A) is {u i } r i= (b) A basis for nullspace of A, Null(A) is {v i } n i=r+ (c) A basis for the rowspace of A, Row(A) is {v i } r i= (d) A basis for the nullspace of A T, Null(A T ) is {u i } m i=r+ 7 We can also visualize the right and left singular values as in Figure 5 We think of the v i as a special orthogonal basis in R n (Domain) that maps to the ellipse whose axes are defined by σ i u i 8 The SVD is one of the premier tools of linear algebra, because it allows us to completely reveal everything we need to know about a matrix mapping: The rank, the basis of the nullspace, a basis for the column space, the basis for the nullspace of A T, and of the row space This is depicted in Figure 52 6

Col(A T ) v u Col(A) v 2 u 2 v k u k N(A) v k+ = v n = u k+ N(A T ) u m IR n IR m Figure 52: The SVD of A ([U,S,V]=svd(A)) completely and explicitly describes the 4 fundamental subspaces associated with the matrix, as shown We have a one to one correspondence between the rowspace and columnspace of A, the remaining v s map to zero, and the remaining u s map to zero (under A T ) 62

9 Lastly, the SVD provides a decomposition of any linear mapping into two rotations and a scaling This will become important later when we try to deduce a mapping matrix from data (See the section on signal separation) 2 Exercise: Compute the SVD by hand of the following matrices: 2 2 Remark: If m or n is very large, it might not make sense to keep the full matrix U and V 22 The Reduced SVD Let A be m n with rank r Then we can write: A = Ũ Σ V T where Ũ is an m r matrix with orthogonal columns, Σ is an r r square matrix, and Ṽ is an n r matrix 23 Theorem: (Actually, this is just another way to express the SVD) Let A = UΣV T be the SVD of A, which has rank r Then: r A = σ i u i v T i Therefore, we can approximate A by the sum of rank one matrices i= 24 Matlab and the SVD Matlab has the SVD built in The function specifications are: [U,S,V]=svd(A) and [U,S,V]=svd(A,) where the first function call returns the full SVD, and the second call returns a reduced SVD- see Matlab s help file for the details on the second call 25 Matlab Exercise: Image Processing and the SVD First, in Matlab, load the clown picture: load clown This loads a matrix X and a colormap, map, into the workspace To see the clown, type: image(x); colormap(map) We now perform a Singular Value Decomposition on the clown Type in: [U,S,V]=svd(X); How many vectors are needed to retain a good picture of the clown? Try performing a k dimensional reconstruction of the image by typing: H=U(:,:k)*S(:k,:k)*V(:,:k) ; image(h) for k = 5,, 2 and 3 What do you see? 63

Generalized Inverses Let a matrix A be m n with rank r In the general case, A does not have an inverse Is there a way of restricting the domain and range of the mapping y = Ax so that the map is invertible? We know that the columnspace and rowspace of A have the same dimensions Therefore, there exists a - and onto map between these spaces, and this is our restriction To solve y = Ax, we replace y by its orthogonal projection to the columnspace of A, ŷ This gives the least squares solution, which makes the problem solvable To get a unique solution, we replace x by its projection to the rowspace of A, ˆx The problem ŷ = Aˆx now has a solution, and that solution is unique We can rewrite this problem now in terms of the reduced SVD of A: ˆx = V V T x, ŷ = UU T y Now we can write: so that UU T y = UΣV T V V T x V Σ U T y = V V T x (Exercise: Verify that these computations are correct!) Given an m n matrix A, define its pseudoinverse, A by: A = V Σ U T We have shown that the least squares solution to y = Ax is given by: ˆx = A y where ˆx is in the rowspace of A, and its image, Aˆx is the projection of y into the columnspace of A Geometrically, we can understand these computations in terms of the four fundamental subspaces Row(A) Ax = y Col(A) q y Null(A) Null(A T ) IR n IR m In this case, there is no value of x IR n which will map onto y, since y is outside the columnspace of A To get a solution, we project y onto the columnspace of A as shown below: Row(A) Col(A) ŷ = UU T y q y Null(A) Null(A T ) 64

Now it is possible to find an x that will map onto ŷ, but if the nullspace of A is nontrivial, then all of the points on the dotted line will also map to ŷ Row(A) Col(A) ˆx = V V T xr r x ŷ q y Null(A) Null(A T ) Finally, we must choose a unique value of x for the mapping- We choose the x inside the rowspace of A This is a very useful idea, and it is one we will explore in more detail later For now, notice that to get this solution, we analyzed our four fundamental subspaces in terms of the basis vectors given by the SVD Exercises Consider 2 3 2 x x 2 x 3 = 5 (a) Before solving this problem, what are the dimensions of the four fundamental subspaces? (b) Use Matlab to compute the SVD of the matrix A, and solve the problem by computing the pseudoinverse of A directly (c) Check your answer explicitly and verify that ˆx and ŷ are in the rowspace and columnspace (Hint: If a vector x is already in the rowspace, what is V V T x?) 2 Consider 2 3 2 7 2 5 2 3 2 4 4 3 7 x x 2 x 3 x4 = (a) Find the dimensions of the four fundamental subspaces by using the SVD of A (in Matlab) (b) Solve the problem (c) Check your answer explicitly and verify that ˆx and ŷ are in the rowspace and columnspace 3 Write the following in Matlab to reproduce Figure 5: theta=linspace(,2*pi,3); z=exp(i*theta); X=[real(z);imag(z)]; %The domain points m=/sqrt(2); A=(m*[,;,-])*[,;,3]; Y=A*X; %The image of the circle 5 2 6 t=linspace(,); vec=[;]*(-t)+[;]*t; %The basis vectors v 65

vec2=[;]*(-t)+[;]*t; Avec=A*vec; Avec2=A*vec2; %Image of the basis vectors figure() %The domain plot(x(,:),x(2,:), k,vec(,:),vec(2,:), k, vec2(,:),vec2(2,:), k ); axis equal figure(2) %The image plot(y(,:),y(2,:), k,avec(,:),avec(2,:), k, Avec2(,:),Avec2(2,:), k ); axis equal 4 In the previous example, what was the matrix A? The vectors v? The vectors u? The singular values σ, σ 2? Once you ve written these down from the program, perform the SVD of A in Matlab Are the vectors the same that you wrote down? NOTE: These show that the singular vectors are not unique- they vary by ±v, or ±u 66