MIT 18.06 Completed

Lecture 29 · Singular value decomposition

Master singular value decomposition and understand the "rotation-stretch-rotation" structure of any matrix.

On this page

Singular value decomposition | Gilbert Strang | MIT 18.06 Linear Algebra

Lecture 29 / Total 35 Lectures |Part 3 · Eigenvalues, positive definiteness and linear transformation

Video of this lecture: Bilibili p30 · Singular value decomposition ↗(41:35)| MIT OCW official page ↗

Illustration: MIT OCW 18.06SC official lecture summary (CC BY-NC-SA 4.0) and Bilibili classroom video frames (time stamped), about 10 frames per lecture.

Introduction to this lecture

So far, this course has accumulated a series of matrix decompositions: A=LUA=LU, A=QRA=QR, general matrix A=SΛS−1A=S\Lambda S^{-1}, symmetric matrix A=QΛQTA=Q\Lambda Q^{\mathsf T}. Each of them has prerequisites: smooth elimination, column vectors are linearly independent, there are enough linearly independent eigenvectors, and the matrix itself is symmetrical. This lecture gives the last and best decomposition——singular value decomposition (singular value decomposition, SVD). It has no premise: any matrix can be made, including square, rectangular, reversible, singular, diagonalizable, and non-diagonalizable matrices. Its three factors happen to be the three most familiar good matrices in the course: orthogonal matrix, diagonal matrix, and orthogonal matrix. The previous decompositions are all decompositions that are “only available for special matrices”, only this is the decomposition that is “available for any matrix”.

SVD is motivated by diagonalizing gaps. General A=SΛS−1A=S\Lambda S^{-1} inside, SS The columns of are eigenvectors, but they are not perpendicular to each other, so two sets of tilted bases are used on the left and right sides of the equation. Symmetric matrices are the luckiest case: the eigenvectors are automatically orthogonal, SS upgrade to QQ, A=QΛQTA=Q\Lambda Q^{\mathsf T}, both sides share the same set of standard orthonormal bases; if positive definiteness is required again, the diagonal will still be all positive numbers. For general matrices, this luck is gone, so the requirements are relaxed: both sides are allowed to be used different Two sets of orthonormal bases. The price is that the number in the middle diagonal matrix is no longer an eigenvalue, but a new role——singular value(singular value).

This lecture proceeds along a very specific route: first draw the target into a picture, that is, a set of orthonormal basis quilts of the row space AA Send it to a set of orthonormal basis in the column space; then translate this picture into a matrix equation A=UΣVTA=U\Sigma V^{\mathsf T}; then use ATAA^{\mathsf T}A with AATAA^{\mathsf T} Calculate the bases on both sides respectively; finally use two numerical examples - one reversible 2×22\times2 Matrix, a rank 1 matrix—goes through the entire process. After walking through, you will find the true meaning of SVD: it gives a set of “correct” bases for the four basic subspaces. These bases are both orthonormal and can AA into a diagonal matrix.

Official Handout Summary Page 1/4

MIT OCW Official Lecture Notes Summary Page 1/4 (18.06SC Lecture 29 Summary, CC BY-NC-SA 4.0).

1. From eigenvalues to singular values

What SVD wants to fill is the gap left by ordinary diagonalization. Let’s start with the best-case scenario. The eigenvectors of a symmetric matrix can be chosen to be mutually orthogonal. By unitizing them and arranging them into columns, we get an orthogonal matrix QQ, that is QTQ=IQ^{\mathsf T}Q=I, so the symmetric matrix can be orthogonally diagonalized:

A=QΛQT.A=Q\Lambda Q^{\mathsf T}.

if AA Still righteous, Λ\Lambda The diagonal elements of are all positive. Rename the diagonal element, let σi=λi\sigma_i=\lambda_i, the same equation is read as

A=QΣQT,A=Q\Sigma Q^{\mathsf T},

That is, “orthogonal × diagonal × orthogonal”, and both sides can be used same one QQ. This is exactly what SVD looks like in the symmetric positive definite case, and it’s the least cumbersome one: a set of orthonormal bases serve as bases on both sides simultaneously. The reason why they can be shared is because the eigenvectors of symmetric matrices happen to be orthogonal - this is a special property, not a universal phenomenon.

No such luck with general matrices. Its diagonalization is A=SΛS−1A=S\Lambda S^{-1}, SS consists of eigenvectors, which are usually not orthogonal; therefore SS is not an orthogonal matrix, S−1S^{-1} Nor can it be written as STS^{\mathsf T}. If the basis on both sides of the equation is distorted, the sentence “diagonalization under an orthonormal basis” will not be true. In addition, it is impossible to even talk about eigenvalues ​​for rectangular matrices, and the path of eigenvalues ​​is simply unworkable in that situation.

