SVD Step-by-Step Calculator

Enter a matrix up to 4×4. Computes U, Σ, VT via the Jacobi method. Shows every intermediate step and animates the geometric transformation on a unit circle.

Input Matrix A

What is Singular Value Decomposition?

Singular Value Decomposition (SVD) factors any real m×n matrix A into three matrices:

A = U · Σ · VT

where U is an m×m orthogonal matrix (left singular vectors), Σ is an m×n diagonal matrix of non-negative singular values (σ1 ≥ σ2 ≥ ... ≥ 0), and VT is the transpose of an n×n orthogonal matrix (right singular vectors).

Geometrically, every linear transformation can be decomposed into three steps: a rotation/reflection VT, a scaling along coordinate axes Σ, and another rotation/reflection U. This is why SVD is sometimes called the “anatomy of a matrix” — it exposes exactly how much a transformation stretches, shrinks, or reflects space in each independent direction.

How This Calculator Computes SVD

Step 1: Form ATA. This n×n symmetric positive semi-definite matrix has eigenvalues equal to σi2 (the squared singular values).

Step 2: Eigendecompose ATA. The eigenvectors become the columns of V. The singular values are σi = √λi.

Step 3: Compute U. For each non-zero singular value, ui = (1/σi)Avi. Remaining columns are found by completing to an orthonormal basis.

Step 4: Sort. Reorder columns/rows so σ1 ≥ σ2 ≥ ... ≥ 0.

This calculator uses the Jacobi eigenvalue algorithm for ATA, which iteratively applies Givens rotations to off-diagonal elements until convergence. It is numerically stable for matrices up to 4×4.

Applications of SVD

Low-rank approximation: Truncating to the top k singular values gives the best rank-k approximation of A in the Frobenius norm. This underpins image compression (keep top k modes), topic modeling (Latent Semantic Analysis), and recommendation systems (collaborative filtering).

Pseudoinverse: A+ = VΣ+UT, where Σ+ inverts only the non-zero singular values. This is the foundation of least-squares solvers when A is not square or not full-rank.

Condition number: κ(A) = σmaxmin. Large condition numbers signal near-singularity and numerical instability in linear solves.

PCA: The right singular vectors V of the centered data matrix are exactly the principal component directions. The singular values encode explained variance.

Frequently Asked Questions

What makes SVD different from eigendecomposition?

Eigendecomposition A = PDP-1 requires a square matrix and only exists when A has n linearly independent eigenvectors. SVD works for any m×n matrix, always exists, and the factor matrices U, V are always orthogonal. For symmetric positive definite matrices, SVD and eigendecomposition coincide with U = V.

Why are singular values always non-negative?

Singular values are defined as σi = √λi(ATA). Since ATA is positive semi-definite, all its eigenvalues λi are non-negative, and their square roots are real and non-negative. Any sign freedom is absorbed into the orthogonal factors U and V.

What is the relationship between SVD and rank?

The rank of A equals the number of non-zero singular values. If r singular values are non-zero, then A has rank r. Setting the smallest singular values to zero gives the best rank-k approximation by the Eckart–Young theorem. This is the mathematical basis of dimensionality reduction.

How does the animated unit circle visualization work?

A unit circle (all unit vectors in 2D) is drawn in grey. After the transformation A (using only the top-left 2×2 block), the circle maps to an ellipse — shown in pink. The ellipse axes correspond to the left singular vectors U scaled by the singular values σ. The three phases of the animation show: (1) VT rotating the unit circle, (2) Σ stretching it into an axis-aligned ellipse, and (3) U rotating it to the final position.

Can this calculator handle rectangular matrices?

Yes. SVD is defined for any m×n matrix, rectangular or square. When m ≠ n, U is m×m, Σ is m×n (with min(m,n) singular values on the diagonal), and V is n×n. This calculator supports up to 4×4 including all rectangular shapes like 2×3, 3×2, etc.

Built by Michael Lip. Try the ML3X Matrix Calculator for interactive step-by-step solutions.