ArticleslgStudy

mathematics

Derivation of the conjugate gradient method

Derivation of the 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 Derivation of the conjugate gradient method rather than just read about it. In short: In numerical linear algebra, the conjugate gradient method is an iterative method for numerically solving the linear system 𝑨𝒙=𝒃 where 𝑨 is symmetric positive-definite, without computing 𝑨−1 explicitly. 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 e…

Derivation of the conjugate gradient method — main illustration
Derivation of the conjugate gradient method — illustration

Key takeaways

  • Derivation of the 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 Derivation of the conjugate gradient method to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Derivation of the conjugate gradient method from memory before moving on to harder problems.

Reference excerpt

In numerical linear algebra, the conjugate gradient method is an iterative method for numerically solving the linear system

𝑨𝒙=𝒃 where 𝑨 is symmetric positive-definite, without computing 𝑨−1 explicitly. 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. The intent of this article is to document the important steps in these derivations.

Conjugate direction The conjugate gradient method can be seen as a special case of the conjugate direction method applied to minimization of the quadratic function

f(𝒙)=𝒙T𝑨𝒙−2𝒃T𝒙. which allows us to apply geometric intuition.

Line search

Geometrically, the quadratic function can be equivalently presented by writing down its value at every point in space. The points of equal value make up its contour surfaces, which are concentric ellipsoids with the equation 𝒙T𝑨𝒙−2𝒃T𝒙=Cfor varying C. As C decreases, the ellipsoids become smaller and smaller, until at its minimal value, the ellipsoid shrinks to their shared center. Minimizing the quadratic function is then a problem of moving around the plane, searching for that shared center of all those ellipsoids. The center can be found by computing 𝑨−1 explicitly, but this is precisely what we are trying to avoid. The simplest method is greedy line search, where we start at some point 𝒙0, pick a direction 𝒑0 somehow, then minimize f(𝒙0+𝒑0α0). This has a simple closed-form solution that does not involve matrix inversion:α0=𝒑0T(𝒃−𝑨𝒙0)𝒑0T𝑨𝒑0Geometrically, we start at some point 𝒙0 on some ellipsoid, then choose a direction and travel along that direction, until we hit the point where the ellipsoid is minimized in that direction. This is not necessarily the minimum, but it is progress towards it. Visually, it is moving along a line, and stopping as soon as we reach a point tangent to the contour ellipsoid. We can now repeat this procedure, starting at our new point 𝒙1=𝒙0+α0𝒑0, pick a new direction 𝒑1, compute α1, etc. We can summarize this as the following algorithm: Start by picking an initial guess 𝒙0, and compute the initial residual 𝒓0=𝒃−𝑨𝒙0, then iterate:

αi=𝒑iT𝒓i𝒑iT𝑨𝒑i,𝒙i+1=𝒙i+αi𝒑i,𝒓i+1=𝒓i−αi𝑨𝒑i where 𝒑0,𝒑1,𝒑2,… are to be picked. Notice in particular how the residual is calculated iteratively step-by-step, instead of anew every time:𝒓i+1=𝒃−𝑨𝒙i+1=𝒃−𝑨(𝒙i+αi𝒑i)=𝒓i−αi𝑨𝒑iIt is possibly true that αi=0 prematurely, which would bring numerical problems. However, for particular choices of 𝒑0,𝒑1,𝒑2,…, this will not occur before convergence, as we will prove below.

Conjugate directions If the directions 𝒑0,𝒑1,𝒑2,… are not picked well, then progress will be slow. In particular, the gradient descent method would be slow. This can be seen in the diagram, where the green line is the result of always picking the local gradient direction. It zig-zags towards the minimum, but repeatedly overshoots. In contrast, if we pick the directions to be a set of mutually conjugate directions, then there will be no overshoot, and we would obtain the global minimum after n steps, where n is the number of dimensions.

The concept of conjugate directions came from classical geometry of ellipse. For an ellipse, two semi-axes are mutually conjugate with respect to the ellipse iff the lines are parallel to the tangent bounding parallelogram, as pictured. The concept generalizes to n-dimensional ellipsoids, where n semi-axes t0𝒑0,…,tn−1𝒑n−1 are mutually conjugate with respect to the ellipsoid iff each axis is parallel to the tangent bounding parallelepiped. In other words, for any i, the tangent plane to the ellipsoid at 𝒄+ti𝒑i is a hyperplane spanned by the vectors {𝒑j:j≠i}, where 𝒄 is the center of the ellipsoid. Note that we need to scale each directional vector 𝒑i by a scalar ti, so that 𝒄+ti𝒑i falls exactly on the ellipsoid. Given an ellipsoid with equation 𝒙T𝑨𝒙−2𝒃T𝒙=Cfor some constant C, we can translate it so that its center is at origin. This changes the equation to 𝒙T𝑨𝒙=C′for some other constant C′. The condition of tangency is then:(ti𝒑i+𝒑jdtj)T𝑨(ti𝒑i+𝒑jdtj)=C′+O(dtj2),∀i≠jthat is, 𝒑iT𝑨𝒑j=0 for any i≠j. The conjugate direction method is imprecise in the sense that no formulae are given for selection of the directions 𝒑0,𝒑1,𝒑2,…. Specific choices lead to various methods including the conjugate gradient method and Gaussian elimination.

