Part 5 · Chapter 20

Gradient-Based Methods

Chapter 19 established what a minimum is and why a downhill step works; this chapter turns that theory into working algorithms. Every method here fills in the same blank — which direction \(\mathbf{d}_k\) to take — and the differences among them are differences in how much curvature information they are willing to pay for. We begin with steepest descent, the cheapest and slowest; add the line-search rules (Armijo, Wolfe, backtracking) that make any descent method reliable; jump to Newton's method, the most expensive and fastest; and then meet the two great compromises that dominate practice — quasi-Newton updates such as DFP and BFGS, which learn curvature from gradients alone, and conjugate gradient, which achieves Newton-like behaviour on quadratics while storing almost nothing.

Optimization Techniques Prof. Mithun Mondal Reading time ≈ 55 min
i What you'll learn
  • Steepest descent — the negative-gradient direction, and the zigzag it suffers on ill-conditioned problems.
  • Step-length rules — exact line search, the Armijo sufficient-decrease test, backtracking, and the Wolfe conditions.
  • Newton's method — minimising the full quadratic model, its quadratic convergence, and its failure modes.
  • Modified and damped Newton — restoring positive definiteness and global reliability.
  • Quasi-Newton methods — the secant condition and the DFP and BFGS rank-two updates.
  • Conjugate gradient — \(\mathbf{A}\)-conjugate directions, finite termination, Fletcher–Reeves and Polak–Ribière.
Section 20-1

From Framework to Algorithm

Chapter 19 left us with a skeleton rather than a method. We know that from a current iterate \(\mathbf{x}_k\) we should move along a descent direction \(\mathbf{d}_k\) — one satisfying \(\nabla F(\mathbf{x}_k)^{\top}\mathbf{d}_k < 0\) — by a step length \(\alpha_k > 0\) found by a line search. What the framework never said is which descent direction to choose, and that single unanswered question is the whole content of this chapter.

The framework every method in this chapter fills in
\[ \mathbf{x}_{k+1} = \mathbf{x}_k + \alpha_k\,\mathbf{d}_k, \qquad \mathbf{d}_k = -\mathbf{B}_k^{-1}\,\nabla F(\mathbf{x}_k), \qquad \mathbf{B}_k \succ 0 \]

Writing the direction this way is the organising idea of the chapter. Every method below is a choice of the matrix \(\mathbf{B}_k\) — a model of the curvature at \(\mathbf{x}_k\). Note that whenever \(\mathbf{B}_k\) is positive definite, the descent test is automatic, since \(\nabla F^{\top}\mathbf{d}_k = -\nabla F^{\top}\mathbf{B}_k^{-1}\nabla F < 0\) for \(\nabla F \ne \mathbf{0}\). Positive definiteness of the curvature model is therefore not a technicality; it is what guarantees the method keeps going downhill at all.

MethodCurvature model \(\mathbf{B}_k\)Cost per iterationConvergence
Steepest descent\(\mathbf{I}\) — no curvature at allOne gradientLinear (often slow)
Newton\(\nabla^2 F(\mathbf{x}_k)\) — exact curvatureHessian + linear solveQuadratic (local)
Quasi-Newton (BFGS)Approximation built from gradientsOne gradient + updateSuperlinear
Conjugate gradientImplicit — via conjugate directionsOne gradient, \(O(n)\) storage\(n\) steps on a quadratic
One dial, three settings. Read the table as a single trade-off dial rather than four unrelated recipes. Turn it toward \(\mathbf{B}_k = \mathbf{I}\) and each iteration is trivially cheap but poorly informed, so you need many of them. Turn it toward \(\mathbf{B}_k = \nabla^2 F\) and each iteration is superbly informed but expensive, so you need few. Quasi-Newton and conjugate gradient sit in the middle and are, for that reason, what practitioners actually reach for.
Section 20-2

The Method of Steepest Descent

The simplest possible choice is to ignore curvature entirely: set \(\mathbf{B}_k = \mathbf{I}\), so that \(\mathbf{d}_k = -\nabla F(\mathbf{x}_k)\). This is the method of steepest descent (also called gradient descent or the Cauchy method, after its originator in 1847). It moves along the direction in which \(F\) decreases fastest locally — and that word locally is the source of all its trouble.

🔑
Steepest-descent iteration
\[ \mathbf{x}_{k+1} = \mathbf{x}_k - \alpha_k\,\nabla F(\mathbf{x}_k) \]

Start at \(\mathbf{x}_0\); at each step compute \(\nabla F(\mathbf{x}_k)\), choose \(\alpha_k\) by a line search, update, and stop when \(\lVert\nabla F(\mathbf{x}_k)\rVert \le \varepsilon\). It needs only first derivatives, needs no matrix storage, and is globally convergent to a stationary point under mild conditions — it will get there, eventually.

