24.7  Steepest Descent and Conjugate Gradients

Section 2 solved Ax=b by elimination: about 23n3 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 A only through the product x↦Ax, for the case where A 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, A∈Mn(R) is symmetric and positive definite, b∈Rn, and x⋆=A−1b is the exact solution. Iteration indices are superscripts in parentheses. We work over R because the function this section minimizes is built from b⊤x, which over C is not a real number; everything below survives over C with b∗x replaced by its real part, and nothing else changes.

24.7.1. A linear system is a minimization problem

Positive definiteness is a statement about the number x⊤Ax (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 Ax=b is the same as sitting at the bottom of a bowl.

Definition 24.7.1 (The Energy Inner Product and the Energy Norm)

Let A∈Mn(R) be symmetric positive definite. The energy inner product is ⟨x,y⟩A:=y⊤Ax(x,y∈Rn), and the energy norm is ‖x‖A:=⟨x,x⟩A1/2=(x⊤Ax)1/2. Two vectors are A-orthogonal, or conjugate, when ⟨x,y⟩A=0.

This is the inner product of Chapter 13 §04, written there as y∗Ax. It really is one: it is bilinear because matrix multiplication is; it is symmetric because the 1×1 matrix y⊤Ax equals its own transpose x⊤Ay; and ⟨x,x⟩A>0 for x≠0 is clause (P2) of Definition 13.1.1 in its strict form. So ‖⋅‖A 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 A.

The word energy comes from the springs of Section 9, where 12x⊤Kx is the potential energy stored in a displacement x.

Proposition 24.7.1 (The Solution Minimizes the Energy Functional)

Let A∈Mn(R) be symmetric positive definite, b∈Rn, and define ϕ(x):=12x⊤Ax−b⊤x(x∈Rn). Then, with x⋆=A−1b, ϕ(x)−ϕ(x⋆)=12‖x−x⋆‖A2for every x∈Rn. In particular x⋆ is the unique minimizer of ϕ.

Proof. A is invertible, since A≻0 has only positive eigenvalues (Theorem 13.1.5, (a) ⇒ (b)), so x⋆ is defined and Ax⋆=b. Expand, using A⊤=A: 12‖x−x⋆‖A2=12x⊤Ax−x⊤Ax⋆+12(x⋆)⊤Ax⋆=12x⊤Ax−b⊤x+12b⊤x⋆, where the second line uses Ax⋆=b twice and x⊤b=b⊤x. The first two terms are ϕ(x). Putting x=x⋆ gives 0=ϕ(x⋆)+12b⊤x⋆, so the leftover constant is −ϕ(x⋆), which is the identity. Since ‖⋅‖A is a norm, the right-hand side is ≥0 with equality only at x=x⋆. 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 A. The identity also tells us which error to measure. The natural yardstick is not ‖x−x⋆‖2 but ‖x−x⋆‖A, because that is the one the algorithms actually make small.

Two quantities recur. The error is ε=x−x⋆ and the residual is r=b−Ax, and they are related by

r=b−Ax=Ax⋆−Ax=−Aε.
(24.7.1)

The residual is computable and the error is not; Eq. 24.7.1 is the exchange rate between them.

24.7.2. Steepest descent

Fix x and a direction d≠0, and ask what happens along the line x+td. Expanding ϕ and using A⊤=A,

where r=b−Ax. Since d⊤Ad>0, the right-hand side is a parabola in t opening upwards, so it has one minimum, at

Choosing t this way is an exact line search; it costs one product Ad.

Which d should we take? Read Eq. 24.7.2 for small t: the decrease is td⊤r to first order, and among unit vectors d the quantity d⊤r is largest exactly at d=r/‖r‖2, 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 r but A−1r: with d=A−1r, Eq. 24.7.3 gives t=1 and x+d=x+A−1(b−Ax)=x⋆, 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 A−1r cheaply.

Definition 24.7.2 (Steepest Descent)

Let A≻0 and b∈Rn, and let x(0)∈Rn. Steepest descent is the iteration: for k=0,1,2,…, set r(k)=b−Ax(k); if r(k)=0, stop, since x(k)=x⋆; otherwise put tk=(r(k))⊤r(k)(r(k))⊤Ar(k),x(k+1)=x(k)+tkr(k).

The denominator is positive because r(k)≠0 and A≻0, so tk is defined, and tk>0. 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 A∈Mn(R) be symmetric positive definite with eigenvalues λ1≥⋯≥λn>0. Then for every y∈Rn, (y⊤Ay)(y⊤A−1y)≤(λ1+λn)24λ1λn(y⊤y)2.

Idea. In an orthonormal eigenbasis both factors become weighted averages of the eigenvalues, one of λ and one of 1/λ, with the same weights. The obstacle is that 1/λ is not linear, so the second average is not determined by the first. It is, however, bounded by it: on the interval [λn,λ1] the curve 1/λ 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 a=λ1 and c=λn. For every λ with c≤λ≤a, (∗)a+c−λac−1λ=λ(a+c−λ)−acacλ=−(λ−a)(λ−c)acλ ≥ 0, because λ−a≤0, λ−c≥0 and acλ>0.

We may assume y≠0, the case y=0 being an equality 0=0, and by homogeneity (both sides scale by s4 under y↦sy) we may assume y⊤y=1. By the spectral theorem (Corollary 12.5.2) there is an orthonormal basis q1,…,qn of Rn with Aqi=λiqi. Let ui=qi⊤y be the coordinates of y in that basis, and put wi=ui2. Then ∑iwi=‖y‖22=1 by Parseval’s identity (Theorem 11.9.2), every wi≥0, and y⊤Ay=∑iλiwi=:μ,y⊤A−1y=∑iwiλi, the second because A−1qi=λi−1qi. Since the wi are weights summing to 1 and every λi∈[c,a], the number μ lies in [c,a]. Averaging (∗) with the weights wi, y⊤A−1y≤∑iwia+c−λiac=a+c−μac. Hence (y⊤Ay)(y⊤A−1y)≤μ(a+c−μ)/(ac). Finally, for any real μ, μ(a+c−μ)=(a+c)24−(a+c2−μ)2≤(a+c)24, and dividing by ac gives the bound. This proves the lemma.

Remark. Equality is attainable: take y=(q1+qn)/2, so that w1=wn=12 and every other weight is 0. Then (∗) is an equality at each λi carrying weight, since those are a and c, and μ=(a+c)/2 makes the last step an equality too. Only the weights wi=ui2 enter, so (q1−qn)/2 serves just as well, and so does any non-zero multiple of either. Example (The bound is attained) does exactly this, up to sign and scale.

We also record the condition number in the form we shall use it. For A≻0, Lemma 17.3.5 gives ‖A‖2=λ1, since all eigenvalues are positive; the eigenvalues of A−1 are the λi−1, so the same lemma gives ‖A−1‖2=λn−1. Hence, by Definition 16.8.1,

κ:=κ2(A)=λ1λn ≥1.
(24.7.4)
Theorem 24.7.3 (Convergence of Steepest Descent)

Let A∈Mn(R) be symmetric positive definite with κ=κ2(A), let b∈Rn, and let x(0),x(1),… be the steepest descent iterates. Then for every k for which x(k) is defined, ‖x(k)−x⋆‖A≤(κ−1κ+1)k‖x(0)−x⋆‖A.

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 1−4λ1λn/(λ1+λn)2, and that number is the square of (κ−1)/(κ+1).

Proof. It is enough to prove the estimate for one step and then iterate. Fix k and write x=x(k), r=r(k), t=tk and ε=ε(k):=x(k)−x⋆, and assume r≠0. By Eq. 24.7.1, r=−Aε, so ‖ε‖A2=ε⊤Aε=(A−1r)⊤A(A−1r)=r⊤A−1r, using A⊤=A and (A−1)⊤=A−1. The new error is ε+tr, so ‖ε+tr‖A2=‖ε‖A2+2tr⊤Aε+t2r⊤Ar=‖ε‖A2−2tr⊤r+t2r⊤Ar, the second line because Aε=−r. Substituting t=(r⊤r)/(r⊤Ar) collapses the last two terms: ‖ε+tr‖A2=‖ε‖A2−(r⊤r)2r⊤Ar=‖ε‖A2(1−(r⊤r)2(r⊤Ar)(r⊤A−1r)), where the last step divides and multiplies by ‖ε‖A2=r⊤A−1r, which is non-zero because r≠0. By Lemma 24.7.2 applied to y=r, (r⊤r)2(r⊤Ar)(r⊤A−1r) ≥ 4λ1λn(λ1+λn)2, so the bracket is at most 1−4λ1λn(λ1+λn)2=(λ1−λn)2(λ1+λn)2=(κ−1κ+1)2, the last equality on dividing numerator and denominator by λn2 and using Eq. 24.7.4. Since ε+tr=x(k+1)−x⋆=ε(k+1), taking square roots gives ‖ε(k+1)‖A≤κ−1κ+1‖ε(k)‖A, and an induction on k proves the theorem.

Example (The bound is attained)

Let A=diag(9,1), b=(9,1) and x(0)=(2,−8). Run three steps of steepest descent and compare with Theorem 24.7.3.

Solution. Here x⋆=(1,1) and κ=9, so the bound’s factor is 45. The first residual is r(0)=b−Ax(0)=(9,1)−(18,−8)=(−9,9), so r⊤r=162 and r⊤Ar=9⋅81+81=810, giving t0=15. Then x(1)=(2,−8)+15(−9,9)=(15,−315),r(1)=(365,365). The two components of r(1) are again equal in absolute value, so t1=15 as well, and x(2)=(4125,−11925), x(3)=(61125,−451125). The squared energy-norm errors are 90,2885,4608125,737283125, and each is exactly 1625 times the one before. So the ratio is 45 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 r(0) and r(2) 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, (r(k+1))⊤r(k)=0. What does that say about the shape of the path?

Solution. r(k+1)=b−Ax(k+1)=b−Ax(k)−tkAr(k)=r(k)−tkAr(k), so (r(k+1))⊤r(k)=r⊤r−tkr⊤Ar=0 by the choice of tk, writing r=r(k). 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.

24.7.3. Conjugate directions

The defect is now visible: each line search spoils the minimality achieved along the previous direction. We want directions p(0),p(1),… for which a search along p(k) leaves the earlier work intact, so that after k steps the iterate is optimal over the whole k-dimensional affine piece explored so far.

Read the requirement off the goal. Being optimal over x(0)+span(p(0),…,p(k−1)) means, by Proposition 24.7.1, that the error is A-orthogonal to that span; and one step changes the error by tkp(k). So the condition that preserves the earlier orthogonality is that p(k) itself be A-orthogonal to p(0),…,p(k−1). That is forced, not guessed. Which conjugate directions? The cheapest answer: take the residual and remove only what A-orthogonality forbids.

Definition 24.7.3 (The Conjugate Gradient Iteration)

Let A∈Mn(R) be symmetric positive definite, b∈Rn and x(0)∈Rn. Set r(0)=b−Ax(0),p(0)=r(0). For k=0,1,2,…: if r(k)=0, stop. Otherwise put αk=(r(k))⊤r(k)(p(k))⊤Ap(k),x(k+1)=x(k)+αkp(k),r(k+1)=r(k)−αkAp(k),βk=(r(k+1))⊤r(k+1)(r(k))⊤r(k), and p(k+1)=r(k+1)+βkp(k). This is the conjugate gradient iteration, or CG.

A non-example, by dropping one clause. Keep everything about the recursion and only weaken A≻0 to “symmetric and invertible”. Take A=(100−1),b=(1,1),x(0)=0. Then p(0)=r(0)=(1,1) and (p(0))⊤Ap(0)=1−1=0: the very first α0 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 p⊤Ap>0 for p≠0. 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 r is not a fresh evaluation of b−Ax but a consequence of the update of x; the two agree, since b−Ax(k+1)=r(k)−αkAp(k). Only one product Ap(k) is formed per step, serving both αk and r(k+1). 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 A≻0, b∈Rn, x(0)∈Rn, and write Kk=Kk(A,r(0)) for the Krylov subspaces of Definition 24.6.1, with K0={0}. Suppose the iteration of Definition 24.7.3 has produced non-zero r(0),…,r(k). Then:

  • (a) p(0),…,p(k) are non-zero and pairwise A-orthogonal, and every αj and βj with j≤k is defined, with αj>0;
  • (b) r(0),…,r(k) are pairwise orthogonal, and (r(k+1))⊤p(j)=0 for every j≤k;
  • (c) span(r(0),…,r(k))=span(p(0),…,p(k))=Kk+1, a space of dimension k+1;
  • (d) x(k+1) is the unique minimizer of ‖x−x⋆‖A over the affine set x(0)+Kk+1.

Idea. Everything is one induction, and the two coefficients are exactly what the induction needs. Step k has to deliver two orthogonality relations: the new residual against the old directions, and the new direction against the old directions in the A-inner product. The first is forced by αk, the second by βk, and each forces it only against the latest predecessor; the older ones come free, because Ap(j) is a combination of r(j) and r(j+1), 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 k. Throughout, A⊤=A is used silently to move A across a dot product, and AKj⊆Kj+1 directly from Definition 24.6.1.

Base k=0. Here p(0)=r(0)≠0, so (p(0))⊤Ap(0)>0 and α0=‖r(0)‖22/(p(0))⊤Ap(0) is defined and positive; that is (a). Part (c) is span(r(0))=span(p(0))=K1, which is Definition 24.6.1, and the dimension is 1 because r(0)≠0. For (b), a single vector is vacuously an orthogonal list, and (r(1))⊤p(0)=(r(0))⊤p(0)−α0(p(0))⊤Ap(0)=‖r(0)‖22−‖r(0)‖22=0, using r(1)=r(0)−α0Ap(0), p(0)=r(0) and the definition of α0.

Inductive step. Assume (a), (b), (c) for k, and assume r(k+1)≠0, so that βk and p(k+1) are formed. We prove (a), (b), (c) for k+1.

Step 1: the residuals stay orthogonal. By (b), r(k+1) is orthogonal to p(0),…,p(k), and by (c) that list spans the same space as r(0),…,r(k). Hence r(k+1)⊥r(j) for every j≤k, and with (b) this makes r(0),…,r(k+1) pairwise orthogonal.

Step 2: (c) for k+1. From r(k+1)=r(k)−αkAp(k) with r(k),p(k)∈Kk+1, we get r(k+1)∈Kk+2, and then p(k+1)=r(k+1)+βkp(k)∈Kk+2 as well. Moreover span(p(0),…,p(k+1))=span(p(0),…,p(k),r(k+1))=span(r(0),…,r(k+1)), the first equality because p(k+1) differs from r(k+1) by a multiple of p(k), the second by (c). By Step 1 the vectors r(0),…,r(k+1) are non-zero and pairwise orthogonal, hence independent (Theorem 11.1.4), so this common span has dimension k+2. It sits inside Kk+2, which is spanned by k+2 vectors and so has dimension at most k+2; equal dimensions force equal spaces.

Step 3: p(k+1)≠0, and αk+1 is defined. By (b), (r(k+1))⊤p(k)=0, so (†)(p(k+1))⊤r(k+1)=‖r(k+1)‖22+βk(p(k))⊤r(k+1)=‖r(k+1)‖22>0. Hence p(k+1)≠0, so (p(k+1))⊤Ap(k+1)>0 and αk+1 is defined and positive.

Step 4: (a) for k+1. We must show (p(k+1))⊤Ap(j)=0 for j≤k. For j=k, use Ap(k)=(r(k)−r(k+1))/αk: (p(k+1))⊤Ap(k)=(r(k+1))⊤Ap(k)+βk(p(k))⊤Ap(k). By Step 1 the first term is (0−‖r(k+1)‖22)/αk, and (p(k))⊤Ap(k)=‖r(k)‖22/αk by the definition of αk. The two cancel exactly when βk=‖r(k+1)‖22/‖r(k)‖22, which is how βk was defined. For j<k, the term βk(p(k))⊤Ap(j) vanishes by (a), and Ap(j)=r(j)−r(j+1)αj∈span(r(0),…,r(k)), so (r(k+1))⊤Ap(j)=0 by Step 1.

Step 5: (b) for k+1. The first half is Step 1. For the second, r(k+2)=r(k+1)−αk+1Ap(k+1), so for j=k+1, (r(k+2))⊤p(k+1)=(r(k+1))⊤p(k+1)−αk+1(p(k+1))⊤Ap(k+1)=0 by (†) and the definition of αk+1; and for j≤k, (r(k+2))⊤p(j)=(r(k+1))⊤p(j)−αk+1(p(k+1))⊤Ap(j)=0−0=0 by (b) and Step 4. This completes the induction.

Proof of (d). By construction x(k+1)=x(0)+∑j≤kαjp(j), which lies in x(0)+Kk+1 by (c). Let ε=x(k+1)−x⋆. By Eq. 24.7.1, Aε=−r(k+1), so for every w∈Kk+1=span(p(0),…,p(k)), ⟨ε,w⟩A=w⊤Aε=−w⊤r(k+1)=0 by (b). Now take any x=x(0)+z with z∈Kk+1, and write x−x⋆=ε+w with w=z−∑j≤kαjp(j)∈Kk+1. By the Pythagorean theorem (Theorem 11.1.3) in the energy inner product, ‖x−x⋆‖A2=‖ε‖A2+‖w‖A2 ≥ ‖ε‖A2, with equality only for w=0, that is only for x=x(k+1). This proves the theorem.

Corollary 24.7.5 (Finite Termination)

In exact arithmetic the conjugate gradient iteration reaches r(m)=0, and hence x(m)=x⋆, for some m≤n. If A has only d distinct eigenvalues, then m≤d.

Proof. Suppose r(0),…,r(k) are all non-zero. By Theorem 24.7.4 (c), dim⁡Kk+1=k+1. Since Kk+1⊆Rn, this forces k+1≤n; so the residuals cannot all be non-zero for k=n, and r(m)=0 for some m≤n. Then Ax(m)=b, so x(m)=x⋆.

For the refinement, let μ1,…,μd be the distinct eigenvalues and put q(x)=(x−μ1)⋯(x−μd). By Corollary 12.5.2, A=QDQ⊤ with Q orthogonal and D diagonal carrying the eigenvalues, so q(A)=Qq(D)Q⊤=0, every diagonal entry of q(D) being q at an eigenvalue. Hence Adr(0) is a combination of r(0),Ar(0),…,Ad−1r(0), so Kd+1=Kd and dim⁡Kk≤d for every k. If r(0),…,r(d) were all non-zero we would get dim⁡Kd+1=d+1>d, a contradiction. So m≤d.

Example (Two distinct eigenvalues, two steps)

Let A=I3+J, where J is the all-ones matrix, let b=e1 and x(0)=0. Run CG.

Solution. A has rows (2,1,1), (1,2,1), (1,1,2). Since J1=31 and J kills 1⊥, the eigenvalues of A are 4 (once) and 1 (twice): d=2. Also A−1=I−14J, so x⋆=e1−141=(34,−14,−14).

Step 0. r(0)=p(0)=(1,0,0), (r(0))⊤r(0)=1, Ap(0)=(2,1,1), (p(0))⊤Ap(0)=2, so α0=12 and x(1)=(12,0,0),r(1)=(1,0,0)−12(2,1,1)=(0,−12,−12). Then β0=12/1=12 and p(1)=(0,−12,−12)+12(1,0,0)=(12,−12,−12).

Step 1. The rows of A applied to p(1) give 1−12−12=0, then 12−1−12=−1, then 12−12−1=−1; so Ap(1)=(0,−1,−1) and (p(1))⊤Ap(1)=1. With (r(1))⊤r(1)=12 this gives α1=12 and x(2)=(12,0,0)+12(12,−12,−12)=(34,−14,−14)=x⋆, with r(2)=(0,−12,−12)−12(0,−1,−1)=0. Two steps, as Corollary 24.7.5 predicts, for a 3×3 system. Checks: (r(1))⊤r(0)=0 and (p(1))⊤Ap(0)=(12,−12,−12)⋅(2,1,1)=1−12−12=0.

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 A 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 αj and βj 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 106 is stopped after a few hundred steps, and the theorem that matters is Theorem 24.7.7 below.

24.7.4. 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 1 on [−1,1] and then grow geometrically outside it.

Definition 24.7.4 (Chebyshev Polynomials)

The Chebyshev polynomials T0,T1,T2,⋯∈R[x] are defined by T0=1,T1=x,Tk+1=2xTk−Tk−1  (k≥1).

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 (1−t2)−1/2 on (−1,1), and the Tk 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 2 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 T2=2x2−1,T3=4x3−3x,T4=8x4−8x2+1.

We shall need the degrees, and the recurrence supplies them by induction on k. For k=0 and k=1, deg⁡Tk=k, with leading coefficient 1 in both cases. Let k≥1 and suppose deg⁡Tk−1=k−1 and deg⁡Tk=k with leading coefficient ck. Then 2xTk has degree k+1 with leading coefficient 2ck, while deg⁡Tk−1=k−1<k+1, so no cancellation is possible in Tk+1=2xTk−Tk−1 and deg⁡Tk+1=k+1 with leading coefficient 2ck. Hence deg⁡Tk=k for every k, and since c1=1 the doubling gives ck=2k−1 for k≥1.

The one trick in the subject is a change of variable. Every complex number x can be written as 12(w+w−1) for some w≠0: the equation w2−2xw+1=0 has two roots in C, neither of them 0 since their product is 1. In that variable the recurrence becomes trivial.

Lemma 24.7.6 (Chebyshev Polynomials: Size Inside and Growth Outside)

For every k≥0 and every w∈C∖{0},

Tk(w+w−12)=wk+w−k2.
(24.7.5)

Consequently:

  • (a) |Tk(x)|≤1 for every real x∈[−1,1], and Tk(1)=1;
  • (b) for every real z>1, Tk(z)=12((z+z2−1)k+(z+z2−1)−k) ≥ 12(z+z2−1)k, and, separately, Tk(z)≥1.

Idea. Under x=12(w+w−1) the recurrence of Definition 24.7.4 says nothing more than wk+1+w−(k+1)=(w+w−1)(wk+w−k)−(wk−1+w−(k−1)), which is true because the cross terms cancel. The two facts are then two choices of w: on [−1,1] take |w|=1, so that wk and w−k are again on the unit circle; outside, take w real and greater than 1, so that wk grows geometrically.

Proof. The identity Eq. 24.7.5. Induct on k. For k=0 both sides are 1, and for k=1 both are 12(w+w−1). Assume the identity for k−1 and k, with k≥1, and write x=12(w+w−1). Then Tk+1(x)=2xTk(x)−Tk−1(x)=(w+w−1)wk+w−k2−wk−1+w−(k−1)2=wk+1+w−(k−1)+wk−1+w−(k+1)−wk−1−w−(k−1)2, which is 12(wk+1+w−(k+1)), as required.

(a). Let x∈[−1,1] and put w=x+i1−x2. Then |w|2=x2+(1−x2)=1, so w≠0 and w−1=w― (Theorem 0.6.2), whence 12(w+w−1)=12(w+w―)=x. By Eq. 24.7.5 and |u+v|≤|u|+|v| (Theorem 0.6.4), |Tk(x)|=12|wk+w−k|≤12(|w|k+|w|−k)=1. For x=1 take w=1, giving Tk(1)=12(1+1)=1.

(b). Let z>1 and put w=z+z2−1, a real number >1. Then w(z−z2−1)=z2−(z2−1)=1, so w−1=z−z2−1 and 12(w+w−1)=z. Now Eq. 24.7.5 gives the displayed formula. Both wk and w−k are positive, so dropping the second gives the displayed inequality. For the separate bound, 12(s+s−1)≥1 for every s>0, because s+s−1−2=(s1/2−s−1/2)2≥0; applying this with s=wk>0 gives Tk(z)=12(wk+w−k)≥1. This proves the lemma.

Warning. Part (a) is false the moment x leaves [−1,1], and spectacularly so. T10(1.1) is already about 42.2, and T50(1.1) exceeds 2×109. 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 0, and the ratio of the two is what CG converts into speed.

Remark. That the Chebyshev polynomials are also extremal — among monic polynomials of degree k, the scaled Tk/2k−1 has the smallest maximum modulus on [−1,1] — is classical, is not proved here, and is not needed. What Theorem 24.7.7 uses is only that Tk, rescaled, is an admissible competitor in the minimum of Eq. 24.7.6: small on the interval where the eigenvalues lie, and large at 0.

24.7.5. The square root

Theorem 24.7.7 (Convergence of Conjugate Gradients)

Let A∈Mn(R) be symmetric positive definite with κ=κ2(A), let b∈Rn, and let x(k) be the conjugate gradient iterates from x(0), with x(k):=x⋆ once the iteration has terminated. Then for every k≥0, ‖x(k)−x⋆‖A ≤ 2(κ−1κ+1)k‖x(0)−x⋆‖A.

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 ‖q(A)ε(0)‖A over polynomials q of degree ≤k with q(0)=1. ② In an eigenbasis that quantity is at most maxi|q(λi)| times the initial error, so we need one polynomial that is 1 at 0 and small on [λn,λ1]. ③ Chebyshev’s polynomial, rescaled so that the interval becomes [−1,1], is that polynomial, and Lemma 24.7.6 measures it.

Proof. If κ=1 then λ1=λn, so A=λ1I by the spectral theorem, and p(0)=r(0) gives α0=1/λ1 and x(1)=x⋆; the bound then reads 0≤0 for k≥1 and ‖ε(0)‖A≤2‖ε(0)‖A for k=0, both true. So assume κ>1. We may also assume the iteration has not terminated before step k, since once it has, the left-hand side is 0.

Step 1: the error is a polynomial in A applied to the initial error. Write ε(0)=x(0)−x⋆, so r(0)=−Aε(0) by Eq. 24.7.1. A vector of x(0)+Kk has the form x=x(0)+∑j=0k−1cjAjr(0), and then x−x⋆=ε(0)−∑j=0k−1cjAj+1ε(0)=q(A)ε(0),q(x)=1−∑j=0k−1cjxj+1. As the cj range over Rk, q ranges over all polynomials of degree at most k with q(0)=1. So Theorem 24.7.4 (d) says

‖ε(k)‖A=min{‖q(A)ε(0)‖A:deg⁡q≤k, q(0)=1}.
(24.7.6)

Step 2: one eigenbasis estimate. By Corollary 12.5.2 take an orthonormal basis q1,…,qn with Aqi=λiqi, and write ε(0)=∑iuiqi. Then q(A)qi=q(λi)qi, so ‖q(A)ε(0)‖A2=∑iλiq(λi)2ui2≤(maxi|q(λi)|)2∑iλiui2, and ∑iλiui2=‖ε(0)‖A2. Every λi lies in [λn,λ1], so with Eq. 24.7.6, for any admissible q,

‖ε(k)‖A≤(maxλn≤λ≤λ1|q(λ)|)‖ε(0)‖A.
(24.7.7)

Step 3: the polynomial. Put z=λ1+λnλ1−λn=κ+1κ−1>1,q(λ)=1Tk(z)Tk(λ1+λn−2λλ1−λn). The inner expression is an affine function of λ carrying λn to 1 and λ1 to −1, so it maps [λn,λ1] into [−1,1]; and it sends λ=0 to z. By Lemma 24.7.6 (b), Tk(z)≥1>0, so q is a well-defined polynomial of degree at most k, and q(0)=Tk(z)/Tk(z)=1. By Lemma 24.7.6 (a), maxλn≤λ≤λ1|q(λ)|≤1Tk(z).

Step 4: measuring Tk(z). Since κ>1, z2−1=(κ+1)2−(κ−1)2(κ−1)2=4κ(κ−1)2,z2−1=2κκ−1, so, using κ−1=(κ−1)(κ+1), z+z2−1=κ+1+2κκ−1=(κ+1)2(κ−1)(κ+1)=κ+1κ−1. By Lemma 24.7.6 (b), Tk(z)≥12((κ+1)/(κ−1))k, so 1/Tk(z)≤2((κ−1)/(κ+1))k. Feeding this into Eq. 24.7.7 proves the theorem.

The square root is the whole gain. Take κ=100. Steepest descent contracts by at most 99/101≈0.9802 per step, so reducing the energy-norm error by 10−6 needs about 691 steps; conjugate gradients contracts by 9/11≈0.8182, and 2(9/11)k≤10−6 already at k=73. Both cost one product with A per step, so the ratio of the counts is the ratio of the work.

Quick check. Why does the factor 2 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 log⁡2/log⁡((κ+1)/(κ−1)), about 3.5 steps out of 73 when κ=100. It is there because the lower bound for Tk(z) in Lemma 24.7.6 (b) throws away the term w−k; the surviving 12 is exactly this 2.

Remark. The bound uses only the two ends of the spectrum, and it is often pessimistic. Eq. 24.7.7 holds for every admissible polynomial, so if the eigenvalues fall into a few tight clusters one may take q small near each cluster and do far better; Corollary 24.7.5 is the extreme case. Conjugate gradients sees the whole spectrum, not just its ends.

24.7.6. Two footnotes: Chebyshev iteration and preconditioning

The polynomial in Step 3 depends only on λ1 and λn, 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 λ1 and λn 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 Ax=b by an equivalent system of smaller condition number. Choosing a symmetric positive definite M close to A, and writing M=CC⊤, one applies CG to (C−1AC−⊤)y=C−1b,x=C−⊤y, whose matrix is symmetric positive definite (Proposition 13.1.2) and whose eigenvalues are the generalized eigenvalues of the pencil A−λM 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 M to choose depends on where A came from, and no theorem of linear algebra answers that. We state the mechanism and stop.

24.7.7. Exercises

A. Check your understanding

Exercise (A1)
  • (a) Define the energy inner product of a symmetric positive definite A, 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 ‖⋅‖A the natural yardstick for the error.
  • (c) State the optimality property of the k-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 1000×1000 positive definite matrix with 5 distinct eigenvalues terminates after at most 5 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) ⟨x,y⟩A=y⊤Ax. Symmetry and bilinearity hold for any symmetric A; what makes it an inner product is ⟨x,x⟩A=x⊤Ax>0 for x≠0, which is clause (P2) of Definition 13.1.1 in its strict form.

  • (b) ϕ(x)−ϕ(x⋆)=12‖x−x⋆‖A2, where ϕ(x)=12x⊤Ax−b⊤x and x⋆=A−1b. So the energy norm of the error is the excess of ϕ over its minimum, up to the factor 12: it is the quantity every descent method is built to decrease.

  • (c) By Theorem 24.7.4 (d), x(k) is the unique minimizer of ‖x−x⋆‖A over the affine set x(0)+Kk(A,r(0)).

  • (d) Correct. By Corollary 24.7.5 the number of steps is at most the number d of distinct eigenvalues, here 5, and the order 1000 plays no part. The proof is that q(A)=0 for the degree-5 polynomial with the distinct eigenvalues as roots, so the Krylov spaces stop growing at dimension 5.

  • (e) |Tk|≤1 on [−1,1], and Tk(z)≥12(z+z2−1)k for z>1. The second supplies the square root: at z=(κ+1)/(κ−1) the number z+z2−1 equals (κ+1)/(κ−1), and the square root enters through z2−1=2κ/(κ−1).