The idea of SVD is to break down the requirement of “diagonalization”. It actually contains two things: (1) the basis used on both sides is orthonormal; (2) the off-diagonal positions are all zero. A=SΛS−1A=S\Lambda S^{-1} It satisfies (2) but sacrifices (1); orthogonal diagonalization satisfies both of them, but it is only true for symmetric matrices. SVD’s choice is to retain (1) and (2), abandon the additional requirement of “both sides share the same set of bases”, and let the left base and the right base be selected independently. So the question becomes:

exists m×mm\times m the orthogonal matrix UU, n×nn\times n the orthogonal matrix VV, and m×nm\times n The diagonal matrix of Σ\Sigma, making A=UΣVTA=U\Sigma V^{\mathsf T}?

The answer is yes, and it holds for any matrix. Σ\Sigma Numbers on the diagonal σ1,σ2,…,σr\sigma_1,\sigma_2,\dots,\sigma_r All are positive and are called singular value. It should be reminded that singular values are generally not AA eigenvalues of ATAA^{\mathsf T}A The positive square root of the eigenvalues of is a fact that will be shown in the next section. Only in the case of symmetric positive definites the two coincide exactly (then σi=λi\sigma_i=\lambda_i). Precisely because of the change of objects, rectangular matrices and non-diagonalizable matrices are eligible to enter this framework.

Video 00:04:10: Classroom blackboard writing

Video 00:04:10 | Approximately corresponding to Section 1 “1. From Eigenvalues to Singular Values”.

2. Geometric image: The basis of the row space is fed into the basis of the column space.

one m×nm\times n A matrix is a Rn\mathbb{R}^n Arrive Rm\mathbb{R}^m linear transformation. The recurring picture in the course explains its function most clearly: the input space is divided into two parts: row space and null space, and the output space is divided into two parts: column space and left null space; the null space is completely suppressed. 0\boldsymbol{0}, the row space fills the column space one by one, and the dimensions on both sides are the same r=rank⁡(A)r=\operatorname{rank}(A). The real content part is the section from row space to column space.

What SVD is looking for is two sets of bases that match each other under this mapping: a set of orthonormal bases in the row space v1,…,vr\boldsymbol v_1,\dots,\boldsymbol v_r, through AA After the action, it becomes a set of mutually perpendicular vectors in the column space; then the image is unitized to obtain the orthonormal basis of the column space. u1,…,ur\boldsymbol u_1,\dots,\boldsymbol u_r. The only difference between the two sets of bases is a length factor:

Avi=σiui,i=1,2,…,r.A\boldsymbol v_i=\sigma_i\boldsymbol u_i,\qquad i=1,2,\dots,r .

σi>0\sigma_i>0 That’s the direction Stretch ratio (stretching factor). in other words, AA Transform a set of mutually perpendicular unit vectors into another set of mutually perpendicular vectors, only changing the length but not the angle. The two right angles in the entire picture - the right angle on the input side and the right angle on the output side - are preserved at the same time. This is the one-sentence version of the entire content of SVD.

Why can’t we just find a set of orthonormal basis for the row space? Because Gram-Schmidt orthogonalization only looks at this side of the input: it can grind a set of orthonormal basis from any set of basis, but AA Once you’re on it, there’s no reason to stay vertical. Taking a general standard orthonormal basis, the angles between their image vectors will become messy and have different lengths. So the question is not “how to orthogonalize”, but “which set of orthogonal directions are AA Keep it orthogonal” - this is a feature direction problem, to be precise ATAA^{\mathsf T}A The problem of feature direction is explained in the next section.

null space does not pose any trouble here. Base completion of row spaces: vr+1,…,vn\boldsymbol v_{r+1},\dots,\boldsymbol v_n Take null space N(A)N(A) The orthonormal basis of AA send them all 0\boldsymbol 0, automatically satisfies “the images are perpendicular to each other” (the zero vector is orthogonal to any vector). Then complete the basis of the column space: ur+1,…,um\boldsymbol u_{r+1},\dots,\boldsymbol u_m Take left null space N(AT)N(A^{\mathsf T}) the orthonormal basis of . These supplementary directions are in Σ\Sigma corresponding to the diagonal of 00, that is, “multiply by zero”. The only thing that really takes effort to find is rr Right: in row space v\boldsymbol v and in column space u\boldsymbol u, the dimensions on both sides are rr;The dimension of the null space is n−rn-r, the left null space is m−rm-r.

Video 00:12:39: Classroom blackboard writing

Video 00:12:39 | Approximately corresponding to section 2 “2. Geometric image: the basis of the row space is sent to the basis of the column space”.

Official Handout Summary Page 2/4

MIT OCW Official Lecture Notes Summary Page 2/4 (18.06SC Lecture 29 Summary, CC BY-NC-SA 4.0).

