← Wiki Index / Computation & Algorithms / Conjugate Gradient Method
💻 Computation & Algorithms

Conjugate Gradient Method

The conjugate gradient method is a Krylov subspace iterative algorithm for solving symmetric positive-definite linear systems and unconstrained quadratic optimization problems using mutually A-orthogonal search directions.

The conjugate gradient method (CG) is an iterative Krylov subspace algorithm in computation and algorithms and numerical linear algebra for solving large, sparse systems of linear equations Ax = b whose coefficient matrix A ∈ Rn×n is real, symmetric (AT = A), and positive-definite (xTAx > 0 for all x ≠ 0). Developed independently and published jointly in 1952 by American mathematician Magnus R. Hestenes and Swiss mathematician Eduard Stiefel at the National Bureau of Standards, the algorithm bridges direct factorization methods (such as Cholesky Decomposition) and first-order iterative methods (such as Gradient Descent). In infinite-precision arithmetic, conjugate gradient reaches the analytic solution in at most n steps; in finite-precision scientific computing—following J. K. Reid's 1971 demonstration of its utility as an iterative solver—it computes high-accuracy approximations in k ≪ n iterations using only one sparse matrix-vector multiplication Apk and O(n) vector storage per step.

Equivalence of Linear Systems and Quadratic Minimization

The Energy Norm and Steepest Descent Zig-Zagging

When A ∈ Rn×n is symmetric positive-definite (SPD), solving Ax = b is equivalent to finding the unique global minimum x* = A−1b of the strongly convex quadratic potential function:

ϕ(x) = (1/2) xT A x − bT x

Taking the gradient yields ∇ϕ(x) = Ax − b = −r(x), where r(x) = b − Ax is the linear residual vector. Minimizing ϕ(x) is equivalent to minimizing the A-norm (energy norm) of the error vector ek = xk − x*:

‖ek‖A2 = (xk − x*)T A (xk − x*) = 2 [ ϕ(xk) − ϕ(x*) ]

In classical steepest descent, each iteration steps along the residual rk with line-search step size αk = (rkTrk)/(rkTArk). Because consecutive steepest-descent residuals are orthogonal in the Euclidean inner product (rk+1Trk = 0), steepest descent repeatedly steps back into subspaces it has already searched, zig-zagging across elongated ellipsoidal contours at a slow rate governed by (κ − 1)/(κ + 1), where κ = λmax(A)/λmin(A) is the spectral condition number.

A-Orthogonal (Conjugate) Search Directions

Hestenes and Stiefel eliminated this zig-zagging by requiring the search directions {p0, p1, ..., pn−1} to be mutually A-orthogonal (or A-conjugate):

piT A pj = 0 for all i ≠ j

Under the coordinate transformation y = A1/2x that maps the ellipsoidal level sets of ϕ(x) into spheres, A-conjugate vectors become orthogonal axes. Minimizing ϕ(x) sequentially along n mutually A-conjugate directions reduces the n-dimensional problem to n independent one-dimensional minimizations without spoiling optimality along previously searched directions.

The Hestenes–Stiefel Algorithm and Krylov Subspaces

Short Two-Term Recurrences

Because A is symmetric and each iterate xk minimizes ‖x − x*‖A over the k-th Krylov subspace:

Kk(A, r0) = span{ r0, Ar0, A2r0, ..., Ak−1r0 }

the new residual rk+1 is automatically orthogonal to all preceding residuals (rk+1Tri = 0 for i ≤ k), and the new A-conjugate direction pk+1 only requires orthogonalization against the preceding direction pk.

Given an initial guess x0 ∈ Rn, initialize r0 = b − Ax0 and p0 = r0. For k = 0, 1, 2, ... until ‖rk‖2 / ‖b‖2 ≤ ε:

  1. Optimal Step Length: αk = (rkT rk) / (pkT A pk)
  2. State & Residual Update: xk+1 = xk + αk pk, and rk+1 = rk − αk A pk
  3. Conjugacy Coefficient: βk = (rk+1T rk+1) / (rkT rk)
  4. Next Search Direction: pk+1 = rk+1 + βk pk

Each iteration requires one sparse matrix-vector product Apk, two inner products, and three vector updates, storing only four vectors of length n.

Chebyshev Polynomial Convergence Bound and Preconditioning

Square-Root Condition Number Acceleration

Writing the error at step k as ek = Pk(A)e0 over polynomials of degree k with Pk(0) = 1 and bounding the discrete spectrum [λ1, λn] by a scaled Chebyshev polynomial of the first kind Tk yields the error bound:

‖xk − x*‖A ≤ 2 [ (√κ − 1) / (√κ + 1) ]k ‖x0 − x*‖A, where κ = λn / λ1

Replacing κ in steepest descent with √κ in conjugate gradient reduces the iteration count needed for accuracy ε from O(κ log(1/ε)) to O(√κ log(1/ε)). Moreover, if A has only m < n distinct eigenvalues, CG converges in at most m steps.