B. Practice

Exercise (B1: Steepest descent by hand)

Let A=(2001), b=(2,1) and x(0)=(0,0).

  • (a) Compute x(1) and x(2) by steepest descent.
  • (b) Compute ‖x(k)−x⋆‖A2 for k=0,1,2 and compare the ratios with the bound of Theorem 24.7.3.

Solution. Here x⋆=(1,1) and κ=2, so the bound’s factor is (κ−1)/(κ+1)=13.

  • (a) r(0)=(2,1), r⊤r=5, r⊤Ar=2⋅4+1=9, so t0=59 and x(1)=(109,59). Then r(1)=(2,1)−Ax(1)=(2−209, 1−59)=(−29,49). Now r⊤r=2081 and r⊤Ar=2⋅481+1681=2481, so t1=2024=56 and x(2)=(109−56⋅29, 59+56⋅49)=(2527,2527).

  • (b) The errors are (−1,−1), (19,−49), (−227,−227), with squared energy norms 3,2⋅181+1681=1881=29,3⋅4729=4243. The ratios are 227 and 227, both well below the bound’s (13)2=19. 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 A=(4113), b=(1,2) and x(0)=(0,0). Run conjugate gradients to termination, and verify at each stage that the residuals are orthogonal and the directions A-orthogonal.

