Methods of Conjugate Gradients for Solving Linear Systems II: Each Conjugate Gradient Step Shortens the Error VectorResearch Paper
Motivation
The conjugate gradient method (cg-method) of Hestenes and Stiefel is the standard iterative solver for linear systems with a symmetric positive definite matrix . It is used for the large sparse systems of finite-element and finite-difference discretizations, as the inner solver of Newton-type and interior-point methods in optimization, and as the prototype of the Krylov subspace methods. Its original 1952 paper (Hestenes and Stiefel, J. Res. NBS 49(6), 1952) already presented it as two things at once: a direct method that reaches the exact solution in at most steps, and a method of successive approximations whose intermediate estimates are useful in their own right.
The second view needs a guarantee that the intermediate estimates actually approach the solution. The method is built to decrease the -weighted error , and the residual need not decrease (Section 18 of the paper, p. 432, notes that it can increase at every step). Theorem 6:3 of the paper supplies the guarantee in the plain Euclidean length: the distance from the estimate to the solution decreases strictly at every step, by an exactly computable amount. This mission formalizes that theorem together with the relations from Sections 5 and 6 of the paper on which its proof rests.
Timeline:
- 1952: Hestenes and Stiefel introduce the method and prove, in one paper, finite termination (Theorems 4:2 and 5:2), the monotone decrease of the error function (Theorem 6:1), and the monotone decrease of the Euclidean error (Theorem 6:3). The later literature on cg as an iterative method for large sparse systems takes these properties as its starting point.
Setting
Let be a real matrix that is symmetric and positive definite, let , and let be the solution of . Write and . From an arbitrary starting point , the cg-method (5:1) computes estimates , residuals and direction vectors by
The error vector of is . The error function (4:5) is , which is nonnegative and vanishes only at . The Rayleigh quotient (4:12) of a vector is . The Lean development names these cgIter A k x₀ i (with fields .x, .r, .p), cgAlpha for , errorFun A h x and rayleigh A z.
Formalization targets
Goal: Theorem 6:3
For every step that the method performs, that is, every with ,
The paper writes the step from to ; the Lean statement shifts the index by one. The goal holds for every dimension , every symmetric positive definite , every and every .
Milestones
- Theorems 4:2 and 5:2: some has .
- Theorem 5:3, (5:6a): for .
- Theorem 6:1, (6:1): .
- Theorem 6:1, (6:2): for .
- Section 6, (6:6): .
Significance
The theorem is what makes an early stop of the cg-method safe in the norm a user usually cares about. Every intermediate estimate is closer to the solution, in Euclidean distance, than the previous one, and the identity (6:5) states by how much. It also separates the cg-method from methods that minimize the residual: the -norm error, the Euclidean error and the residual behave differently, and only the first two are monotone along cg.
The results are proved in the 1952 paper. They have not been formalized: the Prove2Me library has no statement of the conjugate gradient recursion (5:1), and Mathlib has none either. What this mission adds is a machine-checked version of the paper's Section 6 argument for the recursion exactly as printed, including the case analysis at termination that the paper leaves implicit, and a reusable Lean definition of the cg iteration with its basic identities.
Difficulty
The obvious argument does not reach the conclusion. The method decreases at every step, but a decrease in this -weighted norm does not imply a decrease in the Euclidean norm: for a single step along an arbitrary direction, even the best step for can lengthen the Euclidean error. So the theorem cannot be proved one step at a time from the local minimization property. It depends on how the current direction relates to all the later directions of the same run, and those relations in turn rest on the mutual orthogonality of the residuals and the conjugacy of the directions, which are established by an induction over the whole run.
A second difficulty is bookkeeping at the end of the run. The recursion divides by and by , which vanish after termination. Every milestone has to hold, or be guarded, past that point, and the goal needs the hypothesis exactly because the strict inequality fails once .
Formalization scope
Vectors are Fin n → ℝ, the scalar product is dotProduct (⬝ᵥ), is Matrix.mulVec (*ᵥ), and the standing assumption is A.PosDef, which in Mathlib includes symmetry. The solution is a variable with the hypothesis A *ᵥ h = k. Indices are 0-based. The cg recursion is the definition cgIter, which computes (5:1b)–(5:1f) literally and in order; it has no stopping rule, and Lean's convention makes it stay at with once . Lengths appear squared, as . The milestones are stated for every index without a termination guard, because both sides of each identity vanish after termination; only the goal carries .
Two formalizations would trivialize the goal and are ruled out. The goal does not assume termination () or any bound on : it quantifies over every cg run and every step that takes place. And it is about the Euclidean length , not the error function (that is Theorem 6:1, a different and weaker statement) and not the residual.
A complete development needs Theorem 5:1 (orthogonality of residuals, conjugacy of directions) for the literal recursion, the identities (5:2) and (5:3c), and the positivity of for . These are reusable for any further work on the cg-method, including the sister mission on finite termination. Proofs of any milestone, and alternative proofs of Theorem 6:3 through the Krylov-subspace characterization, are welcome.
Selected references
- M. R. Hestenes and E. Stiefel, Methods of Conjugate Gradients for Solving Linear Systems, J. Res. Natl. Bur. Stand. 49(6), 409–436, 1952. https://doi.org/10.6028/jres.049.044 (publisher's scan: https://nvlpubs.nist.gov/nistpubs/jres/049/jresv49n6p409_A1b.pdf)