Skip to content
StackDecode
AI & ML Atlas
Machine LearningalgorithmAnimated walkthrough

Singular Value Decomposition (SVD)

Factors any matrix into rotations and stretches, enabling low-rank approximation.

The idea

Every matrix A can be written A = UΣVᵀ, where Σ holds non-negative "singular values" in decreasing order. Keeping only the k largest gives the best rank-k approximation of A. For an image, a few singular values already reproduce most of the picture.

A = UΣVᵀ, Aₖ = Σᵢ₌₁ᵏ σᵢuᵢvᵢᵀ

Watch it run

The pipeline lights up one step at a time. Use the controls to pause or step through it.

  1. 1Compute the singular values and vectors of A.
  2. 2Sort singular values from largest to smallest.
  3. 3Keep the top k and drop the rest.
  4. 4Rebuild A ≈ Σᵢ σᵢ uᵢ vᵢᵀ.

A = UΣVᵀ, Aₖ = Σᵢ₌₁ᵏ σᵢuᵢvᵢᵀ

1/4

Step by step

  1. 1Compute the singular values and vectors of A.
  2. 2Sort singular values from largest to smallest.
  3. 3Keep the top k and drop the rest.
  4. 4Rebuild A ≈ Σᵢ σᵢ uᵢ vᵢᵀ.

Where it is used

Compression, recommender systems (matrix factorisation), PCA, latent semantic analysis.

Watch out for

Full SVD is costly for huge matrices; randomised methods are used instead.

Related