3. Write it as a matrix equation: A=UΣVTA=U\Sigma V^{\mathsf T}

pairing relationship Avi=σiuiA\boldsymbol v_i=\sigma_i\boldsymbol u_i Matrix multiplication can be written in one go. Put the front first rr vectors arranged in columns:

A[v1v2⋯vr]=[u1u2⋯ur][σ1⋱σr].A\begin{bmatrix}\boldsymbol v_1&\boldsymbol v_2&\cdots&\boldsymbol v_r\end{bmatrix} =\begin{bmatrix}\boldsymbol u_1&\boldsymbol u_2&\cdots&\boldsymbol u_r\end{bmatrix} \begin{bmatrix}\sigma_1&&\\&\ddots&\\&&\sigma_r\end{bmatrix}.

No. on the left ii Column is AviA\boldsymbol v_i, the right ii Column is σiui\sigma_i\boldsymbol u_i, are equal column by column, and the equation holds. Note that the diagonal matrix on the right is multiplied from the right. Its function is to multiply each column by its respective multiple - this is “scaling by column”.

Then make up for it vr+1,…,vn\boldsymbol v_{r+1},\dots,\boldsymbol v_n (null space direction) and ur+1,…,um\boldsymbol u_{r+1},\dots,\boldsymbol u_m (Left null space direction) is also added in columns. left becomes AVAV, VV is n×nn\times n Orthogonal matrix of ; the right side becomes UΣU\Sigma, UU is m×mm\times m is an orthogonal matrix, and Σ\Sigma is m×nm\times n matrix, the upper left corner is a piece diag⁡(σ1,…,σr)\operatorname{diag}(\sigma_1,\dots,\sigma_r), the rest are all zeros:

Σ=[D000],D=diag⁡(σ1,…,σr),D 为 r×r.\Sigma=\left[\begin{array}{c|c}D&\boldsymbol 0\\\hline \boldsymbol 0&\boldsymbol 0\end{array}\right], \qquad D=\operatorname{diag}(\sigma_1,\dots,\sigma_r),\quad D\ \text{为}\ r\times r .

Those added are listed on the right Σ\Sigma The zero blocks are multiplied out, so the equation is not violated. So get AV=UΣAV=U\Sigma.VV is an orthogonal matrix, V−1=VTV^{-1}=V^{\mathsf T}, multiply both sides by right VTV^{\mathsf T}, we get the final form of SVD:

A=UΣVT.A=U\Sigma V^{\mathsf T}.

This equation says three things. First, UU with VV Generally, it cannot be taken as the same matrix. Only in cases such as symmetric positive definite cases, both sides share a set of basis. Second, AA Diagonalized by these two sets of basis: AviA\boldsymbol v_i only ui\boldsymbol u_i The component of the direction, there is no cross-term, that is v\boldsymbol v with v\boldsymbol v There is no coupling between u\boldsymbol u with u\boldsymbol u There is no coupling between them. Third, Σ\Sigma The shape is m×nm\times n, rank is rr, the extra zeros when the matrix is singular or not a square matrix record the dimensions of the null space and the left null space.

Video 00:15:48: Classroom blackboard writing

Video 00:15:48|Approximately corresponding to Section 3 “3. Write it as a matrix equation: A=UΣVTA=U\Sigma V^{\mathsf T}“Nearby.

4. use ATAA^{\mathsf T}A Ask for VV, use AATAA^{\mathsf T} Ask for UU

UU with VV They are all unknown, and it is not cost-effective to solve them at the same time. The way is to create a combination and eliminate one of them. What is still used here is ATAA^{\mathsf T}A——Whenever you encounter a rectangular matrix, this combination will always appear - expand it according to SVD:

ATA=(VΣTUT)(UΣVT)=VΣT(UTU)ΣVT=V(ΣTΣ)VT.A^{\mathsf T}A=\bigl(V\Sigma^{\mathsf T}U^{\mathsf T}\bigr)\bigl(U\Sigma V^{\mathsf T}\bigr) =V\Sigma^{\mathsf T}\bigl(U^{\mathsf T}U\bigr)\Sigma V^{\mathsf T} =V\bigl(\Sigma^{\mathsf T}\Sigma\bigr)V^{\mathsf T}.

The key is in the middle: UU is an orthogonal matrix, UTU=IU^{\mathsf T}U=I, so UU The whole thing disappears. the rest ΣTΣ\Sigma^{\mathsf T}\Sigma is n×nn\times n The diagonal matrix of , on the diagonal is σ12,…,σr2\sigma_1^2,\dots,\sigma_r^2, followed by n−rn-r A zero. So

ATA=Vdiag⁡(σ12,…,σr2,0,…,0)VT.A^{\mathsf T}A=V\operatorname{diag}\bigl(\sigma_1^2,\dots,\sigma_r^2,0,\dots,0\bigr)V^{\mathsf T}.

