16.8 How Wrong Can the Answer Be
Chapter 3 solved
The answer turns out to be one number attached to
Throughout, matrices are complex, as
in Sections 4 to 7, and
16.8.1. A recurring product
Let
The condition number is the worst factor by which
Let
Clause by clause. The number is attached to
Before the examples, a small lemma that says what
Let
Idea. Both maxima and the minimum
exist by compactness, which is Lemma 16.3.1 and the same
argument with a minimum. After that it is one
substitution: as
Proof. The function
By Definition 16.3.2 and
homogeneity,
So
Some values, simplest first.
- The identity, and any unitary
matrix.
, so in every norm. For unitary , for every (Theorem 11.7.3), so every stretch is and by Lemma 16.8.1. These are the best-conditioned matrices there are. - A diagonal matrix. For
with all , and , so is the ratio of the largest to the smallest modulus. Thus . - A small matrix that is perfectly
conditioned.
has , a tiny norm, and . Being small and being ill-conditioned are unrelated. - A singular matrix, the degenerate
case:
by convention, consistent with Lemma 16.8.1, where the minimum stretch is .
Compute
Solution.
For
Warning. A large
The basic properties are all one line each, and the
third is the reason
Let
- (a)
; - (b)
; - (c)
; - (d)
, and for all unitary .
Proof.
(a)
, using Theorem 16.3.2 (c) and (d).(b)
, so by homogeneity .(c)
, so submultiplicativity (Theorem 16.3.2 (d)) gives .(d) By Theorem 16.3.3 (c),
. By Lemma 16.8.1, with , so it remains to see . Write (Theorem 13.8.1) and ; unitary matrices preserve (Theorem 11.7.3), so and . Then for , with equality at , that is at , the last column of . So . For the last claim, if then , and a product of unitary matrices is unitary, so this is a singular value decomposition of with the same : unitary factors do not change the singular values. This proves the proposition.
Part (d) is the reason
16.8.2. What the condition number predicts
The computation that opened the section is now a
theorem, together with the version where
Let
- (a)
(Perturbing
.) If , then and there are and for which equality holds. - (b)
(Perturbing
.) Let with . Then is invertible; and if , then
Idea. For (a), the displayed
computation at the head of the section, plus a choice of
the two vectors that makes both inequalities in it
equalities — and both are attained, because Lemma 16.3.1 says an
operator norm is a maximum and not a supremum. For (b),
factor
Proof. (a). Subtracting
For equality, use Lemma 16.3.1 twice. Choose a
unit vector
(b). Write
Since
The two bounds in (b) say the same thing differently.
The first is exact and needs nothing but invertibility,
but it measures the error against the computed
answer. The second measures it against the true answer,
at the cost of the factor
Quick check. Where in the proof of
(a) is the hypothesis
Solution. It is used to know
Now a case where the bound of (a) is not merely an
inequality. The point of computing the example exactly
is to see that
Let
Solution. Work with exact
fractions:
Check that
The two relative errors, in
Geometrically the example is Lemma 16.8.1 at work: the
two rows of
Warning. The condition
number bounds the error; it does not produce
it. Theorem 16.8.3 is a worst
case over all perturbations
16.8.3. Why the normal equations are worse
Chapter 11 §04 solved the least-squares problem
through the normal equations
Let
Idea. An SVD of
Proof. Write
The singular values of
Let
Solution.
What is proved here, and what is
not. Theorem 16.8.4 is a
statement about matrices: the matrix one forms
when one writes down the normal equations has the square
of the condition number of the matrix one started with.
Combined with Theorem 16.8.3, it says that
the linear system
Three things are not proved here, and all three belong to Chapter 24.
- The conditioning of the least-squares
problem itself is not
. The map from data to least-squares solution has a sensitivity that depends on , on the residual and on the angle between and ; when the residual is large, a term in appears even for the QR route. The bound above is about the linear systems being solved, not about the underlying fitting problem. - Nothing here is about arithmetic. A
condition number describes a problem, and an error bound
of the form “relative error
(relative perturbation)” only becomes a statement about a computation once one knows how large a perturbation the computation itself introduces. That requires a model of floating-point arithmetic and a backward error analysis, neither of which exists in this book yet. - Hence the comparison of the two
algorithms — that a stable implementation of
the QR route loses about
decimal digits while forming and solving the normal equations loses about — is still Chapter 24’s to prove. What this section supplies is the number that appears in both statements, and the reason a square appears in one of them.
16.8.4. Conditioning is a property of the problem
This is the last warning of the chapter, and it is the one readers most often need.
Warning. Conditioning
belongs to the problem; stability belongs to the
algorithm.
- A large
does not mean a computed answer is wrong. It means that the answer is not determined to high relative accuracy by data of limited accuracy — a statement about the information available, not about the arithmetic performed. If the data are exact and the arithmetic is exact, the answer is exact however large is. And even in inexact arithmetic, a good algorithm returns the exact answer to a problem whose data differ from yours by a rounding error, which is the most anyone can ask of it. - A small
does not make an algorithm trustworthy. An unstable method can wreck a perfectly conditioned problem all by itself, by introducing errors far larger than the data warrant; Exercise (C3: A well-conditioned problem and a bad method) gives an elementary example in which is below and a computed coordinate comes out as instead of .
Chapter 24 draws the distinction properly, defines
backward stability, and proves which of the algorithms
in this book have it. Until then, read
16.8.5. What this chapter has settled
Nine chapters wrote promissory notes that only a norm could pay. Here is the ledger, with the section that closed each entry.
- Chapter 11 §01 said that not every
norm comes from an inner product and that the
parallelogram law is the test. Section 1 proved it, in
Theorem 16.1.3, building on
the
case of Exercise (C1: The parallelogram law characterizes inner-product norms). - Chapter 10 §10 promised that this
chapter would prove
for the norm induced by any vector norm, and would recover as a limit built from the norms of the powers. Section 4 did both: Theorem 16.4.1 and Gelfand’s formula Theorem 16.4.4. The same section also gave the labeled definition Definition 16.4.1 that Chapter 10 used only in prose, and Corollary 16.4.5 restored Chapter 10’s convergence criterion with a rate attached. And Chapter 10’s entrywise convergence turned out to be the convergence, by Corollary 16.2.4. - Chapter 13 §08 and §12 asked,
twice, for a name for
. Section 3 supplied it — Definition 16.3.2 — and separated the name from the computation , which is Theorem 16.3.3 (c); Example (The oblique projection, finally measured) measured Chapter 13 §12’s oblique projection. The spectral norm that Chapter 13 §10 needed in order even to state the second half of its approximation theorem now exists; the theorem itself waits for Chapter 17, which proves it from the min–max description of the singular values. The version covering every unitarily invariant norm at once is Chapter 21’s. - Chapter 10 §09 promised a return to
with norms available, giving quantitative bounds in place of exact formulas. Section 6 gave them, in Theorem 16.6.1, and its Theorem 16.6.3 is the statement Chapter 12 §10 pointed at when it said that the consequence of stability for belonged to Chapter 16. - Chapter 12 §01 said that this chapter, “where matrices acquire norms and limits can be spoken of properly, runs arguments of exactly this shape”. Section 7 ran one: Corollary 16.7.5 and Corollary 16.7.6 turn “prove it for diagonalizable matrices, then take a limit” into three lines, and Example (Cayley–Hamilton, by a limit) is the demonstration.
- Chapter 11 §08 deferred its reason
for preferring
to the normal equations. Theorem 16.8.4 supplies the matrix half of it; the arithmetic half is Chapter 24’s, as listed above.
What the chapter has not done is equally
worth recording. It has not bounded how far an
individual eigenvalue moves under a perturbation — Example (A Jordan block’s eigenvalues move like
16.8.6. Exercises
A. Check your understanding
- (a) Define
, naming what it depends on besides . - (b) Explain why
for every invertible . - (c) Decide whether
each statement is correct, and justify: (i) “if
then any computed solution of has at most a few correct digits”; (ii) “if is small then any method of solving is reliable”. - (d) State what
is in terms of , and say what that has to do with the factorization.
Solution.
(a) See Definition 16.8.1:
, with for singular . Besides it depends on the choice of vector norm, through the operator norm it induces; , and are three different numbers.(b)
, by Theorem 16.3.2 (c) and (d). See Proposition 16.8.2 (a).- (c)
- (i) Incorrect.
bounds the effect of a perturbation of the data; with exact data and exact arithmetic the answer is exact. It says that the answer cannot be determined to high relative accuracy from inaccurate data, which is a statement about the problem, not a verdict on a computed answer. (ii) Incorrect. Conditioning is a property of the problem and stability a property of the algorithm; a small leaves an unstable method free to introduce errors of its own.
- (i) Incorrect.
(d)
for of full column rank (Theorem 16.8.4). The normal equations form and so solve a system with the squared condition number, while the route of Chapter 11 §08 never forms that product and keeps .
B. Practice
For
Solution.
Let
- (a) Solve
exactly. - (b) Compute both
relative errors in
and the factor between them, and compare with .
Solution.
(a) With
from Example (A system where the bound is attained) and , Check: and in the second coordinate.(b)
, and . The factor is , which is below by a factor of about . The bound holds, as Theorem 16.8.3 (a) requires, and is not attained: this is not the worst direction, which Example (A system where the bound is attained) found.
Let
- (a) Compute the
singular values of
and . - (b) Compute
and directly, and confirm Theorem 16.8.4. - (c) Does
also square? Compute and compare with of the square matrix .
Solution.
(a)
, whose eigenvalues are and ; so , and .(b)
is diagonal with positive entries, so its singular values are and and , as Theorem 16.8.4 says.(c) For a diagonal matrix every
is the ratio of the largest to the smallest modulus on the diagonal, so while ; here the squaring happens in too. It does not in general: Theorem 16.8.4 is stated for , and the proof uses singular values, which only sees. Exercise (C1: Changing the norm changes , but not much) bounds how far the other condition numbers can stray.
C. Going deeper
Let
- (a) Prove that
for every . - (b) Deduce that
and for every invertible . - (c) Using
, bound in terms of for , and check the bound on the matrix of Exercise (B1: Three condition numbers).
Solution.
(a) Let
. Then using the two inequalities and Theorem 16.3.2 (a) for . Taking the maximum over , which is by Definition 16.3.2 and homogeneity, gives the claim.(b) Apply (a) to
and to and multiply: . The reverse follows by symmetry, since the hypothesis also reads , whose ratio of constants is again .(c) With
and , we have and , so and . For : and , and indeed and . Both bounds hold, with room to spare; the point is only that no choice of norm can turn a well-conditioned matrix into an ill-conditioned one.
Let
- (a) Prove that every
singular
satisfies - (b) For the
-norm, prove that equality is achieved: exhibit a singular with . Hint: use a singular value decomposition and delete one term. - (c) Hence interpret
in one sentence, and say what it gives for the matrix of Example (A system where the bound is attained).
Solution.
(a) Put
, so is singular. If then would be invertible, by Theorem 16.5.1 and the fact that a product of invertible matrices is invertible; so . By Theorem 16.3.2 (d), , that is . Dividing by ,(b) Let
(Theorem 13.8.1) with , and put Then is singular, since is and are invertible; and , whose singular values are those of — for any , is similar to , so unitary factors leave the singular values alone, invertible or not — the largest of them being ; so by Theorem 16.3.3 (c). Since , the ratio is , matching (a) with equality.(c)
is the relative distance, in the -norm, from to the nearest singular matrix. For , whose is the ratio of the eigenvalues of the symmetric , one gets , so a relative perturbation of about suffices to make singular. Ill-conditioned means nearly singular, in exactly this quantitative sense.
Consider the two-by-two system
- (a) Show that
, so that the problem is well conditioned. - (b) Solve the system exactly.
- (c) Eliminate
using the first equation as the pivot row, rounding every intermediate quantity to significant decimal digits, and compare the result with (b). Then do the same after exchanging the two equations, and say what the exchange achieved. - (d) What does this
show about the relationship between
and the accuracy of a computed answer?
Solution.
(a) Write
. Then and The largest absolute row sum of is , and that of is , so by Theorem 16.3.3 (b),(b) Subtracting the first equation from the second gives
, so Both coordinates are to fourteen decimal places.(c) Without the exchange. The multiplier is
, and the second equation becomes Both sides need fifteen significant digits to be recorded exactly, so at twelve digits both round to , and the computed is exactly — accurate, as it happens. Back-substitution into the first equation then gives against a true value of : every digit is wrong. The damage was done by subtracting two numbers that agree in all twelve retained digits, so that the difference retains none of them.With the exchange. Pivoting on
, the multiplier is and the second equation becomes . At twelve digits both coefficients round to , giving , and back-substitution gives . Both agree with (b) to all twelve digits. The exchange achieved one thing: it made the multiplier at most in modulus, so nothing in the elimination was amplified, and no large quantity was ever created to be subtracted from a comparable one. This is why every practical elimination scheme chooses the largest available pivot.- (d) The conditioning
of the problem is excellent,
, and it is the same for both computations, since it does not mention a method. Yet one method returns and the other returns the right answer. Conditioning bounds what any method can promise; whether a given method keeps that promise is stability, and it is Chapter 24’s subject.