Hello! Welcome back to our study of the Singular Value Decomposition.
In the previous lesson, we defined the SVD and its components: the singular values (), and the left and right singular vectors (the columns of and ). We established the crucial connection that these components are the eigenvalues and eigenvectors of the symmetric matrices and .
Today, we will move from theory to practice. Our goal is to use that connection to construct the full and reduced Singular Value Decomposition of a matrix. We will follow a concrete, step-by-step algorithm and work through a numerical example.
1. The SVD Construction Algorithm
Let's say we are given an matrix . We want to find the matrices , , and such that , where is orthogonal, is diagonal, and is orthogonal.
Here is a reliable procedure to find them:
-
Form or . A practical tip for your future work in computer science: choose the smaller of the two matrices to reduce computation. If is a "tall" matrix (), then () will be smaller than (). Let's assume for this algorithm we start with .
-
Find Eigenvalues and Eigenvectors of . Since is symmetric and positive semi-definite, it will have real, non-negative eigenvalues () and a corresponding set of orthonormal eigenvectors ().
-
Construct and .
- The matrix is formed by using the eigenvectors from Step 2 as its columns: .
- The singular values are the square roots of the eigenvalues: . By convention, we sort them in descending order, .
- The matrix is an matrix with these singular values on its main diagonal. The rest of its entries are zero.
-
Find the Left Singular Vectors for .
- Recall the key relationship from our last lesson: . For each non-zero singular value , we can find the corresponding left singular vector using the formula:
This gives us the first columns of , where is the rank of the matrix (the number of non-zero singular values).
- Recall the key relationship from our last lesson: . For each non-zero singular value , we can find the corresponding left singular vector using the formula:
-
Complete the Basis for . The vectors we found in Step 4 form an orthonormal set. If , the matrix is not yet complete. We need to find more orthonormal vectors that are orthogonal to the ones we already have. These additional vectors form an orthonormal basis for the null space of . You can find them by solving and using the Gram-Schmidt process on the resulting basis vectors.
-
Assemble the Full SVD. Combine the matrices you have found: .
2. A Step-by-Step Example
This process is best understood by walking through an example. The following video does an excellent job of applying this algorithm to a 3x2 matrix.
Singular Value Decomposition (SVD) | Step-By-Step Example and Explanation
This video from 'Understand The Math' provides a very clear, step-by-step computation of the SVD for a non-square matrix. It follows the exact algorithm we just outlined.
Watch the video from the beginning (0:21) to the end (18:20). Pay close attention to how each matrix (Σ, V, and U) is constructed. Notice how the video first finds V from AᵀA, then finds the first two columns of U using the A*v_i formula, and finally finds the last column of U from the null space of Aᵀ.
Let's summarize the key steps from the video's example with matrix (Note: The video uses a slightly different matrix, but the process is identical).
- Step 1: Form , which is a matrix.
- Step 2: Find its eigenvalues and orthonormal eigenvectors .
- Step 3: Construct and , a matrix with on its diagonal.
- Step 4: Find and .
- Step 5: Since is , must be . We need one more vector, . This vector is found by solving and normalizing the result.
- Step 6: Assemble .
Test your understanding!
In the SVD algorithm, why do we use the eigenvectors of for and the eigenvectors of for ? Could we swap them?
Show answer
No, we cannot swap them. The dimensions must match. Let be an matrix.
- is . Its eigenvectors are -dimensional, which matches the dimension of the columns of (an matrix).
- is . Its eigenvectors are -dimensional, which matches the dimension of the columns of (an matrix).
The decomposition only works if has the correct dimensions to be a basis for the input space of .
3. Full vs. Reduced SVD
The decomposition we just constructed is known as the full SVD. It results in square orthogonal matrices and . However, notice that if , the bottom rows of are all zeros. When we multiply , these zero rows in will effectively nullify the last columns of .
This observation leads to a more compact and often more useful version called the reduced SVD (sometimes called "economy SVD").
In reduced SVD, we trim the matrices to remove the parts that get multiplied by zero.
-
If : We keep only the first columns of and the top block of .
-
If : We keep only the first columns of and the left block of .
The image below gives a nice visualization of this "trimming" process for the case.

The following reading provides a concise summary of the full and reduced SVD, along with another numerical example.
Singular Value Decompositions - CS 357
These lecture notes from a computer science course at UIUC clearly define and illustrate the Reduced SVD, contrasting it with the Full SVD we've just built.
Please read the section titled 'Reduced SVD'. Focus on the diagrams and the definitions of the matrix dimensions for both the 'm >= n' and 'm <= n' cases.
Let's apply this to the example from the video. The full SVD had:
- :
- :
- :
The reduced SVD for this case would be:
- : (the first two columns of the full )
- : (the top square part of the full )
- : (the same as the full )
The reduced SVD is computationally more efficient and is the version returned by default in many numerical libraries like NumPy.
Conclusion
Today, we've bridged the gap from theory to practice by developing a concrete algorithm for computing the SVD of any matrix.
Key Takeaways:
- The SVD can be constructed by finding the eigenvalues and eigenvectors of (or ).
- The Full SVD produces square orthogonal matrices and , but often involves padding with rows or columns of zeros.
- The Reduced SVD is a more compact form that eliminates the zero-padding in and the corresponding unnecessary vectors in or , resulting in a more computationally efficient representation.
- The general algorithm is:
- Calculate eigenvectors () of to form .
- Calculate singular values () to form .
- Calculate the initial left singular vectors using .
- If necessary, complete the basis for with vectors from the null space of .
Preview of the Next Lesson:
Now that we can define and construct the SVD, our next lesson will delve deeper into its profound geometric meaning. We will explore how can be interpreted as breaking down any linear transformation into a sequence of a rotation, a scaling, and another rotation, which is a foundational concept for understanding its power in both deep learning and quantum mechanics.