This is a standard orthogonal diagonalization. ATAA^{\mathsf T}A Symmetrical in itself ((ATA)T=ATA(A^{\mathsf T}A)^{\mathsf T}=A^{\mathsf T}A), so there must be orthogonal eigenvector groups; the above formula shows that these eigenvectors are VV column, the corresponding eigenvalue is σi2\sigma_i^2. In addition ATAA^{\mathsf T}A must be positive semi-definite, because for any x\boldsymbol x,

xTATAx=(Ax)T(Ax)≥0,\boldsymbol x^{\mathsf T}A^{\mathsf T}A\boldsymbol x =(A\boldsymbol x)^{\mathsf T}(A\boldsymbol x)\ge 0 ,

On the right is AxA\boldsymbol x The inner product with itself, that is, its length squared, is always non-negative. So ATAA^{\mathsf T}A The eigenvalues of can never be negative, and the square root always makes sense. The singular value is Right The square root of.

Use the same technique to reverse the order of multiplication. What is caught in the middle at this time is VTV=IV^{\mathsf T}V=I, VV was eliminated, leaving behind UU:

AAT=UΣΣTUT=Udiag⁡(σ12,…,σr2,0,…,0)UT.AA^{\mathsf T}=U\Sigma\Sigma^{\mathsf T}U^{\mathsf T} =U\operatorname{diag}\bigl(\sigma_1^2,\dots,\sigma_r^2,0,\dots,0\bigr)U^{\mathsf T}.

thus UU The columns are AATAA^{\mathsf T} unit eigenvector. The two matrices may be of different sizes (ATAA^{\mathsf T}A is n×nn\times n, AATAA^{\mathsf T} is m×mm\times m), but their non-zero eigenvalues must be the same: if ATAv=λvA^{\mathsf T}A\boldsymbol v=\lambda\boldsymbol v and λ≠0\lambda\neq0, then

AAT(Av)=A(ATAv)=A(λv)=λ Av,AA^{\mathsf T}(A\boldsymbol v)=A\bigl(A^{\mathsf T}A\boldsymbol v\bigr)=A(\lambda\boldsymbol v)=\lambda\,A\boldsymbol v ,

And λ≠0\lambda\neq0 guarantee Av≠0A\boldsymbol v\neq\boldsymbol 0, so λ\lambda Also AATAA^{\mathsf T} eigenvalues. This means that two matrices can give the same batch σ\sigma reason.

The entire algorithm is therefore divided into three steps:

  1. Calculate ATAA^{\mathsf T}A, ask for it nn unit eigenvectors, arranged in columns VV; Take the positive square root of the eigenvalues to get σ1,…,σr\sigma_1,\dots,\sigma_r.
  2. Calculate AATAA^{\mathsf T}, ask for it mm unit eigenvectors, arranged in columns UU.
  3. put σ\sigma placed in order Σ\Sigma On the diagonal of , the remaining positions are filled with zeros.

Step 3 is not as mechanical as it sounds: σi\sigma_i, vi\boldsymbol v_i, ui\boldsymbol u_i The subscripts must be matched and the symbols must be aligned, otherwise the assembled matrix will go wrong. The next example will hit this problem.

5. Example 1: A reversible 2×22\times2 matrix

take

A=[44−33].A=\begin{bmatrix}4&4\\-3&3\end{bmatrix}.

It is reversible, det⁡A=4⋅3−4⋅(−3)=24\det A=4\cdot3-4\cdot(-3)=24, so the rank is 22, both row space and column space are the entire R2\mathbb{R}^2: To find two standard orthogonal v\boldsymbol v Orthogonal to two standards u\boldsymbol u.

The first step is to calculate ATAA^{\mathsf T}A:

ATA=[4−343][44−33]=[257725].A^{\mathsf T}A=\begin{bmatrix}4&-3\\4&3\end{bmatrix}\begin{bmatrix}4&4\\-3&3\end{bmatrix} =\begin{bmatrix}25&7\\7&25\end{bmatrix}.

The diagonal element is 16+9=2516+9=25, the subdiagonal element is 16−9=716-9=7, the results are indeed symmetrical. shaped like [abba]\begin{bmatrix}a&b\\b&a\end{bmatrix} The matrix has a ready-made rule: the eigenvectors are always (1,1)(1,1) with (1,−1)(1,-1), the eigenvalues are respectively a+ba+b with a−ba-b. So here the eigenvector is (1,1)(1,1), (1,−1)(1,-1), the characteristic value is 3232 with 1818. Direct calculation:

