ArticleslgStudy

mathematics

Conjugate gradient method

Conjugate gradient method is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Conjugate gradient method rather than just read about it. In short: In mathematics, the conjugate gradient method is an algorithm for the numerical solution of particular systems of linear equations, namely those whose matrix is positive-semidefinite. The conjugate gradient method is often implemented as an iterative algorithm, applicable to sparse systems that are too large to be handled by a direct implementation or other direct methods such as the Cholesky decomposition.

Conjugate gradient method — main illustration
Conjugate gradient method — illustration

Key takeaways

  • Conjugate gradient method belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Conjugate gradient method to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Conjugate gradient method from memory before moving on to harder problems.

Reference excerpt

In mathematics, the conjugate gradient method is an algorithm for the numerical solution of particular systems of linear equations, namely those whose matrix is positive-semidefinite. The conjugate gradient method is often implemented as an iterative algorithm, applicable to sparse systems that are too large to be handled by a direct implementation or other direct methods such as the Cholesky decomposition. Large sparse systems often arise when numerically solving partial differential equations or optimization problems. The conjugate gradient method can also be used to solve unconstrained optimization problems such as energy minimization. It is commonly attributed to Magnus Hestenes and Eduard Stiefel, who programmed it on the Z4, and extensively researched it. The biconjugate gradient method provides a generalization to non-symmetric matrices. Various nonlinear conjugate gradient methods seek minima of nonlinear optimization problems.

Description of the problem addressed by conjugate gradients Suppose we want to solve the system of linear equations

𝐀𝐱=𝐛 for the vector 𝐱, where the known n×n matrix 𝐀 is symmetric (i.e., 𝐀𝖳=𝐀), positive-definite (i.e. 𝐱𝖳𝐀𝐱>0 for all non-zero vectors 𝐱 in ℝn), and real, and 𝐛 is known as well. We denote the unique solution of this system by 𝐱∗.

Derivation as a direct method

The conjugate gradient method can be derived from several different perspectives, including specialization of the conjugate direction method for optimization, and variation of the Arnoldi/Lanczos iteration for eigenvalue problems. Despite differences in their approaches, these derivations share a common topic—proving the orthogonality of the residuals and conjugacy of the search directions. These two properties are crucial to developing the well-known succinct formulation of the method. We say that two non-zero vectors 𝐮 and 𝐯 are conjugate (with respect to 𝐀) if

𝐮𝖳𝐀𝐯=0. Since 𝐀 is symmetric and positive-definite, the left-hand side defines an inner product

𝐮𝖳𝐀𝐯=⟨𝐮,𝐯⟩𝐀:=⟨𝐀𝐮,𝐯⟩=⟨𝐮,𝐀𝖳𝐯⟩=⟨𝐮,𝐀𝐯⟩. Two vectors are conjugate if and only if they are orthogonal with respect to this inner product. Being conjugate is a symmetric relation: if 𝐮 is conjugate to 𝐯, then 𝐯 is conjugate to 𝐮. Suppose that

P={𝐩1,…,𝐩n} is a set of n mutually conjugate vectors with respect to 𝐀, i.e. 𝐩i𝖳𝐀𝐩j=0 for all i≠j. Then P forms a basis for ℝn, and we may express the solution 𝐱∗ of 𝐀𝐱=𝐛 in this basis:

𝐱∗=∑i=1nαi𝐩i⇒𝐀𝐱∗=∑i=1nαi𝐀𝐩i. Left-multiplying the problem 𝐀𝐱=𝐛 with the vector 𝐩k𝖳 yields

𝐩k𝖳𝐛=𝐩k𝖳𝐀𝐱∗=∑i=1nαi𝐩k𝖳𝐀𝐩i=∑i=1nαi⟨𝐩k,𝐩i⟩𝐀=αk⟨𝐩k,𝐩k⟩𝐀 and so

αk=⟨𝐩k,𝐛⟩⟨𝐩k,𝐩k⟩𝐀. This gives the following method for solving the equation 𝐀𝐱=𝐛: find a sequence of n conjugate directions, and then compute the coefficients αk.