When \(F\) is quadratic, \(q(\mathbf{x}) = \tfrac12\mathbf{x}^{\top}\mathbf{A}\mathbf{x} - \mathbf{b}^{\top}\mathbf{x}\), the exact step length can be written down in closed form. Along the line \(\mathbf{x}_k - \alpha\mathbf{g}_k\) with \(\mathbf{g}_k = \nabla q(\mathbf{x}_k)\), the one-dimensional function \(\phi(\alpha)\) is a parabola in \(\alpha\), and setting \(\phi'(\alpha) = 0\) gives:

Exact step length for a quadratic
\[ \alpha_k = \frac{\mathbf{g}_k^{\!\top}\mathbf{g}_k}{\mathbf{g}_k^{\!\top}\mathbf{A}\,\mathbf{g}_k} \]

An exact line search has a curious and revealing consequence. Because \(\phi'(\alpha_k) = 0\) means \(\nabla F(\mathbf{x}_{k+1})^{\top}\mathbf{d}_k = 0\), consecutive steepest-descent directions are orthogonal. Each step therefore turns a perfect right angle from the last, and the trajectory zigzags. On a well-conditioned bowl (near-circular contours) the zigzag is harmless. On an ill-conditioned problem — long, thin, valley-like contours — it is catastrophic: the method bounces from wall to wall of the valley while creeping along its floor.

x₀ well-conditioned: κ ≈ 1
Circular contours: descent goes almost straight in
x₀ ill-conditioned: κ ≫ 1
Thin valley: right-angle turns produce a slow zigzag

This behaviour can be quantified. For a quadratic with Hessian \(\mathbf{A}\), define the condition number \(\kappa = \lambda_{\max}/\lambda_{\min}\), the ratio of the largest to smallest eigenvalue — geometrically, how elongated the contour ellipses are. Steepest descent with exact line search obeys the classical error bound:

Convergence rate of steepest descent
\[ \frac{\lVert \mathbf{x}_{k+1} - \mathbf{x}^\star\rVert_{\mathbf{A}}}{\lVert \mathbf{x}_{k} - \mathbf{x}^\star\rVert_{\mathbf{A}}} \;\le\; \frac{\kappa - 1}{\kappa + 1}, \qquad \kappa = \frac{\lambda_{\max}}{\lambda_{\min}} \]

The rate is linear, and the factor tells the whole story. For \(\kappa = 1\) the factor is \(0\) — one step lands exactly on the minimum. For \(\kappa = 10\) the factor is \(9/11 \approx 0.82\), tolerable. For \(\kappa = 1000\) it is \(0.998\), and the method effectively stalls. Since real engineering problems routinely have \(\kappa\) in the thousands, plain steepest descent is rarely the final answer — but it is the honest baseline against which everything else is measured.

Section 20-3

Step-Length Rules & Line Searches

Before refining the direction, we must settle the step. Chapter 18 gave exact methods — golden section, Fibonacci, quadratic interpolation — for minimising \(\phi(\alpha) = F(\mathbf{x}_k + \alpha\mathbf{d}_k)\). But an exact line search inside every iteration of a multivariable method is wasteful: we are solving a subproblem to high precision only to throw the point away and rebuild a new direction. Modern practice uses an inexact line search — accept any \(\alpha\) that makes enough progress.

What is "enough"? Simply requiring \(F(\mathbf{x}_{k+1}) < F(\mathbf{x}_k)\) is not enough — a sequence of ever-tinier decreases can converge to a non-stationary point. The Armijo condition (sufficient decrease) fixes this by demanding a decrease proportional to what the slope promised:

🔑
Armijo (sufficient decrease) condition
\[ F(\mathbf{x}_k + \alpha\mathbf{d}_k) \;\le\; F(\mathbf{x}_k) + c_1\,\alpha\,\nabla F(\mathbf{x}_k)^{\!\top}\mathbf{d}_k, \qquad 0 < c_1 < 1 \]

The right-hand side is a line through \(F(\mathbf{x}_k)\) with a fraction \(c_1\) of the initial slope. Any \(\alpha\) whose function value falls below this line is acceptable. In practice \(c_1\) is small — typically \(10^{-4}\) — so the test is easy to pass and mainly rules out pathologically small decreases.

Armijo alone still permits absurdly small steps, which also satisfy it. Two remedies exist. The first is backtracking: start optimistically at \(\alpha = 1\) and shrink by a factor \(\rho\) until Armijo passes. Because we test large steps first, the accepted step is never needlessly small, and no second condition is needed.

Backtracking line search
\[ \alpha \leftarrow \bar{\alpha}\ (\text{usually } 1); \quad \textbf{while } F(\mathbf{x}_k + \alpha\mathbf{d}_k) > F(\mathbf{x}_k) + c_1\alpha\nabla F_k^{\!\top}\mathbf{d}_k: \quad \alpha \leftarrow \rho\,\alpha \quad (\rho \approx 0.5) \]

The second remedy adds an explicit curvature condition, forbidding steps that stop while the slope is still steeply negative. Together with Armijo it forms the Wolfe conditions, the standard requirement quoted in convergence theorems and — crucially for Section 20-5 — the condition that keeps quasi-Newton matrices positive definite.

The Wolfe conditions
\[ \underbrace{F(\mathbf{x}_k + \alpha\mathbf{d}_k) \le F(\mathbf{x}_k) + c_1\alpha\nabla F_k^{\!\top}\mathbf{d}_k}_{\text{sufficient decrease}}, \qquad \underbrace{\nabla F(\mathbf{x}_k + \alpha\mathbf{d}_k)^{\!\top}\mathbf{d}_k \ \ge\ c_2\,\nabla F_k^{\!\top}\mathbf{d}_k}_{\text{curvature}}, \qquad 0 < c_1 < c_2 < 1 \]
α φ(α) slope ∇Fᵀd Armijo line: φ(0) + c₁α∇Fᵀd acceptable steps (curve below Armijo line) exact min
Armijo: accept any step whose value falls below the shallow reference line
Why inexact beats exact. It is tempting to think a better step length gives a better method. It rarely does. The direction is usually wrong anyway — steepest descent's direction is wrong by construction — so polishing \(\alpha_k\) to eight digits along a mediocre direction buys almost nothing at real cost in function evaluations. Backtracking typically settles in one to three trials, and the iterations saved elsewhere far outweigh the slightly worse step. Exact line search survives mainly where it is free: on quadratics, where the closed form of Section 20-2 applies.
Section 20-4

Newton's Method

Steepest descent uses only the linear term of the Taylor model. Newton's method uses the whole quadratic model and minimises it exactly. Recall the second-order expansion from Chapter 19: \(F(\mathbf{x}_k + \mathbf{p}) \approx F(\mathbf{x}_k) + \nabla F_k^{\top}\mathbf{p} + \tfrac12\mathbf{p}^{\top}\mathbf{H}_k\mathbf{p}\). Differentiate this model with respect to \(\mathbf{p}\), set the result to zero, and the Newton direction falls out immediately.

🔑
Newton's method
\[ \mathbf{H}_k\,\mathbf{d}_k = -\nabla F(\mathbf{x}_k), \qquad \mathbf{x}_{k+1} = \mathbf{x}_k + \mathbf{d}_k \]

The direction solves a linear system with the Hessian — we write it as a solve, never as \(\mathbf{d}_k = -\mathbf{H}_k^{-1}\nabla F_k\) in code, since forming the inverse costs more and is less stable. The natural step is \(\alpha_k = 1\): the model's own minimiser.

Two properties follow at once. First, on a quadratic function the model is not an approximation but the function itself, so Newton's method lands on the exact minimiser in a single step from any starting point. Second, on a general smooth \(F\), the model becomes ever more accurate as the iterates approach \(\mathbf{x}^\star\), and the method converges quadratically — the number of correct digits roughly doubles each iteration. Near the solution, three or four iterations is typical.

The price is threefold, and it is steep. Each iteration needs the \(n \times n\) matrix of second partial derivatives (\(O(n^2)\) entries, often unavailable analytically), then a linear solve (\(O(n^3)\) work). Worse, the method can fail. If \(\mathbf{H}_k\) is not positive definite — entirely possible far from the solution — the Newton direction need not even be a descent direction, and the method may march confidently toward a saddle point or a maximum. If \(\mathbf{H}_k\) is singular, the step is undefined.

Newton: 1 step steepest descent
On a quadratic, Newton solves it in one step
model curves the wrong way xₖ H not positive definite → step points uphill
Newton's failure mode: indefinite Hessian

Both defects are repaired by the same two ideas, giving the modified Newton method used in practice. First, damp the step: instead of accepting \(\alpha_k = 1\) blindly, run a line search on the Newton direction, so the method cannot overshoot far from the solution. (Near the solution the line search accepts \(\alpha_k = 1\) automatically, preserving quadratic convergence.) Second, modify the matrix: replace \(\mathbf{H}_k\) by \(\mathbf{H}_k + \mu\mathbf{I}\) with \(\mu > 0\) large enough to make it positive definite.

Modified (damped) Newton step
\[ (\mathbf{H}_k + \mu\mathbf{I})\,\mathbf{d}_k = -\nabla F(\mathbf{x}_k), \qquad \mathbf{x}_{k+1} = \mathbf{x}_k + \alpha_k\mathbf{d}_k \]

The shift \(\mu\mathbf{I}\) raises every eigenvalue by \(\mu\), so a large enough \(\mu\) guarantees positive definiteness and hence a descent direction. Notice what the two extremes of \(\mu\) give: as \(\mu \to 0\) we recover the pure Newton step, and as \(\mu \to \infty\) the direction tends toward \(-\nabla F_k/\mu\), a short steepest-descent step. The parameter therefore interpolates continuously between the two methods — cautious and gradient-like when far away, aggressive and Newton-like when close. This is exactly the idea behind the Levenberg–Marquardt method familiar from nonlinear least squares and curve fitting.

Section 20-5

Quasi-Newton Methods: DFP & BFGS

Newton's speed comes from curvature; its cost comes from computing curvature. Quasi-Newton methods ask the obvious question: can we get the curvature information for free, from the gradients we are already computing? The answer is yes, and it produces the most successful family of general-purpose optimizers ever devised.

The insight is that gradients differences already contain second-derivative information. Define the step and the gradient change over one iteration:

Step and gradient change
\[ \mathbf{s}_k = \mathbf{x}_{k+1} - \mathbf{x}_k, \qquad \mathbf{y}_k = \nabla F(\mathbf{x}_{k+1}) - \nabla F(\mathbf{x}_k) \]

For a quadratic with Hessian \(\mathbf{A}\), these satisfy \(\mathbf{y}_k = \mathbf{A}\mathbf{s}_k\) exactly. So we demand that our approximation \(\mathbf{B}_{k+1}\) reproduce this same relationship — the secant condition, the multivariable generalisation of the secant method's slope estimate.

🔑
The secant (quasi-Newton) condition
\[ \mathbf{B}_{k+1}\,\mathbf{s}_k = \mathbf{y}_k \qquad\text{equivalently}\qquad \mathbf{V}_{k+1}\,\mathbf{y}_k = \mathbf{s}_k \]

Here \(\mathbf{B}_{k+1}\) approximates the Hessian and \(\mathbf{V}_{k+1} \approx \mathbf{H}^{-1}\) approximates its inverse. Working with \(\mathbf{V}\) is preferred: the direction is then the cheap product \(\mathbf{d}_k = -\mathbf{V}_k\nabla F_k\), with no linear solve at all.

The secant condition is \(n\) equations for the \(n(n+1)/2\) unknowns of a symmetric matrix, so it does not determine \(\mathbf{V}_{k+1}\) — it leaves freedom, and different ways of using that freedom give different methods. The standard resolution is to take the previous matrix and add the smallest correction that satisfies the condition while preserving symmetry and positive definiteness. Two rank-two corrections have proved decisive.

DFP update (Davidon–Fletcher–Powell, 1959–63) — inverse-Hessian form
\[ \mathbf{V}_{k+1} = \mathbf{V}_k + \frac{\mathbf{s}_k\mathbf{s}_k^{\!\top}}{\mathbf{s}_k^{\!\top}\mathbf{y}_k} - \frac{\mathbf{V}_k\mathbf{y}_k\mathbf{y}_k^{\!\top}\mathbf{V}_k}{\mathbf{y}_k^{\!\top}\mathbf{V}_k\mathbf{y}_k} \]
BFGS update (Broyden–Fletcher–Goldfarb–Shanno, 1970) — inverse-Hessian form
\[ \mathbf{V}_{k+1} = \left(\mathbf{I} - \frac{\mathbf{s}_k\mathbf{y}_k^{\!\top}}{\mathbf{y}_k^{\!\top}\mathbf{s}_k}\right)\mathbf{V}_k\left(\mathbf{I} - \frac{\mathbf{y}_k\mathbf{s}_k^{\!\top}}{\mathbf{y}_k^{\!\top}\mathbf{s}_k}\right) + \frac{\mathbf{s}_k\mathbf{s}_k^{\!\top}}{\mathbf{y}_k^{\!\top}\mathbf{s}_k} \]

Both updates preserve symmetry, both satisfy the secant condition, and both preserve positive definiteness — but only if the curvature condition \(\mathbf{s}_k^{\top}\mathbf{y}_k > 0\) holds. This is precisely what the second Wolfe condition of Section 20-3 guarantees, which is why the two topics belong in the same chapter: the line-search rule is not decoration, it is what keeps the update legal.

Started from \(\mathbf{V}_0 = \mathbf{I}\), a quasi-Newton method therefore takes a steepest-descent step first and grows into a Newton-like method as it accumulates curvature. On a quadratic in \(n\) variables the accumulated \(\mathbf{V}_n\) equals \(\mathbf{A}^{-1}\) exactly and the method terminates in \(n\) steps. On general functions it converges superlinearly — slower than Newton's quadratic rate, but with no Hessian and no \(O(n^3)\) solve. BFGS is the default choice in virtually all modern software: it is markedly more robust than DFP under inexact line searches, and its self-correcting behaviour recovers gracefully from a bad curvature estimate that leaves DFP stuck.

PropertyNewtonDFPBFGS
Derivatives neededGradient + HessianGradient onlyGradient only
Work per iteration\(O(n^3)\) solve\(O(n^2)\) update\(O(n^2)\) update
Rate of convergenceQuadraticSuperlinearSuperlinear
Terminates on quadratic1 step\(n\) steps\(n\) steps
Tolerance of inexact line searchModeratePoorExcellent
Section 20-6

Conjugate Gradient Methods

Quasi-Newton methods buy speed with \(O(n^2)\) storage — a full matrix. When \(n\) is very large (think \(10^6\) variables in a finite-element or machine-learning model), that matrix cannot be stored at all. Conjugate gradient (CG) methods achieve finite termination on quadratics while storing only a handful of vectors.

The idea attacks the zigzag directly. Steepest descent zigzags because its successive directions are merely orthogonal — each new step partially undoes the progress of the last. The cure is to make directions orthogonal in the geometry of the problem itself, measured through \(\mathbf{A}\) rather than through the identity. Directions \(\mathbf{d}_0, \mathbf{d}_1, \dots\) are \(\mathbf{A}\)-conjugate if

Conjugacy (A-orthogonality)
\[ \mathbf{d}_i^{\!\top}\,\mathbf{A}\,\mathbf{d}_j = 0 \qquad \text{for all } i \ne j \]

The payoff is the expanding-subspace property: minimising along a set of \(\mathbf{A}\)-conjugate directions in turn means that a minimisation along \(\mathbf{d}_k\) never spoils the minimisations already achieved along \(\mathbf{d}_0,\dots,\mathbf{d}_{k-1}\). Each direction settles one "coordinate" of the problem permanently. Since \(n\) conjugate directions span \(\mathbb{R}^n\), the method reaches the exact minimiser of a quadratic in at most \(n\) steps. Conjugacy is, in effect, the geometrically correct notion of a right angle for this problem — it is orthogonality after the elongated contours have been mentally stretched back into circles.

Remarkably, such directions can be generated on the fly, without ever knowing \(\mathbf{A}\), by adding a single correction term to the negative gradient:

🔑
Conjugate gradient iteration
\[ \mathbf{d}_{k} = -\nabla F_{k} + \beta_{k}\,\mathbf{d}_{k-1}, \qquad \mathbf{x}_{k+1} = \mathbf{x}_k + \alpha_k \mathbf{d}_k \]

Start with \(\mathbf{d}_0 = -\nabla F_0\) — the first step is plain steepest descent. Thereafter each direction is the negative gradient "bent" by a multiple \(\beta_k\) of the previous direction, which is exactly the memory that prevents the zigzag.

Two classical formulas for \(\beta_k\) are in common use. They are identical on a quadratic with exact line search and differ on general functions:

Fletcher–Reeves and Polak–Ribière formulas
\[ \beta_k^{\mathrm{FR}} = \frac{\nabla F_k^{\!\top}\nabla F_k}{\nabla F_{k-1}^{\!\top}\nabla F_{k-1}}, \qquad\qquad \beta_k^{\mathrm{PR}} = \frac{\nabla F_k^{\!\top}\left(\nabla F_k - \nabla F_{k-1}\right)}{\nabla F_{k-1}^{\!\top}\nabla F_{k-1}} \]

On non-quadratic functions, Polak–Ribière is usually faster in practice, because when progress stalls the numerator \(\nabla F_k - \nabla F_{k-1}\) becomes small, \(\beta_k \to 0\), and the method automatically restarts itself with a fresh steepest-descent direction. (For theoretical guarantees one uses \(\beta_k = \max(\beta_k^{\mathrm{PR}}, 0)\).) In either case, deliberate restarting every \(n\) iterations is standard practice, since the conjugacy generated from a nonquadratic function degrades as the iterations accumulate.

Three ways of saying the same thing. Steepest descent forgets everything after each step; that is why it retraces its own mistakes. Quasi-Newton remembers everything, in an \(n\times n\) matrix. Conjugate gradient remembers exactly one vector — the previous direction — and it turns out that this is nearly enough. That is why CG dominates when \(n\) is huge: it captures most of the benefit of curvature at the storage cost of steepest descent.
Section 20-7

Choosing a Method

All methods in this chapter share the same stopping logic. Terminate when the gradient is small, \(\lVert\nabla F(\mathbf{x}_k)\rVert \le \varepsilon\) — the direct test of the first-order condition — and in practice back it up with a check that the iterates and function values have stopped moving, \(\lVert\mathbf{x}_{k+1} - \mathbf{x}_k\rVert \le \varepsilon_x\) and \(|F(\mathbf{x}_{k+1}) - F(\mathbf{x}_k)| \le \varepsilon_F\), plus an iteration cap. Note carefully what none of them can promise: all converge to a stationary point, and only convexity (Chapter 19) makes that point a global minimum.

SituationRecommended methodReason
Small \(n\), cheap analytic Hessian, good starting pointNewton (damped)Quadratic convergence in a handful of iterations
Moderate \(n\) (up to a few thousand), gradients availableBFGSSuperlinear with no Hessian; the general-purpose default
Very large \(n\), memory-limitedConjugate gradient or L-BFGS\(O(n)\) storage, no matrix to hold
Hessian indefinite or unreliable far from solutionModified Newton / Levenberg–MarquardtThe shift \(\mu\mathbf{I}\) restores a descent direction
Noisy or very cheap-to-evaluate gradientGradient descent variantsCurvature estimates are meaningless under noise

Two closing cautions. First, scaling matters more than the algorithm. A problem whose variables are measured in millimetres and megawatts has an enormous condition number for a purely clerical reason, and simply rescaling the variables to comparable magnitudes often does more good than switching methods. Second, all of these are local methods — they find the valley they were dropped into. For non-convex problems with many valleys, multiple starting points, or the global metaheuristics of Part 6, are the answer.

Section 20-8

Worked Examples

1 One steepest-descent step with exact line search

Problem. Minimise \(F(x,y) = x^2 + 4y^2\). Take one steepest-descent step from \(\mathbf{x}_0 = (2, 1)\) using an exact line search.

Solution. Here \(\nabla F = (2x,\ 8y)\), so \(\mathbf{g}_0 = (4,\ 8)\) and \(\mathbf{d}_0 = -(4,\ 8)\). The Hessian is \(\mathbf{A} = \begin{bmatrix} 2 & 0 \\ 0 & 8 \end{bmatrix}\), so use the closed form \(\alpha_0 = \dfrac{\mathbf{g}_0^{\top}\mathbf{g}_0}{\mathbf{g}_0^{\top}\mathbf{A}\mathbf{g}_0}\). Now \(\mathbf{g}_0^{\top}\mathbf{g}_0 = 16 + 64 = 80\) and \(\mathbf{A}\mathbf{g}_0 = (8,\ 64)\), giving \(\mathbf{g}_0^{\top}\mathbf{A}\mathbf{g}_0 = 32 + 512 = 544\). Hence \(\alpha_0 = \tfrac{80}{544} = \tfrac{5}{34} \approx 0.147\).

Then \(\mathbf{x}_1 = (2,1) - \tfrac{5}{34}(4,8) = (2 - 0.588,\ 1 - 1.176) \approx (1.412,\ -0.176)\), and \(F\) drops from \(F(\mathbf{x}_0) = 8\) to \(F(\mathbf{x}_1) \approx 2.12\). Note the sign change in \(y\) — the step overshot the valley floor and landed on the other side. That is the zigzag beginning.

2 Backtracking (Armijo) on the same problem

Problem. Repeat Example 1 with a backtracking line search: \(\bar\alpha = 1\), \(\rho = 0.5\), \(c_1 = 10^{-4}\).

Solution. We have \(F(\mathbf{x}_0) = 8\) and \(\nabla F_0^{\top}\mathbf{d}_0 = (4)(-4) + (8)(-8) = -80\). The Armijo test is \(F(\mathbf{x}_0 + \alpha\mathbf{d}_0) \le 8 - 0.008\,\alpha\).

\(\alpha = 1\): the trial point is \((2,1) + (-4,-8) = (-2,-7)\), where \(F = 4 + 196 = 200\). Since \(200 > 7.992\), reject and halve.
\(\alpha = 0.5\): trial point \((0,\ -3)\), \(F = 36 > 7.996\) — reject.
\(\alpha = 0.25\): trial point \((1,\ -1)\), \(F = 1 + 4 = 5 \le 7.998\) — accept.

So \(\alpha_0 = 0.25\), \(\mathbf{x}_1 = (1, -1)\), and \(F\) falls from \(8\) to \(5\). Compare with Example 1: the exact search reached \(2.12\), the backtracking search only \(5\) — a worse point, obtained with three function evaluations and no derivative work at all. In a full run, that cheapness usually wins.

3 Newton's method on a quadratic

Problem. Apply Newton's method to \(F(x,y) = x^2 + 4y^2\) from \(\mathbf{x}_0 = (2,1)\).

Solution. \(\nabla F_0 = (4,\ 8)\) and \(\mathbf{H} = \begin{bmatrix} 2 & 0 \\ 0 & 8 \end{bmatrix}\) (constant). Solve \(\mathbf{H}\mathbf{d}_0 = -\nabla F_0\): the system is \(2d_1 = -4\) and \(8d_2 = -8\), so \(\mathbf{d}_0 = (-2,\ -1)\). With \(\alpha_0 = 1\), \(\mathbf{x}_1 = (2,1) + (-2,-1) = (0,0)\) — the exact minimiser, in one step, where steepest descent needed dozens. The reason is structural: for a quadratic the Taylor model is exact, so minimising the model is minimising \(F\).

4 Newton's quadratic convergence in one variable

Problem. Minimise \(f(x) = e^{x} - 2x\) by Newton's method from \(x_0 = 0\), and observe the rate.

Solution. \(f'(x) = e^{x} - 2\), \(f''(x) = e^{x}\), and the iteration is \(x_{k+1} = x_k - f'(x_k)/f''(x_k)\). The true minimiser is \(x^\star = \ln 2 \approx 0.693147\).

\(k=0\): \(f'(0) = -1\), \(f''(0) = 1\), so \(x_1 = 0 - (-1)/1 = 1\). Error \(0.3069\).
\(k=1\): \(f'(1) = e - 2 = 0.71828\), \(f''(1) = 2.71828\), so \(x_2 = 1 - 0.26424 = 0.73576\). Error \(0.04261\).
\(k=2\): \(f'(x_2) = 0.08715\), \(f''(x_2) = 2.08715\), so \(x_3 = 0.73576 - 0.04176 = 0.69400\). Error \(0.00086\).

Watch the errors: \(0.307 \to 0.043 \to 0.00086\). Each is roughly the square of the one before (times a modest constant) — the signature of quadratic convergence, and the reason correct digits roughly double per step.

5 Checking the curvature condition for a BFGS update

Problem. Using the step from Example 1 on \(F(x,y) = x^2 + 4y^2\), form \(\mathbf{s}_0\) and \(\mathbf{y}_0\), and verify that a BFGS update is legal.

Solution. The step is \(\mathbf{s}_0 = \mathbf{x}_1 - \mathbf{x}_0 \approx (-0.588,\ -1.176)\). The new gradient is \(\nabla F(\mathbf{x}_1) = (2(1.412),\ 8(-0.176)) \approx (2.824,\ -1.412)\), so \(\mathbf{y}_0 = \nabla F_1 - \nabla F_0 \approx (2.824 - 4,\ -1.412 - 8) = (-1.176,\ -9.412)\).

The curvature condition requires \(\mathbf{s}_0^{\top}\mathbf{y}_0 > 0\): \((-0.588)(-1.176) + (-1.176)(-9.412) \approx 0.692 + 11.069 = 11.76 > 0\) ✓. The update is legal and will keep \(\mathbf{V}_1\) positive definite. As a check, note \(\mathbf{y}_0 = \mathbf{A}\mathbf{s}_0\) exactly here, since \(F\) is quadratic — this is the secant condition being satisfied by the true Hessian, which is exactly what the update is trying to imitate.

6 Conjugate gradient terminates in \(n = 2\) steps

Problem. Minimise \(q(\mathbf{x}) = \tfrac12\mathbf{x}^{\top}\mathbf{A}\mathbf{x} - \mathbf{b}^{\top}\mathbf{x}\) with \(\mathbf{A} = \begin{bmatrix} 4 & 1 \\ 1 & 3 \end{bmatrix}\), \(\mathbf{b} = (1,\ 2)^{\top}\), by conjugate gradient from \(\mathbf{x}_0 = (0,0)\). (Chapter 19, Example 4 found the answer directly as \(\mathbf{x}^\star = \mathbf{A}^{-1}\mathbf{b}\).)

Solution. Write \(\mathbf{r}_k = \mathbf{b} - \mathbf{A}\mathbf{x}_k = -\nabla q(\mathbf{x}_k)\) for the residual.

Step 1. \(\mathbf{r}_0 = (1,2)\), \(\mathbf{d}_0 = (1,2)\). Then \(\mathbf{A}\mathbf{d}_0 = (6,\ 7)\), so \(\mathbf{d}_0^{\top}\mathbf{A}\mathbf{d}_0 = 6 + 14 = 20\) and \(\alpha_0 = \tfrac{\mathbf{r}_0^{\top}\mathbf{r}_0}{\mathbf{d}_0^{\top}\mathbf{A}\mathbf{d}_0} = \tfrac{5}{20} = 0.25\). Hence \(\mathbf{x}_1 = (0.25,\ 0.5)\) and \(\mathbf{r}_1 = \mathbf{r}_0 - \alpha_0\mathbf{A}\mathbf{d}_0 = (1,2) - 0.25(6,7) = (-0.5,\ 0.25)\).

Step 2. \(\beta_1 = \tfrac{\mathbf{r}_1^{\top}\mathbf{r}_1}{\mathbf{r}_0^{\top}\mathbf{r}_0} = \tfrac{0.3125}{5} = 0.0625\), so \(\mathbf{d}_1 = \mathbf{r}_1 + \beta_1\mathbf{d}_0 = (-0.4375,\ 0.375)\). Check conjugacy: \(\mathbf{A}\mathbf{d}_1 = (-1.375,\ 0.6875)\) and \(\mathbf{d}_0^{\top}\mathbf{A}\mathbf{d}_1 = (1)(-1.375) + (2)(0.6875) = 0\) ✓. Now \(\mathbf{d}_1^{\top}\mathbf{A}\mathbf{d}_1 = 0.8594\), so \(\alpha_1 = \tfrac{0.3125}{0.8594} = 0.3636\), and \(\mathbf{x}_2 = (0.25,\ 0.5) + 0.3636(-0.4375,\ 0.375) = (0.0909,\ 0.6364)\).

This is exactly \(\mathbf{x}^\star = \tfrac{1}{11}(1,\ 7)\), the answer from Chapter 19 — reached in precisely \(n = 2\) steps, using only gradients and never inverting \(\mathbf{A}\).

Review

Chapter Summary

One framework

Every method is \(\mathbf{d}_k = -\mathbf{B}_k^{-1}\nabla F_k\); the choice of the curvature model \(\mathbf{B}_k\) is the choice of method.

Steepest descent

\(\mathbf{B}_k = \mathbf{I}\): cheap, robust, linear — and it zigzags, at a rate set by the condition number \(\kappa\).

Line searches

Armijo gives sufficient decrease, backtracking makes it practical, and Wolfe adds the curvature condition.

Newton

\(\mathbf{B}_k = \mathbf{H}_k\): quadratic convergence and one-step exactness on quadratics, but costly and unsafe if \(\mathbf{H}\) is indefinite — hence damping and \(\mathbf{H} + \mu\mathbf{I}\).

Quasi-Newton

The secant condition \(\mathbf{B}_{k+1}\mathbf{s}_k = \mathbf{y}_k\) builds curvature from gradients; BFGS is the robust default.

Conjugate gradient

\(\mathbf{A}\)-conjugate directions kill the zigzag and finish a quadratic in \(n\) steps with \(O(n)\) storage.

Practice

Problems

For each, compute gradients (and Hessians where needed), apply the relevant iteration, and state the result. Difficulty rises down the list.

  1. State the general descent iteration and explain why a positive-definite \(\mathbf{B}_k\) guarantees \(\mathbf{d}_k = -\mathbf{B}_k^{-1}\nabla F_k\) is a descent direction.
  2. Explain why consecutive steepest-descent directions are orthogonal under an exact line search, and why this causes zigzagging.
  3. For \(F(x,y) = x^2 + 9y^2\), compute the condition number \(\kappa\) and the steepest-descent error factor \((\kappa-1)/(\kappa+1)\). Comment on the speed.
  4. Take one steepest-descent step with exact line search on \(F(x,y) = 2x^2 + y^2\) from \(\mathbf{x}_0 = (1, 2)\), using \(\alpha_0 = \mathbf{g}_0^{\top}\mathbf{g}_0 / \mathbf{g}_0^{\top}\mathbf{A}\mathbf{g}_0\).
  5. State the Armijo condition and explain the role of \(c_1\). Why is a simple decrease \(F(\mathbf{x}_{k+1}) < F(\mathbf{x}_k)\) insufficient?
  6. Perform a backtracking line search (\(\bar\alpha = 1\), \(\rho = 0.5\), \(c_1 = 10^{-4}\)) on \(F(x,y) = x^2 + 4y^2\) from \(\mathbf{x}_0 = (1, 1)\) along \(\mathbf{d}_0 = -\nabla F_0\).
  7. State both Wolfe conditions and explain which one prevents excessively short steps.
  8. Apply Newton's method to \(F(x,y) = 3x^2 + 2xy + 2y^2 - 4x + 2y\) from any starting point, and verify it converges in one step.
  9. Use Newton's method to minimise \(f(x) = x^4 - 4x\) from \(x_0 = 2\), performing three iterations, and tabulate the errors against \(x^\star = 1\).
  10. At a point where \(\mathbf{H} = \begin{bmatrix} 1 & 0 \\ 0 & -3 \end{bmatrix}\) and \(\nabla F = (1, 1)^{\top}\), show that the pure Newton direction is not a descent direction. Find the smallest integer \(\mu\) for which \(\mathbf{H} + \mu\mathbf{I}\) is positive definite.
  11. State the secant condition and show that \(\mathbf{y}_k = \mathbf{A}\mathbf{s}_k\) holds exactly for a quadratic with Hessian \(\mathbf{A}\).
  12. Explain why the curvature condition \(\mathbf{s}_k^{\top}\mathbf{y}_k > 0\) is needed for the BFGS update, and which Wolfe condition guarantees it.
  13. Starting from \(\mathbf{V}_0 = \mathbf{I}\), carry out one DFP update for \(F(x,y) = x^2 + 4y^2\) using the step of Worked Example 1, and compare \(\mathbf{V}_1\) with \(\mathbf{A}^{-1}\).
  14. Prove that if \(\mathbf{d}_0, \mathbf{d}_1\) are \(\mathbf{A}\)-conjugate and \(\mathbf{A} \succ 0\), then they are linearly independent.
  15. Apply conjugate gradient to \(q(\mathbf{x}) = \tfrac12\mathbf{x}^{\top}\mathbf{A}\mathbf{x} - \mathbf{b}^{\top}\mathbf{x}\) with \(\mathbf{A} = \begin{bmatrix} 2 & 1 \\ 1 & 2 \end{bmatrix}\), \(\mathbf{b} = (1, 1)^{\top}\), from \(\mathbf{x}_0 = (0,0)\). Verify termination in two steps and check \(\mathbf{d}_0^{\top}\mathbf{A}\mathbf{d}_1 = 0\).
  16. Compare Fletcher–Reeves and Polak–Ribière, and explain why the latter restarts itself automatically when progress stalls.
  17. A problem has \(n = 10^6\) variables. Rank steepest descent, BFGS, Newton, and conjugate gradient by memory requirement, and justify the practical choice.
Tip: when a question asks you to "take one step", keep the two halves of the iteration separate in your mind — direction first, length second. The direction is what identifies the method: \(-\nabla F\) is steepest descent, \(-\mathbf{H}^{-1}\nabla F\) is Newton, \(-\mathbf{V}\nabla F\) is quasi-Newton, and \(-\nabla F + \beta\mathbf{d}_{\text{prev}}\) is conjugate gradient. Only once the direction is fixed do you ask for \(\alpha_k\), and there you have exactly two options: the closed form \(\mathbf{g}^{\top}\mathbf{g}/\mathbf{g}^{\top}\mathbf{A}\mathbf{g}\) if the problem is quadratic and the search is exact, or a backtracking loop against the Armijo test if it is not. Mixing the two halves up — trying to find a step length before committing to a direction — is the single most common source of confusion in this chapter.