[257725][11]=[3232]=32[11],[257725][1−1]=[18−18]=18[1−1].\begin{bmatrix}25&7\\7&25\end{bmatrix}\begin{bmatrix}1\\1\end{bmatrix} =\begin{bmatrix}32\\32\end{bmatrix}=32\begin{bmatrix}1\\1\end{bmatrix}, \qquad \begin{bmatrix}25&7\\7&25\end{bmatrix}\begin{bmatrix}1\\-1\end{bmatrix} =\begin{bmatrix}18\\-18\end{bmatrix}=18\begin{bmatrix}1\\-1\end{bmatrix}.

After unitization

V=12[111−1],σ1=32=42,σ2=18=32.V=\frac{1}{\sqrt2}\begin{bmatrix}1&1\\1&-1\end{bmatrix}, \qquad \sigma_1=\sqrt{32}=4\sqrt2,\qquad \sigma_2=\sqrt{18}=3\sqrt2 .

The second step is to ask for UU, change calculation AATAA^{\mathsf T}:

AAT=[44−33][4−343]=[320018].AA^{\mathsf T}=\begin{bmatrix}4&4\\-3&3\end{bmatrix}\begin{bmatrix}4&-3\\4&3\end{bmatrix} =\begin{bmatrix}32&0\\0&18\end{bmatrix}.

It happens to be a diagonal matrix, which is the luck of the example, and the eigenvectors are directly (1,0)(1,0) with (0,1)(0,1), the eigenvalue is still 3232 with 1818. Consistent with the statement in the previous section: ATAA^{\mathsf T}A with AATAA^{\mathsf T} have the same non-zero eigenvalues. So

U=[1001]=I,Σ=[320018].U=\begin{bmatrix}1&0\\0&1\end{bmatrix}=I, \qquad \Sigma=\begin{bmatrix}\sqrt{32}&0\\0&\sqrt{18}\end{bmatrix}.

The third step is to put the three pieces together to verify. press A=UΣVTA=U\Sigma V^{\mathsf T} Multiplied out is

I[320018]12[111−1]=12[323218−18]=[443−3],I\begin{bmatrix}\sqrt{32}&0\\0&\sqrt{18}\end{bmatrix} \frac{1}{\sqrt2}\begin{bmatrix}1&1\\1&-1\end{bmatrix} =\frac{1}{\sqrt2}\begin{bmatrix}\sqrt{32}&\sqrt{32}\\ \sqrt{18}&-\sqrt{18}\end{bmatrix} =\begin{bmatrix}4&4\\3&-3\end{bmatrix},

The second line is the same as AA The second line of (−3,3)(-3,3) One symbol missing. The problem is not Σ\Sigma, Σ\Sigma The diagonal element of is inherently positive; neither VV the columns themselves, which are indeed ATAA^{\mathsf T}A unit eigenvector.

The crux is that the eigenvectors can only be determined to differ by one sign: v2=12(1,−1)\boldsymbol v_2=\frac{1}{\sqrt2}(1,-1) with −12(1,−1)-\frac{1}{\sqrt2}(1,-1) All ATAA^{\mathsf T}A About 1818 The unit eigenvector of , both methods are legal, VV It is still an orthogonal matrix. What really binds the two groups of bases together is the pairing condition Avi=σiuiA\boldsymbol v_i=\sigma_i\boldsymbol u_i. Check the second direction with this condition:

Av2=12[44−33][1−1]=12[0−6]=18[0−1],A\boldsymbol v_2=\frac{1}{\sqrt2}\begin{bmatrix}4&4\\-3&3\end{bmatrix}\begin{bmatrix}1\\-1\end{bmatrix} =\frac{1}{\sqrt2}\begin{bmatrix}0\\-6\end{bmatrix} =\sqrt{18}\begin{bmatrix}0\\-1\end{bmatrix},

because 62=32=18\frac{6}{\sqrt2}=3\sqrt2=\sqrt{18}. So u2\boldsymbol u_2 Must take (0,−1)(0,-1), instead of (0,1)(0,1). After correction

U=[100−1],UΣVT=12[3232−1818]=[44−33]=A.U=\begin{bmatrix}1&0\\0&-1\end{bmatrix}, \qquad U\Sigma V^{\mathsf T} =\frac{1}{\sqrt2}\begin{bmatrix}\sqrt{32}&\sqrt{32}\\-\sqrt{18}&\sqrt{18}\end{bmatrix} =\begin{bmatrix}4&4\\-3&3\end{bmatrix}=A .

Check one by one: 32/2=16=4\sqrt{32}/\sqrt2=\sqrt{16}=4 Give the two numbers in the first row; −18/2=−3-\sqrt{18}/\sqrt2=-3, 18/2=3\sqrt{18}/\sqrt2=3 gives the second row. All matched.

