Path: blob/main/notebooks/published/conjugate_gradient_method/conjugate_gradient_method.ipynb
51 views
Conjugate Gradient Method
Introduction
The Conjugate Gradient (CG) method is an iterative algorithm for solving systems of linear equations of the form:
where is a symmetric positive definite (SPD) matrix, is the known right-hand side vector, and is the unknown solution vector.
Theoretical Foundation
Quadratic Form Minimization
Solving is equivalent to minimizing the quadratic form:
The gradient of this function is:
At the minimum, , which gives us .
A-Conjugacy
Two vectors and are said to be A-conjugate (or -orthogonal) if:
This property ensures that each search direction is independent in the -inner product space.
The Algorithm
Given an initial guess , the CG algorithm proceeds as:
Initialize:
For until convergence:
Compute step length:
Update solution:
Update residual:
Compute conjugate direction coefficient:
Update search direction:
Convergence Properties
For an SPD matrix , the CG method converges in at most iterations (in exact arithmetic). The convergence rate depends on the condition number :
where is the -norm.
Implementation
Conjugate Gradient Algorithm
Generate Test Problem
We create a symmetric positive definite matrix with controlled condition number to demonstrate convergence behavior.
Numerical Experiments
Effect of Condition Number on Convergence
Visualization of Convergence
Comparison with Direct Solver
For large sparse systems, CG is significantly more efficient than direct methods.
Conclusions
The Conjugate Gradient method is a powerful iterative algorithm for solving linear systems with symmetric positive definite matrices. Key observations:
Convergence Speed: The number of iterations scales as where is the condition number.
Exact Solution: In exact arithmetic, CG converges in at most iterations for an system.
A-Conjugate Directions: The search directions are mutually -orthogonal, ensuring optimal progress at each step.
Efficiency: For large sparse systems, CG is significantly more efficient than direct methods like LU decomposition.
Preconditioning: The method can be accelerated by preconditioning, which effectively reduces the condition number of the system.
The CG method remains one of the most important algorithms in numerical linear algebra, particularly for large-scale problems arising in scientific computing, optimization, and machine learning.