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: , , general matrix , symmetric matrix . 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 inside, 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, upgrade to , , 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 Send it to a set of orthonormal basis in the column space; then translate this picture into a matrix equation ; then use with Calculate the bases on both sides respectively; finally use two numerical examples - one reversible 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 into a diagonal matrix.

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 , that is , so the symmetric matrix can be orthogonally diagonalized:
if Still righteous, The diagonal elements of are all positive. Rename the diagonal element, let , the same equation is read as
That is, “orthogonal × diagonal × orthogonal”, and both sides can be used same one . 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 , consists of eigenvectors, which are usually not orthogonal; therefore is not an orthogonal matrix, Nor can it be written as . 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. 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 the orthogonal matrix , the orthogonal matrix , and The diagonal matrix of , making ?
The answer is yes, and it holds for any matrix. Numbers on the diagonal All are positive and are called singular value. It should be reminded that singular values are generally not eigenvalues of 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 ). Precisely because of the change of objects, rectangular matrices and non-diagonalizable matrices are eligible to enter this framework.

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 A matrix is a Arrive 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. , the row space fills the column space one by one, and the dimensions on both sides are the same . 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 , through 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. . The only difference between the two sets of bases is a length factor:
That’s the direction Stretch ratio (stretching factor). in other words, 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 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 Keep it orthogonal” - this is a feature direction problem, to be precise The problem of feature direction is explained in the next section.
null space does not pose any trouble here. Base completion of row spaces: Take null space The orthonormal basis of send them all , 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: Take left null space the orthonormal basis of . These supplementary directions are in corresponding to the diagonal of , that is, “multiply by zero”. The only thing that really takes effort to find is Right: in row space and in column space , the dimensions on both sides are ;The dimension of the null space is , the left null space is .

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”.

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:
pairing relationship Matrix multiplication can be written in one go. Put the front first vectors arranged in columns:
No. on the left Column is , the right Column is , 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 (null space direction) and (Left null space direction) is also added in columns. left becomes , is Orthogonal matrix of ; the right side becomes , is is an orthogonal matrix, and is matrix, the upper left corner is a piece , the rest are all zeros:
Those added are listed on the right The zero blocks are multiplied out, so the equation is not violated. So get . is an orthogonal matrix, , multiply both sides by right , we get the final form of SVD:
This equation says three things. First, with 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, Diagonalized by these two sets of basis: only The component of the direction, there is no cross-term, that is with There is no coupling between with There is no coupling between them. Third, The shape is , rank is , 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|Approximately corresponding to Section 3 “3. Write it as a matrix equation: “Nearby.
4. use Ask for , use Ask for
with 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 ——Whenever you encounter a rectangular matrix, this combination will always appear - expand it according to SVD:
The key is in the middle: is an orthogonal matrix, , so The whole thing disappears. the rest is The diagonal matrix of , on the diagonal is , followed by A zero. So
This is a standard orthogonal diagonalization. Symmetrical in itself (), so there must be orthogonal eigenvector groups; the above formula shows that these eigenvectors are column, the corresponding eigenvalue is . In addition must be positive semi-definite, because for any ,
On the right is The inner product with itself, that is, its length squared, is always non-negative. So 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 , was eliminated, leaving behind :
thus The columns are unit eigenvector. The two matrices may be of different sizes ( is , is ), but their non-zero eigenvalues must be the same: if and , then
And guarantee , so Also eigenvalues. This means that two matrices can give the same batch reason.
The entire algorithm is therefore divided into three steps:
- Calculate , ask for it unit eigenvectors, arranged in columns ; Take the positive square root of the eigenvalues to get .
- Calculate , ask for it unit eigenvectors, arranged in columns .
- put placed in order On the diagonal of , the remaining positions are filled with zeros.
Step 3 is not as mechanical as it sounds: , , 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 matrix
take
It is reversible, , so the rank is , both row space and column space are the entire : To find two standard orthogonal Orthogonal to two standards .
The first step is to calculate :
The diagonal element is , the subdiagonal element is , the results are indeed symmetrical. shaped like The matrix has a ready-made rule: the eigenvectors are always with , the eigenvalues are respectively with . So here the eigenvector is , , the characteristic value is with . Direct calculation:
After unitization
The second step is to ask for , change calculation :
It happens to be a diagonal matrix, which is the luck of the example, and the eigenvectors are directly with , the eigenvalue is still with . Consistent with the statement in the previous section: with have the same non-zero eigenvalues. So
The third step is to put the three pieces together to verify. press Multiplied out is
The second line is the same as The second line of One symbol missing. The problem is not , The diagonal element of is inherently positive; neither the columns themselves, which are indeed unit eigenvector.
The crux is that the eigenvectors can only be determined to differ by one sign: with All About The unit eigenvector of , both methods are legal, It is still an orthogonal matrix. What really binds the two groups of bases together is the pairing condition . Check the second direction with this condition:
because . So Must take , instead of . After correction
Check one by one: Give the two numbers in the first row; , gives the second row. All matched.
This episode is worth remembering: the three pieces of SVD are not calculated independently and then assembled. with Each gives a set of eigenvectors, each with a signed degree of freedom; it must be used Pair them up and use Freeze symbol. corrected 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: .