This episode is worth remembering: the three pieces of SVD are not calculated independently and then assembled. ATAA^{\mathsf T}A with AATAA^{\mathsf T} Each gives a set of eigenvectors, each with a signed degree of freedom; it must be used σi\sigma_i Pair them up and use Avi=σiuiA\boldsymbol v_i=\sigma_i\boldsymbol u_i Freeze symbol. corrected UU Still orthogonal (here it’s a reflection: the first column doesn’t move, the second column reverses), so it still qualifies. There is no problem with the first direction, you can check it out: Av1=12(8,0)=32 (1,0)A\boldsymbol v_1=\frac{1}{\sqrt2}(8,0)=\sqrt{32}\,(1,0).

Video 00:27:02: Classroom blackboard writing

Video 00:27:02|Approximately corresponding to Section 5 “5. Example 1: A reversible 2×22\times2 “Matrix”.

Official Handout Summary Page 3/4

MIT OCW Official Lecture Notes Summary Page 3/4 (18.06SC Lecture 29 Summary, CC BY-NC-SA 4.0).

6. Example 2: A rank 1 matrix

The second example lets AA Strange:

A=[4386].A=\begin{bmatrix}4&3\\8&6\end{bmatrix}.

The second row is twice the first row, rank r=1r=1. This reduces all dimensions: the row space is a line, i.e. (4,3)(4,3) all multiples of ; the null space is the perpendicular through the origin; two column vectors (4,8)(4,8) with (3,6)(3,6) All (1,2)(1,2) A multiple of , so the column space is also a line; the left null space is the vertical line of the column space. Just need to find a pair v1,u1\boldsymbol v_1,\boldsymbol u_1, the remaining directions are given by completion.

Calculate first ATAA^{\mathsf T}A:

ATA=[4836][4386]=[80606045].A^{\mathsf T}A=\begin{bmatrix}4&8\\3&6\end{bmatrix}\begin{bmatrix}4&3\\8&6\end{bmatrix} =\begin{bmatrix}80&60\\60&45\end{bmatrix}.

It is also of rank 1, each row is (4,3)(4,3) multiples. Find the eigenvalues: the trace is 80+45=12580+45=125, a rank of 1 indicates that there is an eigenvalue 00, so the other one must be 125125 (The trace is equal to the sum of the eigenvalues). Therefore

σ1=125=55.\sigma_1=\sqrt{125}=5\sqrt5 .

Belong to 125125 The eigenvectors fall in the row space direction, that is (4,3)(4,3) direction; length is 55, unitized into

v1=(45,35)=(0.8, 0.6).\boldsymbol v_1=\left(\frac45,\frac35\right)=(0.8,\,0.6).

another eigenvalue 00 The corresponding eigenvector is in the null space direction, and is taken as v1\boldsymbol v_1 vertical unit vector

v2=(35,−45)=(0.6, −0.8),V=[4/53/53/5−4/5].\boldsymbol v_2=\left(\frac35,-\frac45\right)=(0.6,\,-0.8), \qquad V=\begin{bmatrix}4/5&3/5\\3/5&-4/5\end{bmatrix}.

UU This side only needs one substantive direction: the column space is given by (1,2)(1,2) Zhang Cheng, unitized

u1=15[12].\boldsymbol u_1=\frac{1}{\sqrt5}\begin{bmatrix}1\\2\end{bmatrix}.

Add another unit vector perpendicular to it u2=15(2,−1)\boldsymbol u_2=\frac{1}{\sqrt5}(2,-1), make up R2\mathbb{R}^2 The orthonormal basis of:

U=15[122−1],Σ=[55000].U=\frac{1}{\sqrt5}\begin{bmatrix}1&2\\2&-1\end{bmatrix}, \qquad \Sigma=\begin{bmatrix}5\sqrt5&0\\0&0\end{bmatrix}.

Verify once. Calculate first UΣU\Sigma, 5\sqrt5 with 555\sqrt5 Cancellation:

UΣ=15[122−1][55000]=[50100],U\Sigma=\frac{1}{\sqrt5}\begin{bmatrix}1&2\\2&-1\end{bmatrix} \begin{bmatrix}5\sqrt5&0\\0&0\end{bmatrix} =\begin{bmatrix}5&0\\10&0\end{bmatrix},

Take another right VTV^{\mathsf T}:

[50100][4/53/53/5−4/5]=[4386]=A.\begin{bmatrix}5&0\\10&0\end{bmatrix} \begin{bmatrix}4/5&3/5\\3/5&-4/5\end{bmatrix} =\begin{bmatrix}4&3\\8&6\end{bmatrix}=A .

The first line is 5⋅(4/5,3/5)=(4,3)5\cdot(4/5,3/5)=(4,3), the second line is 10⋅(4/5,3/5)=(8,6)10\cdot(4/5,3/5)=(8,6);The second column is because Σ\Sigma The second diagonal element of is 00, the entire column is multiplied.