Solution. detA=11, so x⋆=111(3⋅1−1⋅2, −1⋅1+4⋅2)=(111,711).

Step 0. r(0)=p(0)=(1,2); (r(0))⊤r(0)=5; Ap(0)=(6,7); (p(0))⊤Ap(0)=6+14=20. So α0=14, x(1)=(14,12) and r(1)=(1,2)−14(6,7)=(−12,14). Check: (r(1))⊤r(0)=−12+12=0. Then (r(1))⊤r(1)=14+116=516, β0=5/165=116 and p(1)=(−12,14)+116(1,2)=(−716,38). Check: (p(1))⊤Ap(0)=(−716)6+38⋅7=−4216+4216=0.

Step 1. Ap(1)=(4(−716)+38, −716+3⋅38)=(−118,1116), so (p(1))⊤Ap(1)=77128+33128=5564,α1=5/1655/64=411. Then x(2)=(14,12)+411(−716,38)=(1144−744, 1122+322)=(111,711)=x⋆, and r(2)=(−12,14)−411(−118,1116)=(−12+12, 14−14)=0. Two steps for a 2×2 system, which is what Corollary 24.7.5 allows.

Exercise (B3: Chebyshev by recurrence)
  • (a) Compute T5 from Definition 24.7.4.
  • (b) Evaluate T5(1), T5(−1) and T5(0), and check them against Lemma 24.7.6 (a).
  • (c) Evaluate T5(2) from the polynomial, and check it against the closed formula of Lemma 24.7.6 (b).