As an iterative method If we choose the conjugate vectors 𝐩k carefully, then we may not need all of them to obtain a good approximation to the solution 𝐱∗. So, we want to regard the conjugate gradient method as an iterative method. This also allows us to approximately solve systems where n is so large that the direct method would take too much time. We denote the initial guess for 𝐱∗ by 𝐱0 (we can assume without loss of generality that 𝐱0=𝟎, otherwise consider the system 𝐀𝐳=𝐛−𝐀𝐱0 instead). Starting with 𝐱0 we search for the solution and in each iteration we need a metric to tell us whether we are closer to the solution 𝐱∗ (that is unknown to us). This metric comes from the fact that the solution 𝐱∗ is also the unique minimizer of the following quadratic function

f(𝐱)=12𝐱𝖳𝐀𝐱−𝐱𝖳𝐛,𝐱∈ℝn. The existence of a unique minimizer is apparent as its Hessian matrix of second derivatives is symmetric positive-definite

𝐇(f(𝐱))=𝐀, and that the minimizer (use Df(𝐱)=0) solves the initial problem follows from its first derivative

∇f(𝐱)=𝐀𝐱−𝐛. This suggests taking the first basis vector 𝐩0 to be the negative of the gradient of f at 𝐱=𝐱0. The gradient of f equals 𝐀𝐱−𝐛. Starting with an initial guess 𝐱0, this means we take 𝐩0=𝐛−𝐀𝐱0. The other vectors in the basis will be conjugate to the gradient, hence the name conjugate gradient method. Note that 𝐩0 is also the residual provided by this initial step of the algorithm. Let 𝐫k be the residual at the kth step:

𝐫k=𝐛−𝐀𝐱k. As observed above, 𝐫k is the negative gradient of f at 𝐱k, so the gradient descent method would require to move in the direction rk. Here, however, we insist that the directions 𝐩k must be conjugate to each other. A practical way to enforce this is by requiring that the next search direction be built out of the current residual and all previous search directions. The conjugation constraint is an orthonormal-type constraint and hence the algorithm can be viewed as an example of Gram-Schmidt orthonormalization. This gives the following expression:

𝐩k=𝐫k−∑i<k𝐫k𝖳𝐀𝐩i𝐩i𝖳𝐀𝐩i𝐩i (see the picture at the top of the article for the effect of the conjugacy constraint on convergence). Following this direction, the next optimal location is given by

𝐱k+1=𝐱k+αk𝐩k with

αk=𝐩k𝖳(𝐛−𝐀𝐱k)𝐩k𝖳𝐀𝐩k=𝐩k𝖳𝐫k𝐩k𝖳𝐀𝐩k, where the last equality follows from the definition of 𝐫k . The expression for αk can be derived if one substitutes the expression for xk+1 into f and minimizing it with respect to αk

f(𝐱k+1)=f(𝐱k+αk𝐩k)=:g(αk)g′(αk)=!0⇒αk=𝐩k𝖳(𝐛−𝐀𝐱k)𝐩k𝖳𝐀𝐩k.

… excerpt ends here. Continue reading the full article.

Illustrations

Conjugate gradient method: A comparison of the convergence of gradient descent with optimal step size (in green) and conjugate vector (in red) for minimizing a quadratic function associated with a given linear system. Conjugate gradient, assuming exact arithmetic, converges in at most n steps, where n is the size of the matrix of the system (here n = 2).
A comparison of the convergence of gradient descent with optimal step size (in green) and conjugate vector (in red) for minimizing a quadratic function associated with a given linear system. Conjugate gradient, assuming exact arithmetic, converges in at most n steps, where n is the size of the matrix of the system (here n = 2).

Worked examples

Example 1 — a first encounter with Conjugate gradient method

Start with the simplest possible case. Write down what Conjugate gradient method claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Conjugate gradient method before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Conjugate gradient method ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Conjugate gradient method

In research
Conjugate gradient method appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Conjugate gradient method in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Conjugate gradient method is common in secondary-school and first-year university syllabi. It links to neighbouring topics Gradient methods, Numerical linear algebra, so understanding it makes those chapters shorter.
In everyday life
Look for Conjugate gradient method outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Conjugate gradient method” →

How to study Conjugate gradient method in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Conjugate gradient method means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Conjugate gradient method out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Conjugate gradient method in simple terms?

In mathematics, the conjugate gradient method is an algorithm for the numerical solution of particular systems of linear equations, namely those whose matrix is positive-semidefinite. The conjugate gradient method is often implemented as an iterative algorithm, applicable to sparse systems that are…

Why does Conjugate gradient method matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Conjugate gradient method?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Conjugate gradient method.

Tags

  • Gradient methods
  • Numerical linear algebra

Keep exploring