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 even make sense, input and output live in different spaces, and for a defective square matrix the answer is no.
Weaken the question and it always has an answer. Is the map a pure scaling from one orthonormal basis to another? Yes, for every real matrix without exception: rectangular, singular, defective, any shape at all.
What comes back is a ranked list. The singular values say how much the map stretches along each of a set of orthogonal directions, in decreasing order, so they measure how much of the matrix each direction accounts for. Keeping the largest few and discarding the rest gives the best approximation of that rank, which is why this decomposition underlies compression, denoising and principal component analysis.
Figure
The unit circle mapped to an ellipse with semiaxes the singular values
₁₂
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 .
The image of the unit circle under a linear map of the plane is always an ellipse, and the singular values are the lengths of its semiaxes: here and , the square roots of the eigenvalues of . This is invertible, so the ellipse is a genuine one.
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
Why , and what is not unique
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 precisely so the result has norm 1, which is why it is unavailable when , those columns of must be filled by extending to an orthonormal basis instead.
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.
Whether that is worth doing depends on the singular value spectrum. If onward are tiny relative to , the discarded terms carried little of the matrix and the reconstruction is close; if the spectrum is flat, every direction matters equally and truncation destroys information. The spectrum is therefore diagnostic before it is useful: plotting against says whether a low-rank structure exists at all.
The error is known in advance, which is the unusual part. 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, so PCA is the SVD of the centred data matrix, and 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. And 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 the algebra never licenses.
Other uses of the same decomposition. The condition number measures how sensitive a linear system is to perturbation. The pseudoinverse , formed by inverting the nonzero singular values, gives the minimum-norm least-squares solution for any , including rank-deficient ones, where the normal equations have no unique answer.