Solution.

  • (a) T2=2x2−1, T3=2x(2x2−1)−x=4x3−3x, T4=2x(4x3−3x)−(2x2−1)=8x4−8x2+1, and T5=2x(8x4−8x2+1)−(4x3−3x)=16x5−20x3+5x.

  • (b) T5(1)=16−20+5=1, T5(−1)=−1, T5(0)=0. All three have absolute value at most 1, as (a) of the lemma requires, and the first is the equality Tk(1)=1.

  • (c) T5(2)=16⋅32−20⋅8+10=512−160+10=362. By the closed formula with z=2, w=2+3 and w−1=2−3, so T5(2)=12((2+3)5+(2−3)5). Expanding, (2±3)5=362±2093, so the half-sum is 362. The two agree, and the growth is visible: T5 is at most 1 on [−1,1] and already 362 at 2.

C. Going deeper

Exercise (C1: Sharpness of Kantorovich)

Let a≥c>0 and let A=diag(a,c).

  • (a) Prove that for y=(1,1) the inequality of Lemma 24.7.2 is an equality.
  • (b) Hence deduce that the constant (κ−1)/(κ+1) in Theorem 24.7.3 cannot be replaced by any smaller one.

Solution.

  • (a) y⊤Ay=a+c, y⊤A−1y=a−1+c−1=(a+c)/(ac), and y⊤y=2. So the left side is (a+c)2/(ac) and the right side is ((a+c)2/(4ac))⋅4=(a+c)2/(ac). They agree.

  • (b) Take b=(a,c), so that x⋆=(1,1), and x(0)=(1−1a, 1−1c), so that ε(0)=(−1a,−1c). Then r(0)=−Aε(0)=(1,1), which is the vector of part (a). By the proof of Theorem 24.7.3 the one-step ratio is 1−(r⊤r)2(r⊤Ar)(r⊤A−1r)=1−4ac(a+c)2=(κ−1κ+1)2, so the first step attains the bound exactly. Moreover r(1)=r(0)−t0Ar(0)=(1−t0a, 1−t0c) with t0=2/(a+c), giving r(1)=((c−a)/(a+c))(1,−1); its two components again have equal absolute value, so part (a) applies to it up to sign and scale. That is enough: replacing y by sy multiplies both sides of Lemma 24.7.2 by s4, and changing the sign of a coordinate changes neither side, since A and A−1 are diagonal. So every step attains the bound. Hence no constant smaller than (κ−1)/(κ+1) can work. (Example (The bound is attained) is the case a=9, c=1, rescaled.)

