The singular value decomposition writes any m×n matrix as A = UΣVᵀ, where U and V are orthogonal and Σ is diagonal with non-negative entries σ₁ ≥ σ₂ ≥ … called the singular values. To compute it by hand, find the eigenvalues and orthonormal eigenvectors of AᵀA (these give σᵢ² and the columns of V), then set uᵢ = Avᵢ/σᵢ. Unlike diagonalisation, it works for every matrix, square or not, and it is the tool behind least squares solvers, image compression and principal component analysis.
What the three factors mean
Read A = UΣVᵀ from right to left as three simple moves applied to a vector:
- Vᵀ rotates (or reflects) the input so the special input directions v₁, v₂, … line up with the axes.
- Σ stretches along each axis by σ₁, σ₂, … (and drops or pads dimensions if A is not square).
- U rotates the result into the output directions u₁, u₂, ….
So A sends the unit sphere to an ellipsoid whose semi-axes have lengths σ₁, σ₂, … in the directions u₁, u₂, …. The key identity behind every computation is
Avᵢ = σᵢuᵢ
Many first courses reach the SVD at the end; at the University of Illinois, for example, MATH 257 "Linear Algebra with Computational Applications" includes eigenvalues and the SVD. If you want this taught against your own syllabus, our online tutoring for linear algebra page explains how sessions with Ajay Vatsyayan work.
The hand method
- Compute AᵀA (n×n, symmetric).
- Find its eigenvalues λᵢ ≥ 0 in decreasing order. Then σᵢ = √λᵢ.
- Find orthonormal eigenvectors vᵢ of AᵀA. These are the columns of V.
- For each σᵢ > 0, set uᵢ = Avᵢ / σᵢ. These are automatically orthonormal.
- If U needs more columns (when m is larger than the number of nonzero σ's), complete it with an orthonormal basis of the null space of Aᵀ.
If A is wide (m < n), it is often quicker to start from the smaller matrix AAᵀ, get U first, and use vᵢ = Aᵀuᵢ / σᵢ.
Example 1: a full 2×2 SVD
Let A = [[2, 0], [3, 2]].
Step 1. AᵀA = [[13, 6], [6, 4]].
Step 2. Trace 17, det 52 − 36 = 16, so λ² − 17λ + 16 = (λ − 16)(λ − 1). The singular values are σ₁ = 4 and σ₂ = 1.
Step 3. For λ = 16: AᵀA − 16I = [[−3, 6], [6, −12]] gives (2, 1), so v₁ = (2, 1)/√5. For λ = 1: [[12, 6], [6, 3]] gives (1, −2), so v₂ = (1, −2)/√5.
Step 4. Av₁ = (4, 8)/√5, so u₁ = (1, 2)/√5. Av₂ = (2, −1)/√5, so u₂ = (2, −1)/√5.
So U = (1/√5)[[1, 2], [2, −1]], Σ = diag(4, 1), V = (1/√5)[[2, 1], [1, −2]]. Multiplying UΣVᵀ gives back [[2, 0], [3, 2]].
Two checks: σ₁σ₂ = 4 = |det A|, and σ₁² + σ₂² = 17 = 2² + 0² + 3² + 2², the sum of the squared entries.
Notice that A is triangular with eigenvalues 2 and 2, yet its singular values are 4 and 1. Eigenvalues and singular values are different things unless the matrix is symmetric with non-negative eigenvalues.
Example 2: a wide 2×3 matrix
Let B = [[1, 1, 0], [0, 1, 1]]. Work from the 2×2 matrix BBᵀ = [[2, 1], [1, 2]], which has eigenvalues 3 and 1 with eigenvectors (1, 1) and (1, −1).
σ₁ = √3, σ₂ = 1, u₁ = (1, 1)/√2, u₂ = (1, −1)/√2
Now vᵢ = Bᵀuᵢ / σᵢ:
v₁ = (1, 2, 1)/√6, v₂ = (1, 0, −1)/√2
V must be 3×3, so complete it with a unit vector in the null space of B. Solving Bx = 0 gives (1, −1, 1), so v₃ = (1, −1, 1)/√3. Σ is 2×3: [[√3, 0, 0], [0, 1, 0]].
The number of nonzero singular values is the rank (here 2), and the extra columns of V span the null space: the rank–nullity theorem read straight off the decomposition.
Example 3: a rank-one matrix in one line
Let C = [[2, 4], [1, 2], [2, 4]]. Every row is a multiple of (1, 2), so C = (2, 1, 2)ᵀ(1, 2), an outer product.
For any outer product xyᵀ, the only nonzero singular value is ‖x‖‖y‖, with u₁ = x/‖x‖ and v₁ = y/‖y‖. Here ‖(2, 1, 2)‖ = 3 and ‖(1, 2)‖ = √5, so
σ₁ = 3√5, u₁ = (2, 1, 2)/3, v₁ = (1, 2)/√5
Spotting rank one saves the whole eigenvalue calculation.
Example 4: the closest rank-one approximation
The SVD splits A into a sum of rank-one layers:
A = σ₁u₁v₁ᵀ + σ₂u₂v₂ᵀ + …
Keeping only the first k layers gives the closest rank-k matrix to A (the Eckart–Young theorem), and the error in the 2-norm is σₖ₊₁.
For A = [[2, 0], [3, 2]] from Example 1:
A₁ = 4u₁v₁ᵀ = (4/5)[[2, 1], [4, 2]] = [[1.6, 0.8], [3.2, 1.6]]
A − A₁ = [[0.4, −0.8], [−0.2, 0.4]], whose largest singular value is exactly 1 = σ₂.
This is image compression in miniature: store a few σ's and vectors instead of every entry.
Example 5: the pseudo-inverse and the shortest solution
For B in Example 2, the system Bx = (3, 3) has infinitely many solutions. The pseudo-inverse B⁺ = VΣ⁺Uᵀ, where Σ⁺ inverts each nonzero σ, picks the one of smallest length. Here
B⁺ = (1/3)[[2, −1], [1, 1], [−1, 2]]
and B⁺(3, 3) = (1, 2, 1). Check: B(1, 2, 1) = (3, 3). Every other solution is (1, 2, 1) + t(1, −1, 1), and since (1, 2, 1)·(1, −1, 1) = 0, adding any multiple of the null vector only makes it longer.
For a tall matrix with independent columns, the same formula gives the ordinary least squares solution, which is why numerical libraries solve least squares with the SVD when A is close to rank-deficient. Our walkthrough of Gram–Schmidt and least squares covers the normal-equation and QR routes.
Example 6: norm and condition number
From Example 1, the unit circle maps to an ellipse with semi-axes 4 and 1. Two facts follow at once:
- ‖A‖₂ = σ₁ = 4: no unit vector is stretched by more than 4, and v₁ achieves it.
- Condition number = σ₁/σₙ = 4: relative errors in b can be amplified up to four times in the solution of Ax = b.
A matrix with σ's 1000 and 0.001 is technically invertible but numerically fragile, and only the SVD shows that clearly.
SVD or eigendecomposition?
| Eigendecomposition A = PDP⁻¹ | SVD A = UΣVᵀ | |
|---|---|---|
| Which matrices | Square, and only if diagonalisable | Every matrix, any shape |
| Diagonal entries | Eigenvalues, may be negative or complex | Singular values, real and ≥ 0 |
| Outer factors | P, usually not orthogonal | U and V, always orthogonal |
| Input and output bases | Same basis on both sides | Different bases, v's in and u's out |
| Typical uses | Powers, dynamics, differential equations | Rank, least squares, compression, PCA |
For a real symmetric matrix the two nearly coincide: the singular values are the absolute values of the eigenvalues. See orthogonal diagonalisation for that case.
Where students lose marks
- Forgetting the square root. The eigenvalues of AᵀA are σ², not σ.
- Finding U and V separately. Eigenvectors of AAᵀ and AᵀA are each fixed only up to sign, so independent choices can break A = UΣVᵀ. Get V first, then uᵢ = Avᵢ/σᵢ.
- Wrong order. List σ's in decreasing order and keep the columns of U and V in the same order.
- Wrong shape of Σ. Σ is m×n, the same shape as A, with zeros padding the extra rows or columns.
- Skipping the completion step. If A is tall or rank-deficient, U or V needs extra orthonormal columns from a null space.
- Treating singular values as eigenvalues. Example 1 shows they differ; only for symmetric positive semidefinite matrices are they the same.
- Unnormalised vectors. U and V must have unit columns, or the product will be off by constant factors.
Practice questions
- Find an SVD of [[3, 0], [0, −2]].
- Find the singular values of [[4, 1], [−1, 4]] and explain the answer geometrically.
- Find the nonzero singular value and the vectors u₁, v₁ of [[1, 1], [2, 2], [2, 2]].
- Compare the eigenvalues and singular values of [[1, 2], [0, 1]].
- Find the closest rank-one matrix to S = [[3, 1], [1, 3]] and the 2-norm error.
- A 5×3 matrix has singular values 6, 2 and 0. Give its rank, the dimension of its null space and its 2-norm.
Answers.
- U = I, Σ = diag(3, 2), V = diag(1, −1). (The minus sign goes into V or U, never into Σ.)
- AᵀA = 17I, so both singular values are √17: the matrix is √17 times a rotation.
- σ₁ = 3√2, u₁ = (1, 2, 2)/3, v₁ = (1, 1)/√2.
- Eigenvalues 1 and 1; singular values √2 + 1 and √2 − 1 (about 2.414 and 0.414). Their product is 1 = det.
- σ's are 4 and 2 with v₁ = u₁ = (1, 1)/√2, so the approximation is [[2, 2], [2, 2]] with error 2.
- Rank 2, null space dimension 1, 2-norm 6.
Where the SVD leads next
The SVD is where linear algebra meets computation. Principal component analysis is the SVD of a centred data matrix; recommender systems and latent semantic analysis use truncated SVDs; numerical analysis uses it for rank, conditioning and stable least squares. Our guide to the linear algebra machine learning actually uses shows these links with small examples. If the eigenvalue steps above felt slow, revisit our step-by-step eigenvalues and eigenvectors, and for the idea of one map written in two different bases, see the matrix of a linear transformation.
How Maths Bodhi helps
SVD questions combine three earlier skills, eigenvectors, orthonormal bases and matrix shapes, so one weak link spoils the answer. In online sessions we take your own course problems, rebuild the method with you, and review your attempts so each check becomes automatic. We explain and practise; we don't complete graded work. Students on a US degree can see our college maths tutoring.
Home tuition is available in Gurgaon (Gurugram). Students elsewhere in India and abroad learn with us online. You can book a free demo class.
Written and checked by the Maths Bodhi team (November 2026).
Frequently asked questions
- What is singular value decomposition in simple terms?
- It writes any matrix as a rotation, then a stretch along perpendicular axes, then another rotation: A = UΣVᵀ.
- How do you calculate SVD by hand?
- Find eigenvalues and orthonormal eigenvectors of AᵀA to get σᵢ = √λᵢ and V, then set uᵢ = Avᵢ/σᵢ.
- What is the difference between SVD and eigenvalue decomposition?
- SVD exists for every matrix and uses two orthogonal bases; eigendecomposition needs a square diagonalisable matrix and one basis.
- Are singular values always positive?
- They are always real and non-negative; zero singular values correspond to the null space, and the count of nonzero ones is the rank.
- Why is SVD used in machine learning?
- It gives principal components, low-rank approximations and stable least squares solutions, all central to data analysis.
- Is SVD unique?
- The singular values are unique; the vectors are unique up to sign when the σ's are distinct, and less so when some repeat.