This example makes the role of null space clear: v2\boldsymbol v_2 with u2\boldsymbol u_2 in multiplication is only 00 Multiply, no matter how you take it, it doesn’t matter AA, you can choose freely. really decide AA only v1,σ1,u1\boldsymbol v_1,\sigma_1,\boldsymbol u_1 This group is the pair of directions in row space and column space. put UΣVTU\Sigma V^{\mathsf T} Expanding by “column times row”, this will be more obvious:

A=σ1u1v1T+σ2u2v2T+⋯+σrurvrT.A=\sigma_1\boldsymbol u_1\boldsymbol v_1^{\mathsf T} +\sigma_2\boldsymbol u_2\boldsymbol v_2^{\mathsf T}+\cdots +\sigma_r\boldsymbol u_r\boldsymbol v_r^{\mathsf T}.

every item uiviT\boldsymbol u_i\boldsymbol v_i^{\mathsf T} is a rank 1 matrix, rr The sum of the terms spells out exactly AA; σi=0\sigma_i=0 The item disappears directly. The rank of example 2 is 1, AA itself is just one of them, which explains why its Σ\Sigma There is only one non-zero diagonal element.

Video 00:31:58: Classroom blackboard writing

Video 00:31:58 | Approximately corresponding to Section 6 “6. Example 2: A rank 1 matrix”.

7. What SVD really means: a set of correct basis for four fundamental subspaces

Both examples point to the same thing: SVD selects exactly the “correct” set of basis for the four basic subspaces.

  • v1,…,vr\boldsymbol v_1,\dots,\boldsymbol v_r: line space C(AT)C(A^{\mathsf T}) The orthonormal basis of ;
  • u1,…,ur\boldsymbol u_1,\dots,\boldsymbol u_r: column space C(A)C(A) The orthonormal basis of ;
  • vr+1,…,vn\boldsymbol v_{r+1},\dots,\boldsymbol v_n: null space N(A)N(A) The orthonormal basis of ;
  • ur+1,…,um\boldsymbol u_{r+1},\dots,\boldsymbol u_m: left null space N(AT)N(A^{\mathsf T}) the orthonormal basis of .

The numbers of the four sets of vectors are r,r,n−r,m−rr,r,n-r,m-r: Two groups v\boldsymbol v(rr individual and n−rn-r ) put together to form Rn\mathbb{R}^n A set of complete orthonormal bases, two sets of u\boldsymbol u(rr individual and m−rm-r ) put together to form Rm\mathbb{R}^m a complete set of orthonormal basis.

“Correct” has two meanings. The first level is standard orthogonality: This level of Gram-Schmidt orthogonalization has been achieved long ago, and any set of basis can be ground into orthogonality. The second level is to let AA Diagonalization: AviA\boldsymbol v_i only ui\boldsymbol u_i direction component, v\boldsymbol v There is no coupling between u\boldsymbol u There is no coupling between them, and the entire transformation graph only remains rr independent stretching directions that do not interfere with each other. The second layer cannot be provided by Gram-Schmidt and must rely on eigenvalues: vi\boldsymbol v_i is ATAA^{\mathsf T}A eigenvector, ui\boldsymbol u_i is AATAA^{\mathsf T} eigenvector. The relationship between the four subspace dimensions that appeared repeatedly in the previous lectures r+r+(n−r)+(m−r)=m+nr+r+(n-r)+(m-r)=m+n, only here we have a set of specific vectors that are orthogonal to each other to realize.

This is where SVD fits into the overall curriculum. It is not another computing technique, but a solution that preserves the two previously conflicting goals of “diagonalization” and “orthonormal basis” by allowing different bases to be used on both sides. It is in this sense that it is the last and most complete matrix factorization in this course.

Video 00:37:26: Classroom blackboard writing

Video 00:37:26 | Approximately corresponding to Section 7 “7. The true meaning of SVD: a set of correct basis for four basic subspaces”.

Official Handout Summary Page 4/4

MIT OCW Official Lecture Notes Summary Page 4/4 (18.06SC Lecture 29 Summary, CC BY-NC-SA 4.0).

