The compact singular value decomposition writes a
matrix as a sum of rank-one pieces arranged in
decreasing order of size. A sum can be cut short. This
section shows that cutting it short after terms produces the
best approximation to by a matrix of rank
, measured in the
Frobenius norm, and that the error it leaves is a
quantity we can write down before doing any work. One
theorem answers three questions at once: how to compress
a matrix, which -dimensional subspace
best fits a cloud of data, and how far a given matrix is
from being singular.
Throughout, or , , , , and are the singular values of (Definition 13.9.1), so
that exactly for . We fix a singular value decomposition (Theorem 13.9.1) and
write for the columns of and for the columns of .
Cutting
the sum short
Multiplying out column by
column gives the rank-one expansion the second equality because the terms with
have ; this is the
compact form Theorem 13.9.3. Each
summand is a matrix of rank one, and the coefficients
decrease. The natural thing to do with such a sum is to
keep the large terms and discard the small ones.
Keep the first rank-one pieces and
throw the rest away.
Definition
13.11.1 (Truncated singular value
decomposition)
For , the rank- truncation of
relative to the
chosen singular value decomposition (Theorem 13.9.1) is
with ; for we set .
Two clauses need comment. The subscript counts
terms kept, not rows and columns: is the same size as
, not a submatrix
of it. (Section 1 used for the top-left
corner;
that meaning is gone for the rest of this section.) And
the definition says “relative to the chosen
decomposition”, because Theorem 13.9.2 leaves
the unitary factors some freedom, and different choices
can give different truncations. Everything proved below
holds for every choice; the warning at
the end of the section shows that the dependence is
real.
The rank of
is exactly : the vectors are orthonormal, hence independent,
so the columns of span once the vanishing terms
are dropped.
Example
(Truncating a diagonal matrix)
Let . Write down and .
Solution. A diagonal matrix with
positive decreasing entries is already in the form with
, so
and . Hence Truncation of a diagonal matrix is just
deleting its smallest diagonal entries. Everything in
this section is this statement, conjugated by two
unitary matrices.
The first thing to compute is how much was thrown
away.
Lemma
13.11.1 (The Frobenius norm counts singular
values)
Let have singular values . Then (the first identity is the one
Section 9 already obtained, recorded here with a label
because the proof of the main theorem uses it
repeatedly) for every .
Proof. The Frobenius norm does not
see unitary factors (Lemma 11.7.5), so
from , The only nonzero entries of are
on the diagonal, so .
For the second identity, subtract the first terms of the rank-one
expansion: where is with its first
diagonal entries
replaced by .
Applying the first identity to this matrix — the display
is a singular value decomposition of it in the sense of
Theorem 13.9.1, up to
reordering the diagonal — gives .
So the truncation error is decided in advance by the
singular values, and it is small exactly when the
discarded
are small. The content of the section is that no other
matrix of rank
does better.
Quick check. A matrix has singular
values .
What is the smallest for which the relative
error is at most ?
Solution. By Lemma 13.11.1, . For the error squared is , so the
relative error is , too big. For the error squared
is , and . So . Note that the test is on the
squares: halving the error means keeping three
quarters of .
How much
a subspace can hold
The proof of the theorem needs one inequality, and it
is the only place where any work happens. The question
it answers is: if we are allowed to keep only an -dimensional subspace of
, how much of
can we capture?
The answer is , and the best subspace is
the span of the leading left singular vectors.
Lemma
13.11.2 (An orthonormal list captures at most
the leading singular values)
Let with singular values , extended by for . Let be an orthonormal list in , so that . Then
Idea. Write each in the
orthonormal basis . The quantity
then becomes , so the total
is with weights . Two facts pin the weights down:
each ,
because the are
orthonormal and Bessel’s inequality applies to ; and , because
each is
a unit vector. A weighted sum of a decreasing sequence
with weights in that sum to is largest when the
first weights are
— which is the
last display of the proof.
Proof. If both sides are
empty sums, so assume . Fix
and put for , so that
the -th entry of
is
. Since and is unitary, hence an
isometry (Definition 11.7.2,
Theorem 11.7.3),
because multiplies
the -th entry by
and
discards the entries beyond the -th, which is the same
as using there. Summing over and exchanging the two
finite sums,
Now bound the weights. Since and
is an orthonormal list, Bessel’s
inequality (Theorem 11.9.1)
applied to the vector gives Since is an orthonormal
basis of , Parseval’s identity
(Theorem 11.9.2)
gives for
each , and
therefore Finally, using
together with for , and together with for , This is the stated inequality.
Equality is attainable: take
for . Then
by the rank-one expansion,
so and the two sides agree. The lemma
is the extreme case of a family of statements about sums
of the largest eigenvalues of a Hermitian matrix;
Chapter 17 develops the family through the
Courant–Fischer min–max theorem, of which the inequality
above is the crudest and most useful consequence.
The
Eckart–Young theorem
Now the theorem. Read it as a statement about a
minimization problem: over the set of matrices of rank
at most — which
is not a subspace, so no earlier optimization theorem
applies to it directly — the minimum of exists,
is attained at a matrix we can write down, and has a
value we already computed.
Theorem
13.11.3 (Eckart–Young Theorem, Frobenius
case)
Let with singular values , and let . Then for every
with , and equality holds for . In words: the
truncation
minimizes over all matrices of rank at most , and the minimum value
is .
Idea. The difficulty is that is an arbitrary matrix
of rank , and
there is no formula for such a thing. The rescue is to
stop looking at
and look only at its column space , a subspace of
dimension .
① Every column of lies in , so column by column
the Best Approximation Theorem says cannot beat , the matrix
obtained by projecting every column of onto . So it suffices to
minimize over subspaces. ② For a subspace, Pythagoras
splits the error into “all of ” minus “the part captures”, and the
captured part is exactly the quantity Lemma 13.11.2 bounds.
③ The bound is , and subtracting it from
leaves ,
which Lemma 13.11.1 says is
exactly what
achieves.
Proof. Step 1: reduce to a
projection. Let have rank and put , so . Write and for the columns of and of . By the definition of
the Frobenius norm, summing squares of entries column by
column, Each lies in , so Theorem 11.3.5
gives for every , where is the orthogonal
projection onto
(Definition 11.3.2),
identified throughout with its matrix in the standard
basis of . Hence
the last equality because the -th column of is .
Step 2: what a subspace captures.
Choose an orthonormal basis of . For each , the vectors and are
orthogonal, so Theorem 11.1.3
gives , and summing over , By Theorem 11.3.3 (a),
,
whose summands are pairwise orthogonal, so Theorem 11.1.3
gives .
Exchanging the sums, where the last equality holds because is the -th entry of the row
vector , whose
entries are the conjugates of those of .
Step 3: apply the bound. By Lemma 13.11.2 and
, and since
all , Combining the three steps with (Lemma 13.11.1),
Equality. The matrix has rank , and
by Lemma 13.11.1. So the
lower bound is attained, and it is the minimum. This
proves the theorem.
Three remarks are worth extracting. First, the
theorem is a genuine minimum, not an infimum: the
minimizing matrix is exhibited. Second, the minimum
value depends on
only through its singular values, so it is unchanged if
is replaced by
with unitary. Third, the case reads: the
Frobenius distance from to the matrices of
rank is
, the
smallest nonzero singular value. Exercise C1 turns that
into a statement about how far an invertible matrix is
from being singular.
A worked
example
Example
(The best rank-one approximation of a 3 × 2
matrix)
Let Find the best rank-one approximation of in the Frobenius norm,
and compute the error in two ways.
Solution. Singular values and
vectors. Since has more rows than
columns, work with the matrix whose eigenvalues are and with orthonormal
eigenvectors Hence and , and the left singular vectors are : (Both are unit vectors, as they must be: and .)
The approximation. By Theorem 13.11.3 the
answer is . The scalar in
front is , so It has rank one, its two columns being equal
and nonzero.
The error, twice. Directly, From the theorem, the error squared is . The two
agree. As a further check, and , as Lemma 13.11.1
requires; the relative error of the rank-one
approximation is .
Best-fitting subspaces
Step 1 of the proof did more than its job. It showed
that the optimal
may be taken of the form , and Steps 2 and 3
identified the best . That identification is
a theorem in its own right, and it is the statement
people mean when they speak of fitting a low-dimensional
structure to data.
Corollary
13.11.4 (The best-fitting subspace)
Let be the columns of , and let . Among all
subspaces with , the total squared distance is smallest for , and its
smallest value is .
Proof. By Definition 11.3.3,
, so as in Step 1 of Theorem 13.11.3. Since
, the theorem gives . For the columns are orthonormal, so Theorem 11.3.3 (a)
gives using , which is the rank-one
expansion read one row at a time. Hence .
What this is used for, honestly. Two
applications are within reach of what we have proved,
and a third is not.
The first is compression. Storing
costs numbers; storing as costs
. When
is much smaller
than and that is a large saving,
and Theorem 13.11.3 says
no other rank-
object stored the same way is closer to in the Frobenius norm.
The relative error is , computable before
choosing . Whether
that error is acceptable is not a mathematical
question.
The second is principal components.
Take data points
in and place
them as the columns of . Then Corollary 13.11.4
says: the -dimensional subspace
through the origin that minimizes the total squared
distance to the data is spanned by , the leading left singular vectors.
These directions are the principal
components of the data, and the numbers measure how
much of
each one accounts for. That is a theorem of linear
algebra, and it is the whole of what this book has
proved.
What is not proved here is the statistics.
The usual procedure subtracts the mean of the data
first, so that
becomes a sample covariance matrix, and then interprets
as a fraction of variance explained. Those steps need a
probabilistic model, a reason to prefer squared error,
and an argument that the sample answer says something
about a larger population. Chapter 24 §10 supplies the
first two — the model for the finite population of the
data themselves, where expectation is an average and no
measure theory is needed, and three reasons to prefer
squared error — and says plainly that the third belongs
to probability and statistics, which this book does not
develop. It also says why a singular value decomposition
is never computed by forming and finding its
eigenvalues, the route taken in every hand computation
in this chapter; the algorithm that replaces it is
assembled nowhere in this book.
Warning. The truncation is
optimal for this norm, and low rank does not mean
small. Two mistakes to avoid.
Other measures of error give other answers.
Let , so , , and , whose error matrix has a largest
entry of modulus .
The rank-one matrix has , so , and every
entry of
has modulus at most . So beats if the error is
measured entrywise. It loses in the Frobenius norm, as
it must: .
Small rank and small size are unrelated. The
all-ones
matrix has rank
and , while
has
rank and , as small as we like.
“Approximating by a matrix of low rank” is a statement
about structure, never about magnitude.
Exercises
A. Check your
understanding
Exercise
(A1)
- (a) State the
Eckart–Young Theorem, including the value of the
minimum.
- (b) Express in terms of
the singular values of .
- (c) Let . What is
for , and what is the
minimum of over in that case?
- (d) True or false:
the truncation
is the unique matrix of rank at most nearest to in the Frobenius norm.
Justify your answer.
- (e) A matrix of rank
is close to in the Frobenius norm.
True or false? Justify your answer.
Solution.
(a) For
with singular values and : every with satisfies
, with
equality for .
(b) (Lemma 13.11.1).
(c) , since the
terms with
are zero; the minimum is , attained at itself, which has
rank .
(d) False in
general. Take , so . Both and
have rank , and , which is the minimum
. (Both
are truncations of , for two different
singular value decompositions.)
(e) False. Rank
is unrelated to size: the all-ones matrix has rank
and .
B. Practice
Exercise
(B1: Errors from the singular values alone)
A matrix has
singular values .
- (a) Compute and the
minimum of over matrices of rank at most , for .
- (b) Find the
smallest for
which the relative error is at most .
Solution.
(a) , so . By Theorem 13.11.3 the
minima are for .
(b) The condition
is . For the left side is
; for
it is . So .
Exercise
(B2: A best rank-one approximation)
Let . Find the singular values of , the best rank-one
approximation
in the Frobenius norm, and the error, computed both
directly and from the theorem.
Solution. is symmetric with
eigenvalues and
(trace , determinant ) and orthonormal
eigenvectors , . Both eigenvalues are positive, so , and has
eigenvalues and
; hence , , with .
Therefore which has rank one. Directly, From Theorem 13.11.3 the
error squared is . The two agree, and checks Lemma 13.11.1.
Exercise
(B3: Pythagoras for the truncation)
Let and . Prove that and deduce that is
nonincreasing.
Solution. By Lemma 13.11.1 applied
to and to , and by the
same lemma applied to , whose singular
values are followed by zeros (it equals with
the
matrix keeping only the first diagonal entries of
), Since and the
are
nonnegative, increasing by one removes a
nonnegative term, so the sequence is nonincreasing. This
proves both claims.
C. Going deeper
Exercise
(C1: How far is a matrix from being singular?)
Let be invertible, with singular values
.
- (a) Prove that for every singular .
- (b) Exhibit a
singular with
.
- (c) Deduce that the
distance from to
the set of singular matrices, measured in the Frobenius
norm, is exactly , and illustrate
this with .
Solution.
(a) A singular
has
(Theorem 7.5.3 (d)).
By Theorem 13.11.3 with
,
(b) Take . Its rank
is , so
it is singular, and by Lemma 13.11.1.
(c) By (a) the
distance is at least and by (b) it is
at most ,
so it equals ; in particular
the minimum is attained. For the given , Exercise B2 found
and
, which
is singular and at Frobenius distance . So no singular matrix
is closer to
than . The
smallest singular value is therefore a quantitative
version of invertibility: is invertible exactly
when , and it is far from singular exactly
when is
large.
Exercise
(C2: The best line through a cloud of points)
The four points and of are to be fitted by
a line through the origin, minimizing the total squared
distance from the points to the line.
- (a) Write the points
as the columns of a matrix and compute and the singular
values of .
- (b) Use Corollary 13.11.4 to
find the best line and the minimum total squared
distance.
- (c) Verify the
answer by computing the four distances directly.
Solution.
(a) With the
points as columns, The eigenvalues of are and (trace , determinant ), with orthonormal
eigenvectors and . The eigenvalues of are the squares
of the singular values, since ; hence and
.
(b) By Corollary 13.11.4 with
, the best
line is , the line , and the minimum
total squared distance is .
(c) The points
and
lie on , contributing . For , the projection
onto is
, so the distance squared is . The total is
, as predicted.
(The point
contributes nothing to any subspace through the origin;
it is there as a reminder that the corollary counts all
columns, including zero ones.)
Exercise
(C3: Truncation respects unitaries but not sums)
Let , and let and be unitary (orthogonal, when ).
- (a) Prove that is a best
rank-
approximation of in the
Frobenius norm.
- (b) Deduce that the
function is
unchanged by .
- (c) Give with
for every choice of the truncations
involved. Hint: two rank-one matrices whose sum is a
multiple of the identity.
Solution.
(a) If is a
singular value decomposition (Theorem 13.9.1), then
is one as well, since a product of unitary
matrices is unitary (Proposition 11.7.4
(a)) and is
unchanged. Its left and right singular vectors are and , so its
rank- truncation
for this decomposition is By Theorem 13.11.3
applied to , this is a
best rank-
approximation.
(b) The two
matrices have the same singular values, so by Theorem 13.11.3 both
minima equal .
(c) Take and
.
Each has rank one, so and for every singular value decomposition, and
.
But ,
whose rank-one truncations all have rank one, hence are
never . So
. Truncation is not a linear operation,
which is why “keep the biggest pieces” cannot be
analyzed one summand at a time.