Singular value decomposition, and the best low-rank approximation it provides.
What you will be able to do
Given a small matrix, the learner can compute its singular values from , construct the right and left singular vectors, verify the factorisation, read the rank and the four subspaces off it, and give the best low-rank approximation with its error.
Orientation
Diagonalization asks whether a map is a pure scaling in one basis. For a rectangular matrix the question does not apply, because input and output are in different spaces. For a defective square matrix the answer is no.
A weaker question always has a positive answer. Every real matrix, including rectangular, singular and defective ones, acts as a pure scaling from one orthonormal basis to another.
The result includes a ranked list. The singular values, in decreasing order, give how much the map stretches along each of a set of orthogonal directions. Keeping the largest few and discarding the rest gives the best approximation of that rank. Compression, denoising and principal component analysis are built on this property.
Figure
Singular values as the semiaxes of the image ellipse
₁₂
The image of the unit circle under A is an ellipse
The grey circle is every unit vector; the blue curve is its image under .
Under an invertible linear map of the plane, the image of the unit circle is an ellipse, and the singular values are the lengths of its semiaxes: here and , the square roots of the eigenvalues of . This is invertible.
That is the decomposition read geometrically, for this map. turns the circle onto the axes treats specially, stretches along them by and , and turns the result into place.
What this picture does not show: what happens when a singular value is zero, or when is rectangular. Those cases are real and the theorem covers them, but nothing here depicts them. The definition and theorem blocks establish them.
Definition
The role of , and non-uniqueness of the SVD
Why the construction starts with . Suppose the factorisation exists. Then
using . That is a diagonalization of with eigenvalues and eigenvectors the columns of . So the right singular vectors and the squared singular values are forced. They are not a choice, they are read off a symmetric matrix that is guaranteed to be diagonalizable.
The guarantee comes from being symmetric, which the spectral theorem handles, and positive semidefinite: , so no eigenvalue is negative and every square root is real.
Why works. These are orthonormal when :
which is 0 for and 1 for . The definition divides by so that the result has norm 1. It therefore cannot be used when , and those columns of are instead filled by extending to an orthonormal basis.
What is unique and what is not. The singular values are unique, including their multiplicities, and they are always nonnegative and conventionally listed in decreasing order.
The singular vectors are not. Replacing by leaves unchanged, so sign flips are always available, but they must be made in matched pairs, since flipping only would change without changing . When a singular value repeats, any orthonormal basis of its subspace will serve, so there is a continuum of valid answers.
The practical consequence: an answer that differs from a reference by signs, or by a rotation within a repeated singular value's subspace, may be entirely correct. The verification decides the question, not agreement with a printed table.
Shapes. For of size : is , is , is . The reduced form keeps only the first columns of and and the block of , which is what the rank-one expansion uses and what an implementation returns by default.
Theorem
Existence, and the best low-rank approximation
Theorem (existence). Every real matrix has a singular value decomposition.
Proof. is symmetric, so by the spectral theorem it has an orthonormal basis of eigenvectors with real eigenvalues . Each is nonnegative, since . Order them decreasingly and set , with of them nonzero.
For define ; the calculation in the definition block shows these are orthonormal. Extend to an orthonormal basis of , which is possible because any orthonormal set extends.
Now check by applying both sides to each . For : the right side gives , and the left gives by definition. For : , so , and the right side is also zero. Two linear maps agreeing on a basis are equal.
Nothing in the argument assumed square, invertible, or diagonalizable, which is why the decomposition exists for every real matrix.
Theorem (Eckart–Young). Let and let be the sum truncated after terms. Then among all matrices with ,
is the minimum of , and likewise in the spectral norm where the minimum is .
Why the error takes that form. The rank-one pieces are mutually orthogonal in the Frobenius inner product , because the are orthonormal and so are the . The discarded terms therefore contribute their squared norms additively, and . So truncation is a projection, and the error is the length of what was projected away. The same Pythagorean statement as in the orthogonality unit, one level up.
Corollary (rank). is the number of nonzero singular values, since and no smaller truncation reproduces it.
Corollary (invariants)., and for square , . The second because with the orthogonal determinants equal to . Both serve as cheap checks on a computed decomposition.
Procedure
Computing an SVD by hand
Form . It is , symmetric, and positive semidefinite.
Find its eigenvalues and orthonormal eigenvectors . These are the columns of .
Take , in the same order. Let be the count of nonzero ones.
For , set . These are automatically orthonormal.
If , extend to an orthonormal basis of for the remaining columns of .
Assemble, and with matching index order.
Verify for each , which is cheaper than multiplying out and catches the same errors.
Choosing or . Both give the same nonzero eigenvalues. Use whichever is smaller: for a matrix, is and is . Starting from gives the directly, and then .
Checks worth running.
Check
Cost
one pass over the entries
(square )
one determinant
, in decreasing order
inspection
count of nonzero equals the rank
compare with a row reduction
The first two catch most arithmetic slips before any singular vector is computed, and they cost far less than discovering the error at step 7.
The rank-one expansion. Once assembled,
where each is an outer product. A full matrix of rank 1, not a scalar. Truncating after terms gives the best rank- approximation, with Frobenius error .
Why this route is for hand computation only. Forming squares the condition number, so small singular values are computed with badly degraded accuracy. Numerical libraries bidiagonalise directly and never form the product. The mathematics is identical; the arithmetic is not.
Worked example
A full decomposition, verified twice
Step 1: form .
Symmetric, as it must be.
Step 2: its eigenvalues. Trace 50, determinant , so . The discriminant is , giving
Step 3: the singular values.
Check before going further.. And . Both hold, so the singular values are right whatever happens next.
Step 4: right singular vectors. For : , giving . For : , giving . Normalising,
orthonormal since .
Step 5: left singular vectors.
Orthonormality., and each has norm .
Step 6: assemble.
Step 7: verify. and . Similarly . Multiplying out returns exactly.
The rank-one expansion.
That is , the best rank-1 approximation of . The error is
exactly as Eckart–Young predicts: discarding one term costs the singular value discarded, and no other rank-1 matrix does better.
A note on signs. Choosing instead would give with both signs flipped, and the products would be identical. An answer differing from this one by matched sign flips is correct; what is not correct is flipping one of a pair without the other.
Example
Four matrices diagonalization could not handle
A rectangular matrix. is , so it has no eigenvalues, compares a vector in with one in . It has singular values regardless: , so , , and the rank is 2. The third right singular vector spans the kernel.
A singular square matrix. has . Its has trace 25 and determinant 0, so eigenvalues 25 and 0, giving and . One nonzero singular value, so rank 1, and indeed exactly, with zero approximation error.
A defective matrix. The shear is not diagonalizable over any field, as the diagonalization unit showed. It still has a singular value decomposition: , trace 19, determinant , so , giving and , both positive. The singular values are their square roots, and , whose product is .
This is the sharpest contrast available: a matrix with one eigenvector and two singular directions.
A rotation. has no real eigenvalues. Its , so both singular values are 1. It stretches nothing, which is exactly what a rotation does. Every orthogonal matrix has all singular values equal to 1, and conversely.
Rectangular, singular, defective, and eigenvalue-free over : each defeats diagonalization for a different reason, and none defeats the SVD. The decomposition asks only that be symmetric and positive semidefinite, which it is for every real matrix without exception.
Non-example
Five errors about singular values
Taking singular values to be eigenvalues. For the eigenvalues are 3 and 3; the singular values are , roughly 3.54 and 2.54. They are different quantities: , not . They coincide only when is symmetric positive semidefinite, and then only because .
Expecting negative or complex singular values. A matrix with eigenvalues and has singular values 2 and 5; a rotation with eigenvalues has singular values 1 and 1. Singular values are square roots of nonnegative numbers and are always real and nonnegative, which is why they measure stretching rather than describing dynamics.
Concluding that a defective matrix has no decomposition. Diagonalization fails for the shear above; the SVD does not. The existence proof needs only that is symmetric and positive semidefinite, which holds for every real matrix. "Not diagonalizable" and "no SVD" are unrelated claims, and the second is never true.
Flipping one singular vector without its partner. Replacing by while leaving alone breaks and the factorisation no longer reproduces . Sign freedom is real but paired: both members of flip together, because the outer product must be unchanged.
Treating the decomposition as unique. With a repeated singular value, any orthonormal basis of that subspace serves, so two correct answers may share no singular vectors at all. The identity matrix has and every orthonormal pair is a valid choice. Comparing an answer against a reference by matching vectors is therefore the wrong check; verifying is the right one.
What separates these. The first three mistake the SVD for diagonalization and import its limitations. The last two mistake a construction with genuine freedom for one with a single answer. Both errors are caught by the same habit: verify the factorisation rather than the vectors.
Optional enrichment (1)
Application
Compression, and principal components
Storing less. An matrix holds numbers. Its rank- truncation holds , singular values plus vectors of each length. For a image that is a million numbers against about 20,000 at , a fiftyfold reduction.
The singular value spectrum indicates whether truncation is useful. If onward are tiny relative to , the discarded terms contribute little and the reconstruction is close. If the spectrum is flat, every direction contributes equally and truncation loses information. Plotting against therefore makes any low-rank structure visible.
The error is known before the truncation is computed. By Eckart–Young, keeping terms costs exactly in Frobenius norm, so can be chosen to meet a stated tolerance without trying any reconstruction.
Principal component analysis. Centre a data matrix , observations as rows, variables as columns, so each column has mean zero. Then is the sample covariance matrix, and the right singular vectors of are its eigenvectors.
Those vectors are the principal components: is the direction along which the data varies most, the most variable direction orthogonal to it, and so on. The variance along is , so the singular values rank the directions by how much of the spread each explains.
Projecting the data onto the first components is the rank- truncation. PCA is therefore the SVD of the centred data matrix. The fraction of variance retained is
What the technique does not supply. Centring is required. The SVD of an uncentred matrix finds directions dominated by the mean rather than the variation. Scaling matters too: variables in different units make the covariance meaningless, so columns are usually standardised, and that choice changes the components. A component is a direction in the original variables, not a cause or a named factor. Interpreting as a meaningful quantity is an inferential step that the algebra does not justify.
Other uses of the same decomposition. The condition number measures how sensitive a linear system is to perturbation. The pseudoinverse is formed by inverting the nonzero singular values. It gives the minimum-norm least-squares solution for any . This includes rank-deficient matrices, for which the normal equations have no unique solution.
Next step
Practice The Singular Value Decomposition
Practice records what support you used, so the evidence reflects how you actually performed.