Solver / VariantMatrix ClassMemoryIteration ScalingTypical Preconditioner
Steepest DescentSPD (AT = A > 0)O(n)O(κ log(1/ε))Diagonal (Jacobi) scaling
Conjugate Gradient (CG)SPD (AT = A > 0)O(4n)O(√κ log(1/ε))Incomplete Cholesky (IC), Algebraic Multigrid (AMG)
MINRES (Paige & Saunders, 1975)Symmetric indefinite (AT = A)O(6n)Minimizes ‖b − Axk‖2Block-diagonal SPD preconditioners
GMRES (Saad & Schultz, 1986)General nonsingular (AT ≠ A)O(mk n)Arnoldi Krylov projectionIncomplete LU (ILU), domain decomposition
BiCGSTAB (van der Vorst, 1992)General nonsingular (AT ≠ A)O(8n)Bi-orthogonal short recurrenceILU(p) for non-symmetric PDEs

Preconditioned Conjugate Gradient (PCG)

To accelerate convergence when κ(A) ≫ 1, Preconditioned Conjugate Gradient (PCG) introduces an easily invertible SPD preconditioner M ≈ A (such as Incomplete Cholesky M = L̃L̃T or Algebraic Multigrid [AMG]), solving Mzk = rk at each step and replacing rkTrk with rkTzk so convergence scales with √κ(M−1A) ≪ √κ(A).

Nonlinear Conjugate Gradient Optimization

Fletcher–Reeves and Polak–Ribière Formulas

In 1964, Roger Fletcher and Colin M. Reeves extended CG to smooth nonlinear objectives f(x): Rn → R (such as potential energy minimization in protein folding and molecular dynamics):

  • Fletcher–Reeves (1964): βkFR = ‖∇f(xk+1)‖22 / ‖∇f(xk)‖22
  • Polak–Ribière (1969): βkPR = [ ∇f(xk+1)T (∇f(xk+1) − ∇f(xk)) ] / ‖∇f(xk)‖22

Whereas both formulas coincide on quadratic functions under analytic line searches, Polak–Ribière automatically resets βk → 0 whenever consecutive gradients become nearly equal (xk+1 ≈ xk), restarting along the steepest-descent direction −∇f(xk+1).

Frequently Asked Questions

Why is Conjugate Gradient used as an iterative method if it finishes in n steps in theory?

For sparse 3D PDE grids with n = 107 to 109 unknowns, taking n steps or storing a dense Cholesky Decomposition is infeasible; Preconditioned Conjugate Gradient reaches machine accuracy in k ≈ 50–500 iterations (k ≪ n).

What happens if Conjugate Gradient is applied to a non-symmetric or indefinite matrix?

If AT ≠ A, the short two-term recurrence loses orthogonality over earlier Krylov vectors; if A is symmetric indefinite, pkTApk can vanish or turn negative. Symmetric indefinite systems use MINRES, while non-symmetric systems use GMRES or BiCGSTAB.

How does Incomplete Cholesky preconditioning speed up Conjugate Gradient?

Incomplete Cholesky (IC(0)) factors A ≈ L̃L̃T while dropping fill-in outside the sparsity pattern of A, preserving O(nnz(A)) memory while clustering the eigenvalues of (L̃L̃T)−1A near 1.

References

  1. Hestenes, M. R., & Stiefel, E. (1952). Methods of conjugate gradients for solving linear systems. Journal of Research of the National Bureau of Standards, 49(6), 409–436. https://doi.org/10.6028/jres.049.044
  2. Fletcher, R., & Reeves, C. M. (1964). Function minimization by conjugate gradients. The Computer Journal, 7(2), 149–154. https://doi.org/10.1093/comjnl/7.2.149
  3. Polak, E., & Ribière, G. (1969). Note sur la convergence de méthodes de directions conjuguées. Revue Française d'Informatique et de Recherche Opérationnelle, Série Rouge, 3(16), 35–43. https://doi.org/10.1051/m2an/196903R100351
  4. Meijerink, J. A., & van der Vorst, H. A. (1977). An iterative solution method for linear systems of which the coefficient matrix is a symmetric M-matrix. Mathematics of Computation, 31(137), 148–162. https://doi.org/10.1090/S0025-5718-1977-0438681-4
  5. Saad, Y. (2003). Iterative Methods for Sparse Linear Systems (2nd ed.). Society for Industrial and Applied Mathematics (SIAM). https://doi.org/10.1137/1.9780898718003
🧬 Support Open Science
Explore interactive science games on LowKey Games or browse scientific apparel & accessories in the CRV Science Shop.
💡 Spot an inaccuracy or have primary literature to expand this article?
Submit a citation or revision note using your shared CRV Science / LowKey Games profile ID.
Suggest Revision