Section 2 solved by elimination: about operations,
an exact answer after finitely many of them, and a
factorization that fills in most of the zeros the matrix
had. For a large sparse matrix that is the wrong
bargain. This section builds two iterations that touch
only through the
product , for the case where is positive definite,
and counts what each of them buys. The first costs about
steps per
decimal digit of accuracy, the second about . Where that
square root comes from is the point of the section.
Throughout, is symmetric and positive
definite, , and is
the exact solution. Iteration indices are
superscripts in parentheses. We work over because the function
this section minimizes is built from , which over is not a real number;
everything below survives over with replaced by its
real part, and nothing else changes.
A linear
system is a minimization problem
Positive definiteness is a statement about the number
(Definition 13.1.1), so
it invites us to look for a quantity that the
solution makes small, rather than an equation the
solution satisfies. There is one, and it is the simplest
possible candidate: a quadratic minus a linear term.
Solving is the same as sitting at the bottom of a
bowl.
Definition
24.7.1 (The Energy Inner Product and the Energy
Norm)
Let be symmetric positive definite. The
energy inner product is and the energy norm is .
Two vectors are -orthogonal,
or conjugate, when .
This is the inner product of Chapter 13 §04, written
there as . It really is
one: it is bilinear because matrix multiplication is; it
is symmetric because the matrix equals its own
transpose ; and for is clause (P2) of Definition 13.1.1 in
its strict form. So is the
induced norm of Definition 11.1.3,
and every fact about norms and orthogonality from
Chapter 11 applies verbatim. That is the reason for
introducing it: it lets us reuse the Pythagorean theorem
in a geometry bent by .
The word energy comes from the springs of
Section 9, where is the
potential energy stored in a displacement .
Proposition
24.7.1 (The Solution Minimizes the Energy
Functional)
Let be symmetric positive definite, , and define
Then, with ,
In particular is the
unique minimizer of .
Proof. is invertible, since
has only
positive eigenvalues (Theorem 13.1.5, (a)
(b)),
so is
defined and . Expand, using : where the second line uses twice
and . The first two terms are . Putting gives
, so the leftover
constant is , which
is the identity. Since is a
norm, the right-hand side is with equality only
at .
This proves the proposition.
So every iteration below may be read twice: as an
attempt to solve a linear system, and as an attempt to
walk downhill on a bowl whose shape is . The identity also
tells us which error to measure. The natural yardstick
is not but , because that is the one the
algorithms actually make small.
Two quantities recur. The error is
and the
residual is , and they
are related by
(24.7.1)
The residual is computable and the error is not; Eq. 24.7.1 is the exchange
rate between them.
Steepest
descent
Fix and a
direction , and ask what happens along the line . Expanding and using ,
(24.7.2)
where . Since , the
right-hand side is a parabola in opening upwards, so it
has one minimum, at
(24.7.3)
Choosing this
way is an exact line search; it costs
one product .
Which should
we take? Read Eq. 24.7.2 for small : the decrease is to first
order, and among unit vectors the quantity is largest
exactly at , by Cauchy–Schwarz (Theorem 11.1.5)
with its equality case. So the residual is the direction
in which falls
fastest at the starting point, measured in the
ordinary Euclidean norm.
Warning. “Steepest” is a
statement about the first instant, not about the
step. The direction that minimizes over the whole line
is not but : with , Eq. 24.7.3 gives and , the exact answer in one step.
That direction is unavailable, because producing it
means solving the very system we are trying to solve.
Every method in this section is an attempt to
approximate cheaply.
Definition
24.7.2 (Steepest Descent)
Let
and ,
and let . Steepest descent is the
iteration: for , set ; if , stop,
since ; otherwise put
The denominator is positive because and , so is defined, and . One step
costs one matrix–vector product.
To see how fast this is we need one inequality, and
it is a statement about weighted averages, not about
matrices at all.
Lemma
24.7.2 (Kantorovich’s Inequality)
Let be symmetric positive definite with
eigenvalues . Then for every
,
Idea. In an orthonormal eigenbasis
both factors become weighted averages of the
eigenvalues, one of and one of , with the same
weights. The obstacle is that is not linear,
so the second average is not determined by the first. It
is, however, bounded by it: on the interval
the curve lies below the
straight line joining its endpoints. Replacing the curve
by that line makes the second average a linear function
of the first, and the product becomes a scalar quadratic
that we maximize by hand.
Proof. Write and . For every
with ,
because , and .
We may assume , the case being an equality , and by homogeneity
(both sides scale by under ) we may
assume .
By the spectral theorem (Corollary 12.5.2)
there is an orthonormal basis of
with .
Let
be the coordinates of in that basis, and put
. Then
by Parseval’s identity (Theorem 11.9.2),
every ,
and the second because . Since the are weights summing
to and every
, the number lies in . Averaging with the weights
, Hence . Finally, for any real
, and dividing by gives the bound. This
proves the lemma.
We also record the condition number in the form we
shall use it. For , Lemma 17.3.5 gives
, since all eigenvalues are positive;
the eigenvalues of are the , so the
same lemma gives . Hence, by Definition 16.8.1,
(24.7.4)
Theorem
24.7.3 (Convergence of Steepest Descent)
Let be symmetric positive definite with
, let , and let
be the steepest descent iterates. Then
for every for
which is
defined,
Idea. One step at a time. Write the
new energy-norm error in terms of the old one; the exact
line search makes the difference a single explicit
fraction, whose numerator and denominator are exactly
the three quantities Kantorovich’s inequality compares.
What comes out is ,
and that number is the square of .
Proof. It is enough to prove the
estimate for one step and then iterate. Fix and write , , and , and assume . By Eq. 24.7.1, , so using and . The new error is , so the second line because . Substituting collapses the last two
terms: where the last step divides and multiplies by
, which is non-zero because
. By Lemma 24.7.2 applied to
, so the bracket is at most the last equality on dividing numerator and
denominator by and using Eq. 24.7.4. Since , taking square
roots gives ,
and an induction on proves the theorem.
Example
(The bound is attained)
Let , and . Run three steps of steepest descent
and compare with Theorem 24.7.3.
Solution. Here and
, so the
bound’s factor is . The first
residual is so and , giving . Then
The two components of are again equal
in absolute value, so as well, and , . The squared
energy-norm errors are and each is exactly times the
one before. So the ratio is at every step:
the bound of Theorem 24.7.3 holds with
equality here, and no better constant is possible.
The picture behind the example is a staircase. On an
elongated bowl the steepest direction points across the
valley rather than along it, so the iterates cross and
re-cross. The residuals and in Example (The bound is attained)
are parallel: the method keeps searching in directions
it has already used.
Quick check. Show that consecutive
steepest descent residuals are always orthogonal, . What does that say about the shape of the
path?
Solution. , so by the choice of , writing . So each
step turns a right angle: the path is a staircase. In
two dimensions that forces every second direction to be
parallel, which is why Example (The bound is attained)
never escapes its worst case.
Conjugate
directions
The defect is now visible: each line search spoils
the minimality achieved along the previous direction. We
want directions for which a search along leaves the
earlier work intact, so that after steps the iterate is
optimal over the whole -dimensional affine
piece explored so far.
Read the requirement off the goal. Being optimal over
means, by Proposition 24.7.1, that
the error is -orthogonal to that
span; and one step changes the error by . So the
condition that preserves the earlier orthogonality is
that
itself be -orthogonal to . That is forced, not guessed. Which
conjugate directions? The cheapest answer: take the
residual and remove only what -orthogonality
forbids.
Definition
24.7.3 (The Conjugate Gradient
Iteration)
Let be symmetric positive definite, and . Set
For : if , stop. Otherwise put and . This is the
conjugate gradient iteration, or
CG.
A non-example, by dropping one
clause. Keep everything about the recursion and
only weaken to “symmetric and invertible”. Take Then and : the very first divides by zero,
and the iteration does not start. What failed is exactly
clause (P2) of Definition 13.1.1 in
its strict form, which is what guarantees for
. Symmetry
alone is not enough, and nor is invertibility; both Proposition 24.7.1 (the
bowl has a bottom) and Theorem 24.7.4 (the search
directions are usable) need definiteness.
Three remarks on the shape of the recursion. The
update of is not
a fresh evaluation of but a consequence of the update of ; the two agree, since
. Only one product is formed per
step, serving both and . And the new
direction corrects the residual by a multiple of the
single previous direction, not of all
of them — the surprise, and the reason CG is short.
Theorem
24.7.4 (Conjugate Gradients: Orthogonality and
Optimality)
Let ,
, , and
write for the Krylov subspaces of Definition 24.6.1, with
.
Suppose the iteration of Definition 24.7.3 has
produced non-zero . Then:
- (a)
are non-zero and pairwise -orthogonal, and every
and with is defined, with
;
- (b)
are pairwise orthogonal, and for every ;
- (c) , a
space of dimension ;
- (d) is the
unique minimizer of over the affine set .
Idea. Everything is one induction,
and the two coefficients are exactly what the induction
needs. Step has
to deliver two orthogonality relations: the new residual
against the old directions, and the new direction
against the old directions in the -inner product. The
first is forced by , the second by
, and each
forces it only against the latest predecessor;
the older ones come free, because is a
combination of and , and the new
residual is already orthogonal to both. Optimality (d)
is then the Pythagorean theorem, applied in the energy
inner product.
Proof. Parts (a), (b) and (c) are
proved together by induction on . Throughout, is used
silently to move
across a dot product, and directly from Definition 24.6.1.
Base . Here , so and is
defined and positive; that is (a). Part (c) is , which is Definition 24.6.1, and the
dimension is
because . For (b), a single vector is vacuously an
orthogonal list, and using , and
the definition of .
Inductive step. Assume (a), (b), (c)
for , and assume
,
so that and
are
formed. We prove (a), (b), (c) for .
Step 1: the residuals stay
orthogonal. By (b), is orthogonal
to , and by (c) that list spans the same
space as . Hence
for every ,
and with (b) this makes pairwise orthogonal.
Step 2: (c) for . From with , we get ,
and then as
well. Moreover the first equality because differs from
by a
multiple of , the second by
(c). By Step 1 the vectors are non-zero and pairwise
orthogonal, hence independent (Theorem 11.1.4), so
this common span has dimension . It sits inside , which is
spanned by
vectors and so has dimension at most ; equal dimensions
force equal spaces.
Step 3: , and
is
defined. By (b), , so Hence , so and is defined
and positive.
Step 4: (a) for . We must
show for . For , use : By Step 1 the first term is , and by the definition
of . The
two cancel exactly when ,
which is how was defined. For
, the term
vanishes by (a), and so by Step 1.
Step 5: (b) for . The first
half is Step 1. For the second, , so for , by and the
definition of ; and for
, by (b) and Step 4. This completes the
induction.
Proof of (d). By construction , which lies in by
(c). Let . By Eq. 24.7.1, , so for every , by (b). Now take any with
,
and write with . By the
Pythagorean theorem (Theorem 11.1.3) in
the energy inner product, with equality only for , that is only for
.
This proves the theorem.
Corollary
24.7.5 (Finite Termination)
In exact arithmetic the conjugate gradient iteration
reaches , and hence ,
for some .
If has only
distinct
eigenvalues, then .
Proof. Suppose
are all non-zero. By Theorem 24.7.4 (c), .
Since , this forces ; so the
residuals cannot all be non-zero for , and for some
. Then , so .
For the refinement, let be
the distinct eigenvalues and put . By Corollary 12.5.2,
with
orthogonal and
diagonal
carrying the eigenvalues, so , every diagonal entry of being at an eigenvalue. Hence
is a
combination of , so and
for every . If
were all non-zero we would get , a contradiction. So .
Example
(Two distinct eigenvalues, two steps)
Let , where is the all-ones
matrix, let and . Run CG.
Solution. has rows , , . Since and kills , the
eigenvalues of
are (once) and
(twice): . Also , so .
Step 0. , , , , so and Then and .
Step 1. The rows of applied to give , then , then ; so and . With this gives and
with . Two steps, as Corollary 24.7.5 predicts,
for a
system. Checks:
and .
Warning. Finite termination
is a theorem about exact arithmetic, and it is not how
CG is used. In the floating-point model of
Section 1 the computed residuals lose their
orthogonality, as the Lanczos vectors of Section 6 do.
The two algorithms are closely related: started from the
same and the
same vector they build bases of the same Krylov spaces,
and the tridiagonal matrix of Theorem 24.6.3 can be
assembled from the CG coefficients — which are
not the and of Theorem 24.6.3, those
being the entries of that tridiagonal matrix, but
different numbers. That correspondence, due to
Lanczos and to Hestenes and Stiefel, and the rounding
behavior it carries across, due to Paige and Greenbaum,
are described here and not proved; nothing in this
section depends on either. A run of CG on a
matrix of order is stopped after a
few hundred steps, and the theorem that matters is Theorem 24.7.7 below.
Chebyshev
polynomials
Theorem 24.7.4 (d) has an
equivalent form that turns the whole question of speed
into a question about polynomials, and that question has
a classical answer. We need one family of polynomials
and two facts about it.
The Chebyshev polynomials stay within on and then grow
geometrically outside it.
Definition
24.7.4 (Chebyshev Polynomials)
The Chebyshev polynomials are defined by
The name comes from Chapter 11. Its table at the end
of §10 lists the monic orthogonal
polynomial sequence of Definition 11.10.1
for the weight on , and the above are its members
rescaled — which is why the recurrence here is not the
one of Theorem 11.10.3,
that theorem being stated for the monic normalization,
where no factor
appears. The book has not proved that identification and
nothing below uses it. Here the recurrence is
the definition, and we prove what we need from it
directly. The first few are
We shall need the degrees, and the recurrence
supplies them by induction on . For and , , with
leading coefficient in both cases. Let
and suppose
and
with leading coefficient . Then has degree with leading
coefficient ,
while , so no cancellation is possible in
and with leading coefficient . Hence for every
, and since the doubling
gives
for .
The one trick in the subject is a change of variable.
Every complex number can be written as for
some : the
equation has two roots in , neither of them
since their
product is . In
that variable the recurrence becomes trivial.
Lemma
24.7.6 (Chebyshev Polynomials: Size Inside and
Growth Outside)
For every and every ,
(24.7.5)
Consequently:
- (a)
for every real , and ;
- (b) for every real
, and, separately, .
Idea. Under
the recurrence of Definition 24.7.4 says
nothing more than , which is true because the cross
terms cancel. The two facts are then two choices of
: on take , so
that and
are again on
the unit circle; outside, take real and greater than
, so that grows
geometrically.
Proof. The identity Eq. 24.7.5. Induct on
. For both sides are
, and for both are .
Assume the identity for and , with , and write .
Then which is , as required.
(a). Let and put . Then , so and (Theorem 0.6.2), whence
. By Eq. 24.7.5 and (Theorem 0.6.4), For
take , giving
.
(b). Let and put , a real number . Then so and .
Now Eq. 24.7.5 gives the
displayed formula. Both and are positive, so
dropping the second gives the displayed inequality. For
the separate bound, for every , because ;
applying this with gives . This proves the
lemma.
Warning. Part (a) is false
the moment leaves
, and
spectacularly so. is already
about , and
exceeds
.
That explosion is not a defect; it is the whole
resource. The polynomial in the next theorem is small
where the eigenvalues live and large at , and the ratio of the
two is what CG converts into speed.
The square
root
Theorem
24.7.7 (Convergence of Conjugate
Gradients)
Let be symmetric positive definite with
, let , and let
be the
conjugate gradient iterates from , with once the iteration has terminated.
Then for every ,
Idea. Three moves. ① Theorem 24.7.4 says the CG
error is the smallest among all errors reachable from
the Krylov space; writing out what “reachable” means
turns that into: the smallest value of
over polynomials
of degree
with . ② In
an eigenbasis that quantity is at most times the initial error, so
we need one polynomial that is at and small on . ③
Chebyshev’s polynomial, rescaled so that the interval
becomes , is
that polynomial, and Lemma 24.7.6 measures
it.
Proof. If then , so
by
the spectral theorem, and gives
and ;
the bound then reads for and
for , both
true. So assume . We may also assume the iteration has not
terminated before step , since once it has, the
left-hand side is .
Step 1: the error is a polynomial in applied to the initial
error. Write , so by Eq. 24.7.1. A vector of
has the form , and then
As the range over , ranges over
all polynomials of degree at most with . So Theorem 24.7.4 (d)
says
(24.7.6)
Step 2: one eigenbasis estimate. By
Corollary 12.5.2
take an orthonormal basis with
, and write . Then , so and .
Every
lies in , so with Eq. 24.7.6, for any
admissible ,
(24.7.7)
Step 3: the polynomial. Put The inner expression is an affine function of
carrying
to and to , so it maps
into ; and it
sends
to . By Lemma 24.7.6 (b), , so
is a well-defined
polynomial of degree at most , and .
By Lemma 24.7.6 (a),
Step 4: measuring . Since
,
so, using , By Lemma 24.7.6 (b), ,
so .
Feeding this into Eq. 24.7.7 proves the
theorem.
The square root is the whole gain. Take . Steepest
descent contracts by at most per
step, so reducing the energy-norm error by needs about steps; conjugate
gradients contracts by , and
already at .
Both cost one product with per step, so the ratio
of the counts is the ratio of the work.
Quick check. Why does the factor
in Theorem 24.7.7 cost so
little, and why is it there at all?
Solution. It costs little because
it is a constant against a geometric factor: absorbing
it changes the step count by ,
about steps out
of when . It is there
because the lower bound for in Lemma 24.7.6 (b) throws
away the term ; the surviving
is exactly
this .
The polynomial in Step 3 depends only on and , so one can
fix it in advance and update the iterates by
the recurrence of Definition 24.7.4. This is
the Chebyshev iteration. Three things
are said about it: that it attains the bound of Theorem 24.7.7 rather than
beating it; that it needs estimates of and which CG does
not; and that in exchange it forms no inner products,
which matters when the work is split across many
processors. None of the three is proved
here. The method and its analysis are due to
Golub and Varga, and nothing in this section depends on
them.
Since the cost is governed by , it pays to
replace
by an equivalent system of smaller condition number.
Choosing a symmetric positive definite close to , and writing , one applies
CG to whose matrix is symmetric positive definite
(Proposition 13.1.2)
and whose eigenvalues are the generalized eigenvalues of
the pencil of Definition 13.4.1, as
Exercise C3 below asks you to check. This is
preconditioning, and it is a subject
rather than a theorem: which to choose depends on
where came from,
and no theorem of linear algebra answers that. We state
the mechanism and stop.
Exercises
A. Check your
understanding
Exercise
(A1)
- (a) Define the
energy inner product of a symmetric positive definite
, and say which
clause of Definition 13.1.1
makes it an inner product.
- (b) State Proposition 24.7.1, and
explain in one sentence why it makes the
natural yardstick for the error.
- (c) State the
optimality property of the -th conjugate gradient
iterate, naming the set over which it is optimal.
- (d) Determine
whether the following statement is correct, and justify
your answer: in exact arithmetic, conjugate gradients
applied to a positive definite matrix with distinct eigenvalues
terminates after at most steps.
- (e) Write down the
two Chebyshev facts of Lemma 24.7.6, and say
which of the two supplies the in Theorem 24.7.7.
Solution.
(a) . Symmetry and bilinearity hold for
any symmetric ;
what makes it an inner product is for , which is clause (P2) of Definition 13.1.1 in
its strict form.
(b) , where
and .
So the energy norm of the error is the excess
of over its
minimum, up to the factor : it is the
quantity every descent method is built to
decrease.
(c) By Theorem 24.7.4 (d), is the unique
minimizer of over the affine set .
(d) Correct. By
Corollary 24.7.5 the
number of steps is at most the number of distinct
eigenvalues, here , and the order plays no part. The
proof is that for the degree- polynomial with the
distinct eigenvalues as roots, so the Krylov spaces stop
growing at dimension .
(e) on
, and for . The second
supplies the square root: at
the number equals ,
and the square root enters through .
B. Practice
Exercise
(B1: Steepest descent by hand)
Let , and .
- (a) Compute and by steepest
descent.
- (b) Compute for and compare
the ratios with the bound of Theorem 24.7.3.
Solution. Here and
, so the
bound’s factor is .
(a) , , , so and . Then . Now
and , so and
(b) The errors
are , , , with squared energy norms
The ratios are and , both well
below the bound’s .
The bound is not attained here because the initial
residual does not split its weight equally between the
two eigenvector directions, which is what equality in Lemma 24.7.2
demands.
Exercise
(B2: Conjugate gradients by hand)
Let , and . Run
conjugate gradients to termination, and verify at each
stage that the residuals are orthogonal and the
directions -orthogonal.
Solution. , so .
Step 0. ; ; ; . So , and Check: . Then , and Check: .
Step 1. , so
Then and Two steps for a system, which is what Corollary 24.7.5
allows.
Exercise
(B3: Chebyshev by recurrence)
- (a) Compute from Definition 24.7.4.
- (b) Evaluate , and , and check them
against Lemma 24.7.6 (a).
- (c) Evaluate from the
polynomial, and check it against the closed formula of
Lemma 24.7.6 (b).
Solution.
(a) , , , and
(b) ,
, . All three
have absolute value at most , as (a) of the lemma
requires, and the first is the equality .
(c) . By the closed formula
with , and , so
Expanding, , so the half-sum is . The two agree, and
the growth is visible: is at most on and already at .
C. Going deeper
Exercise
(C1: Sharpness of Kantorovich)
Let and let .
- (a) Prove that for
the
inequality of Lemma 24.7.2 is an
equality.
- (b) Hence deduce
that the constant in
Theorem 24.7.3 cannot be
replaced by any smaller one.
Solution.
(a) , , and . So the left
side is and the
right side is . They agree.
(b) Take , so that
,
and , so that . Then ,
which is the vector of part (a). By the proof of Theorem 24.7.3 the
one-step ratio is so the first step attains the bound exactly.
Moreover with
,
giving ; its two
components again have equal absolute value, so part (a)
applies to it up to sign and scale. That is enough:
replacing by
multiplies both
sides of Lemma 24.7.2 by , and changing the
sign of a coordinate changes neither side, since and are diagonal. So
every step attains the bound. Hence no constant smaller
than can
work. (Example (The bound is attained)
is the case ,
,
rescaled.)
Exercise
(C2: Finite termination, from polynomials)
Give a second proof of the second statement of Corollary 24.7.5 — that
distinct
eigenvalues force termination in at most steps — using Eq. 24.7.6 instead of a
dimension count. Hint: consider .
Solution. Let be
the distinct eigenvalues of ; all are positive, so
is defined, has degree , and satisfies . It is therefore
admissible in Eq. 24.7.6 with . By Step 2 of the
proof of Theorem 24.7.7, since every eigenvalue of equals some and so is a root of
. Hence and . (Eq. 24.7.6 was stated for
iterates before termination; if the iteration stops
earlier the conclusion is immediate.)
Exercise
(C3: What preconditioning does to the spectrum)
Let be symmetric positive definite and
write
with invertible,
which is possible by Theorem 13.2.3.
- (a) Prove that is
symmetric positive definite.
- (b) Prove that and
are
similar, and deduce that their eigenvalues
coincide.
- (c) Hence show that
those eigenvalues are exactly the generalized
eigenvalues of the pencil in the sense of Definition 13.4.1, and
say what Theorem 24.7.7 then
predicts for preconditioned conjugate gradients.
Solution.
(a) It is
symmetric because .
It is positive definite by Proposition 13.1.2 (b)
applied with , which is invertible.
(b) Put , which is
invertible. Then using . So the two matrices are
similar, and similar matrices have the same
characteristic polynomial (Theorem 7.10.3),
hence the same eigenvalues with multiplicity.
(c) By Definition 13.4.1,
is a
generalized eigenvalue of the pencil exactly
when for some , that is when
; so the generalized eigenvalues are
the eigenvalues of , which by (b)
are those of .
Running conjugate gradients on therefore converges at the rate of Theorem 24.7.7 with replaced by the
ratio of the largest to the smallest generalized
eigenvalue of
relative to .
Choosing close
to makes that
ratio close to ;
choosing
makes it exactly ,
at the cost of having to solve with .