Summary of this lecture

  • singular value decomposition (SVD) put any m×nm\times n The matrix is written as A=UΣVTA=U\Sigma V^{\mathsf T}, among which UU, VV is an orthogonal matrix, Σ\Sigma is m×nm\times n diagonal matrix, forward on the diagonal rr is a positive singular value.
  • Diagonalization A=SΛS−1A=S\Lambda S^{-1} in SS Composed of eigenvectors and usually not orthogonal; symmetric matrices have A=QΛQTA=Q\Lambda Q^{\mathsf T}, both sides of the symmetric positive timing share the same QQ, which is a special case of SVD. General matrices require two different sets of orthogonal basis.
  • Geometric meaning: AA Take the orthonormal basis of the row space v1,…,vr\boldsymbol v_1,\dots,\boldsymbol v_r sent to the standard orthogonal direction of the column space, satisfying Avi=σiuiA\boldsymbol v_i=\sigma_i\boldsymbol u_i, σi>0\sigma_i>0 in all directions Stretch ratio.
  • null space and left null space do not cause difficulties: just complete the bases on both sides, they correspond Σ\Sigma zero on, the dimensions are respectively n−rn-r with m−rm-r.
  • by ATA=VΣTΣVTA^{\mathsf T}A=V\Sigma^{\mathsf T}\Sigma V^{\mathsf T} eliminate UU, got VV The columns are ATAA^{\mathsf T}A The unit eigenvector and eigenvalue of are σi2\sigma_i^2; symmetrically, AATAA^{\mathsf T} composed of unit eigenvectors UU.ATAA^{\mathsf T}A It is positive semi-definite, so the eigenvalues are non-negative and the singular values take positive square roots.
  • Example 1 A=[44−33]A=\begin{bmatrix}4&4\\-3&3\end{bmatrix}: ATA=[257725]A^{\mathsf T}A=\begin{bmatrix}25&7\\7&25\end{bmatrix} Eigenvalue 32,1832,18, σ1=42\sigma_1=4\sqrt2, σ2=32\sigma_2=3\sqrt2; AAT=[320018]AA^{\mathsf T}=\begin{bmatrix}32&0\\0&18\end{bmatrix}, UU The second column of Av2=18 (0,−1)A\boldsymbol v_2=\sqrt{18}\,(0,-1) Set as (0,−1)(0,-1), got U=[100−1]U=\begin{bmatrix}1&0\\0&-1\end{bmatrix}.
  • Example 2 A=[4386]A=\begin{bmatrix}4&3\\8&6\end{bmatrix} Rank 1: ATA=[80606045]A^{\mathsf T}A=\begin{bmatrix}80&60\\60&45\end{bmatrix} The characteristic value of 125,0125,0, σ1=55\sigma_1=5\sqrt5, v1=(0.8,0.6)\boldsymbol v_1=(0.8,0.6), v2=(0.6,−0.8)\boldsymbol v_2=(0.6,-0.8), u1=(1,2)/5\boldsymbol u_1=(1,2)/\sqrt5.
  • A=σ1u1v1T+⋯+σrurvrTA=\sigma_1\boldsymbol u_1\boldsymbol v_1^{\mathsf T}+\cdots+\sigma_r\boldsymbol u_r\boldsymbol v_r^{\mathsf T}: AA is rr The sum of rank 1 matrices, the zero direction is σi=0\sigma_i=0 Eliminate.
  • SVD gives the orthonormal basis of four basic subspaces (the row space is v1..vr\boldsymbol v_1..\boldsymbol v_r, column space for u1..ur\boldsymbol u_1..\boldsymbol u_r, for null space vr+1..vn\boldsymbol v_{r+1}..\boldsymbol v_n, left null space is used ur+1..um\boldsymbol u_{r+1}..\boldsymbol u_m), this group of bases simultaneously AA into a diagonal matrix.

keywords

EnglishChineseOne sentence explanation
singular value decomposition (SVD)singular value decompositionWrite any matrix as UΣVTU\Sigma V^{\mathsf T}: Orthogonal on both sides, diagonal in the middle
singular valuesingular valueΣ\Sigma The diagonal element of is ATAA^{\mathsf T}A The positive square root of the eigenvalue, that is, the stretch factor in that direction
orthogonal matrixorthogonal matrixThe column vector is a standard orthogonal square matrix that satisfies QTQ=IQ^{\mathsf T}Q=I
diagonal matrixdiagonal matrixA matrix whose off-diagonal elements are all zeros
row spacerow spaceAA The subspace formed by each row has a dimension of rr
column spacecolumn spaceAA The subspace spanned by each column has a dimension of rr
nullspacenull spacesatisfy Ax=0A\boldsymbol x=\boldsymbol 0 The total vector of , dimension n−rn-r
left nullspaceleft null spacesatisfy ATy=0A^{\mathsf T}\boldsymbol y=\boldsymbol 0 The total vector of , dimension m−rm-r
orthonormalorthogonalPairs are orthogonal and both have lengths 11
stretching factorStretch ratioThe geometric meaning of singular values: the proportion of elongation or flattening in that direction
positive semidefinitepositive semidefiniteQuadratic constant nonnegative symmetric matrix, ATAA^{\mathsf T}A Must be of this type
rank-one matrixrank 1 matrixcan be written as uvT\boldsymbol u\boldsymbol v^{\mathsf T} matrix, each term of the SVD expansion
symmetric positive definitesymmetric positive definiteSymmetric and all eigenvalues are positive, at this time the two sets of bases of SVD can be combined into one

← Lecture 28 | Course Catalog | Lecture 30 →

Machine-assisted translation · Read Chinese original