Singular Value Decomposition

Every matrix, however ugly, is a rotation then a stretch then another rotation. Step through the three and watch it happen.

Singular Value Decomposition

This module needs JavaScript: the numbers are computed in the page rather than recorded.

Worth knowing

Any matrix factors as A = U Σ V': rotate, stretch along the axes, rotate again.
The singular values in Σ are the stretch factors, always non-negative and always in descending order.
Unlike eigenvectors, an SVD exists for every matrix — non-square ones included.
The condition number is the largest singular value divided by the smallest. Large means the matrix is near-singular.

Overview

The factorisation

Every real m × n matrix A can be written as A = UΣVᵀ. The columns of U and V are orthonormal directions; the nonnegative diagonal entries of Σ are singular values, ordered from largest to smallest. Right singular vectors in V describe input directions; the matching columns of U show their output directions.

A = UΣVᵀ

A vector along a right singular direction is mapped to the matching left direction, scaled by its singular value. A zero singular value marks a collapsed direction. Unlike eigendecomposition, SVD applies to rectangular matrices and does not require the matrix to be symmetric.

In this guide
  1. Low-rank approximation
  2. Read the three stages of the decomposition
  3. Try this above
  4. Sources and next steps

Singular Value Decomposition

SVD factors any real matrix into rotations or reflections and axis-wise scaling, exposing its most important directions.

Low-rank approximation

Keeping only the k largest singular values gives the best rank-k approximation to A in the usual Frobenius and spectral norms. This supports compression and denoising, but small singular values are not automatically noise: choosing k requires evidence from the data and task. The rank is the number of nonzero singular values (or values above a numerical tolerance).

For a small example, A = [[3, 0], [0, 1]] already has singular values 3 and 1: its first axis is stretched three times as much as the second. See rank, projections, and PCA.

Read the three stages of the decomposition

For A=UΣVᵀ, Vᵀ first expresses an input in orthogonal right-singular directions. Σ scales each coordinate by its nonnegative singular value. U then expresses the output in orthogonal left-singular directions. For A=diag(3,1), the first axis is stretched by 3 and the second by 1. If a singular value is zero, its input direction is lost. Singular vectors can change sign in a computed decomposition without changing A, so their sign alone is not meaningful.

Keeping the k largest singular values gives the best rank-k approximation in Frobenius and spectral norm. This can compress an image or reduce a data matrix, but “small” singular values are not automatically noise; choosing k depends on the task and validation. For a covariance matrix, PCA directions are related to the right singular vectors of centred data, and explained variance is proportional to squared singular values. SVD works for rectangular matrices and is more robust than forming AᵀA to obtain eigenvectors, though large decompositions can still be computationally expensive. Rank is the count of nonzero singular values in exact arithmetic; numerical software uses a tolerance.

Try this above

Reduce the number of retained singular directions and compare the reconstructed matrix with the original. Observe which structure disappears first.

The largest singular value is the maximum amount by which A can stretch a unit vector; the smallest nonzero singular value describes the least-stretched retained direction. Their ratio is the 2-norm condition number for a full-rank square matrix. A very small singular value means some directions are nearly collapsed, so solving Ax=b can amplify measurement error. Truncating such directions may stabilise a model, but it also discards information. Inspect the singular-value spectrum and validate the chosen cutoff rather than treating the smallest values as automatically irrelevant.

Sources and next steps

Check yourself

0 of 3

Answer without scrolling back up.

  1. What shape does the unit circle become under any 2x2 matrix?

  2. What does a large condition number tell you?

  3. Why is the SVD preferred over an eigendecomposition?

Cheat sheet

Singular Value Decomposition

Factor any matrix into U, Sigma and V-transpose. Truncate to k components and watch the low-rank reconstruction improve as k increases.

MATHS · vizlearn.in/maths/singular_value_decomposition.html

About the author

Ashish Jangra builds and maintains VizLearn. Every module here is written and the visualisation behind it hand-built, so the numbers in a readout come from the same code that draws the picture. Corrections are genuinely welcome and get priority over everything else — if a page states something wrong, or an animation misrepresents what the algorithm does, get in touch.

Teaching a course with this? Individual teachers can use it freely; for a whole department or programme, see institutional licences.