Exercise (C2: Finite termination, from polynomials)

Give a second proof of the second statement of Corollary 24.7.5 — that d distinct eigenvalues force termination in at most d steps — using Eq. 24.7.6 instead of a dimension count. Hint: consider q(x)=∏i=1d(1−x/μi).

Solution. Let μ1,…,μd be the distinct eigenvalues of A; all are positive, so q(x)=∏i=1d(1−x/μi) is defined, has degree d, and satisfies q(0)=1. It is therefore admissible in Eq. 24.7.6 with k=d. By Step 2 of the proof of Theorem 24.7.7, ‖ε(d)‖A2≤∑iλiq(λi)2ui2=0, since every eigenvalue λi of A equals some μj and so is a root of q. Hence ε(d)=0 and x(d)=x⋆. (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 A,M∈Mn(R) be symmetric positive definite and write M=CC⊤ with C invertible, which is possible by Theorem 13.2.3.

  • (a) Prove that C−1AC−⊤ is symmetric positive definite.
  • (b) Prove that C−1AC−⊤ and M−1A are similar, and deduce that their eigenvalues coincide.
  • (c) Hence show that those eigenvalues are exactly the generalized eigenvalues of the pencil A−λM 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 (C−1AC−⊤)⊤=C−1A⊤C−⊤=C−1AC−⊤. It is positive definite by Proposition 13.1.2 (b) applied with S=C−⊤, which is invertible.

  • (b) Put P=C−⊤, which is invertible. Then P(C−1AC−⊤)P−1=C−⊤C−1AC−⊤C⊤=C−⊤C−1A=(CC⊤)−1A=M−1A, using (CC⊤)−1=C−⊤C−1. 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 A−λM exactly when Av=λMv for some v≠0, that is when M−1Av=λv; so the generalized eigenvalues are the eigenvalues of M−1A, which by (b) are those of C−1AC−⊤. Running conjugate gradients on (C−1AC−⊤)y=C−1b therefore converges at the rate of Theorem 24.7.7 with κ replaced by the ratio of the largest to the smallest generalized eigenvalue of A relative to M. Choosing M close to A makes that ratio close to 1; choosing M=A makes it exactly 1, at the cost of having to solve with A.

Found a typo or a mistake? Report it, or read this page’s source

The text of this book is licensed under CC BY-NC-SA 4.0.