Video 00:27:02|Approximately corresponding to Section 5 “5. Example 1: A reversible “Matrix”.

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 Strange:
The second row is twice the first row, rank . This reduces all dimensions: the row space is a line, i.e. all multiples of ; the null space is the perpendicular through the origin; two column vectors with All 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 , the remaining directions are given by completion.
Calculate first :
It is also of rank 1, each row is multiples. Find the eigenvalues: the trace is , a rank of 1 indicates that there is an eigenvalue , so the other one must be (The trace is equal to the sum of the eigenvalues). Therefore
Belong to The eigenvectors fall in the row space direction, that is direction; length is , unitized into
another eigenvalue The corresponding eigenvector is in the null space direction, and is taken as vertical unit vector
This side only needs one substantive direction: the column space is given by Zhang Cheng, unitized
Add another unit vector perpendicular to it , make up The orthonormal basis of:
Verify once. Calculate first , with Cancellation:
Take another right :
The first line is , the second line is ;The second column is because The second diagonal element of is , the entire column is multiplied.
This example makes the role of null space clear: with in multiplication is only Multiply, no matter how you take it, it doesn’t matter , you can choose freely. really decide only This group is the pair of directions in row space and column space. put Expanding by “column times row”, this will be more obvious:
every item is a rank 1 matrix, The sum of the terms spells out exactly ; The item disappears directly. The rank of example 2 is 1, itself is just one of them, which explains why its There is only one non-zero diagonal element.

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.
- : line space The orthonormal basis of ;
- : column space The orthonormal basis of ;
- : null space The orthonormal basis of ;
- : left null space the orthonormal basis of .
The numbers of the four sets of vectors are : Two groups ( individual and ) put together to form A set of complete orthonormal bases, two sets of ( individual and ) put together to form 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 Diagonalization: only direction component, There is no coupling between There is no coupling between them, and the entire transformation graph only remains independent stretching directions that do not interfere with each other. The second layer cannot be provided by Gram-Schmidt and must rely on eigenvalues: is eigenvector, is eigenvector. The relationship between the four subspace dimensions that appeared repeatedly in the previous lectures , 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 | Approximately corresponding to Section 7 “7. The true meaning of SVD: a set of correct basis for four basic subspaces”.

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 The matrix is written as , among which , is an orthogonal matrix, is diagonal matrix, forward on the diagonal is a positive singular value.
- Diagonalization in Composed of eigenvectors and usually not orthogonal; symmetric matrices have , both sides of the symmetric positive timing share the same , which is a special case of SVD. General matrices require two different sets of orthogonal basis.
- Geometric meaning: Take the orthonormal basis of the row space sent to the standard orthogonal direction of the column space, satisfying , in all directions Stretch ratio.
- null space and left null space do not cause difficulties: just complete the bases on both sides, they correspond zero on, the dimensions are respectively with .
- by eliminate , got The columns are The unit eigenvector and eigenvalue of are ; symmetrically, composed of unit eigenvectors . It is positive semi-definite, so the eigenvalues are non-negative and the singular values take positive square roots.
- Example 1 : Eigenvalue , , ; , The second column of Set as , got .
- Example 2 Rank 1: The characteristic value of , , , , .
- : is The sum of rank 1 matrices, the zero direction is Eliminate.
- SVD gives the orthonormal basis of four basic subspaces (the row space is , column space for , for null space , left null space is used ), this group of bases simultaneously into a diagonal matrix.
keywords
| English | Chinese | One sentence explanation |
|---|---|---|
| singular value decomposition (SVD) | singular value decomposition | Write any matrix as : Orthogonal on both sides, diagonal in the middle |
| singular value | singular value | The diagonal element of is The positive square root of the eigenvalue, that is, the stretch factor in that direction |
| orthogonal matrix | orthogonal matrix | The column vector is a standard orthogonal square matrix that satisfies |
| diagonal matrix | diagonal matrix | A matrix whose off-diagonal elements are all zeros |
| row space | row space | The subspace formed by each row has a dimension of |
| column space | column space | The subspace spanned by each column has a dimension of |
| nullspace | null space | satisfy The total vector of , dimension |
| left nullspace | left null space | satisfy The total vector of , dimension |
| orthonormal | orthogonal | Pairs are orthogonal and both have lengths |
| stretching factor | Stretch ratio | The geometric meaning of singular values: the proportion of elongation or flattening in that direction |
| positive semidefinite | positive semidefinite | Quadratic constant nonnegative symmetric matrix, Must be of this type |
| rank-one matrix | rank 1 matrix | can be written as matrix, each term of the SVD expansion |
| symmetric positive definite | symmetric positive definite | Symmetric and all eigenvalues are positive, at this time the two sets of bases of SVD can be combined into one |
Machine-assisted translation · Read Chinese original
