9.78 min read
Computing SVD via Covariance Matrix
The algorithm for SVD via : (1) form ; (2) eigendecompose ; (3) set ; (4) compute for each nonzero ; (5) extend to orthonormal basis for zero .
This approach is preferred when (the covariance matrix is smaller than the Gram matrix). The result is the same full SVD regardless of which path is taken.
Formal View
Example 9.1 — SVD via Covariance — Algorithm
Given (), compute SVD via :
1. Form ().
2. Eigendecompose: , sort descending.
3. ; form matrix .
4. for ; extend for zero .
5. Verify: .
Interactive Visualization
Matrix Product — Column Perspective
Why This Matters
Knowing how to compute SVD from either or allows choosing the smaller matrix to reduce computational cost.
- Word embeddings: tall matrices (many words, few documents) use covariance path.
- Scientific computing: matrices use the Gram path.
- MATLAB's `svd(A)` internally uses an optimized algorithm.
Quiz
Question 1
For a matrix , which is more efficient?
Question 2
Both the covariance-path and Gram-path algorithms produce the same SVD.
Common Mistakes
- Computing when you want the Gram matrix — Gram is , covariance is .
- Not verifying at the end.