Gram–Schmidt process We can tabulate the equations that we need to set to zero:

This resembles the problem of orthogonalization, which requires 𝒑iT𝒑j=0 for any i≠j, and 𝒑iT𝒑j=1 for any i=j. Thus the problem of finding conjugate axes is less constrained than the problem of orthogonalization, so the Gram–Schmidt process works, with additional degrees of freedom that we can later use to pick the ones that would simplify the computation:

Arbitrarily set 𝒑0. Arbitrarily set 𝒑10, then modify it to 𝒑1=𝒑10−𝒑0T𝑨𝒑10𝒑0T𝑨𝒑0𝒑0. Arbitrarily set 𝒑20, then modify it to 𝒑2=𝒑20−∑i=01𝒑iT𝑨𝒑20𝒑iT𝑨𝒑i𝒑i. ... Arbitrarily set 𝒑n−1,0, then modify it to 𝒑n−1=𝒑n−1,0−∑i=0n−2𝒑iT𝑨𝒑n−1,0𝒑iT𝑨𝒑i𝒑i. The most natural choice of 𝒑k,0 is the gradient. That is, 𝒑k,0=∇f(𝒙k). Since conjugate directions can be scaled by a nonzero value, we scale it by −1/2 for notational cleanness, obtaining 𝒑k,0=𝐫k=𝐛−𝐀𝐱kThus, we have 𝒑k=𝒓k−∑i=0k−1𝒑iT𝑨𝒓k𝒑iT𝑨𝒑i𝒑i. Plugging it in, we have the conjugate gradient algorithm:𝐫0:=𝐛−𝐀𝐱0𝐩0:=𝐫0k:=0do while k<nαk:=𝐩k𝖳𝐫k𝐩k𝖳𝐀𝐩k𝐱k+1:=𝐱k+αk𝐩kif |αk| is sufficiently small, then exit loop𝐫k+1:=𝐫k−αk𝐀𝐩k𝐩k+1:=𝒓k+1−∑i=0k𝒑iT𝑨𝒓k+1𝒑iT𝑨𝒑i𝒑ik:=k+1return 𝐱k+1 as the resultProposition. If at some point, αk=0, then the algorithm has converged, that is, ∇f(xk+1)=0. Proof. By construction, it would mean that 𝐱k+1=𝐱k, that is, taking a conjugate gradient step gets us exactly back to where we were. This is only possible if the local gradient is already zero.

… excerpt ends here. Continue reading the full article.

Illustrations

Derivation of the conjugate gradient method: Two conjugate diameters of an ellipse. Each edge of the bounding parallelogram is parallel to one of the diameters.
Two conjugate diameters of an ellipse. Each edge of the bounding parallelogram is parallel to one of the diameters.

Worked examples

Example 1 — a first encounter with Derivation of the conjugate gradient method

Start with the simplest possible case. Write down what Derivation of the 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 Derivation of the 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 Derivation of the 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 Derivation of the conjugate gradient method

In research
Derivation of the 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 Derivation of the 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
Derivation of the conjugate gradient method is common in secondary-school and first-year university syllabi. It links to neighbouring topics Gradient methods, Numerical linear algebra, Optimization algorithms and methods, so understanding it makes those chapters shorter.
In everyday life
Look for Derivation of the 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 “Derivation of the conjugate gradient method” →

How to study Derivation of the conjugate gradient method in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Derivation of the 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 Derivation of the conjugate gradient method out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Derivation of the conjugate gradient method in simple terms?

In numerical linear algebra, the conjugate gradient method is an iterative method for numerically solving the linear system 𝑨𝒙=𝒃 where 𝑨 is symmetric positive-definite, without computing 𝑨−1 explicitly. The conjugate gradient method can be derived from several different perspectives, including…

Why does Derivation of the 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 Derivation of the 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 Derivation of the conjugate gradient method.

Tags

  • Gradient methods
  • Numerical linear algebra
  • Optimization algorithms and methods

Keep exploring