M5 · Unconstrained algorithms, from zero: line search, gradient descent, Newton, CG

Chapters 2, 3, 4 · about 2 hours to learn, 45 min of practice · Goal: given a quadratic, find the gradient-descent step range and rate, do an exact-line-search step and two CG steps by hand, count CG steps from eigenvalues, check Armijo/Wolfe for a given α, do one Newton step, and write the expanding-subspace proof steps.

How this page works

It's a story: each section uses only what came before. Every formula appears after the idea it expresses, and then a worked example with numbers. Small Check boxes let you test yourself as you go (answers hidden). The one-page summary is at the very end; use it for revision, not for learning.

Notation used (one letter = one meaning on this page):

  • $x\in\mathbb R^n$ = the point (a column vector); $x_k$ = the point after $k$ steps; $x^*$ = the minimiser; $f^*=f(x^*)$ = the smallest value.
  • $\nabla f(x)$ = the gradient (vector of partial derivatives); $g_k=\nabla f(x_k)$, the gradient at step $k$. ($g$ always means a gradient here.)
  • $d_k$ = the direction we walk in at step $k$; $\alpha_k\gt 0$ = the step length (how far we walk along $d_k$).
  • $\phi(\alpha)=f(x_k+\alpha d_k)$ = "$f$ along the line" (a function of one number $\alpha$); $\phi'$ = its derivative. (His Ch 2 notes call this $g(\alpha)$; we use $\phi$ because $g$ is the gradient.)
  • $u^Tv=u_1v_1+\dots+u_nv_n$ (dot product); $\|v\|=\sqrt{v^Tv}$ (length); $\|v\|_Q=\sqrt{v^TQv}$ ("Q-length").
  • $Q$ = a symmetric matrix with all eigenvalues $\gt0$ ("symmetric positive definite", SPD, written $Q\succ0$); $f(x)=\tfrac12x^TQx-b^Tx$ is "the quadratic"; $e_k=x_k-x^*$ = the error.
  • $\lambda_1\le\dots\le\lambda_n$ = eigenvalues of $Q$, also written $\lambda_{\min}=\lambda_1$, $\lambda_{\max}=\lambda_n$; $q_i$ = the matching unit eigenvectors ($Qq_i=\lambda_iq_i$); $\kappa=\lambda_{\max}/\lambda_{\min}$ = condition number.
  • $H_k=\nabla^2f(x_k)$ = Hessian (matrix of second derivatives); $p_k$ = the Newton step. In H9 the course writes $F(x_k)$ for the Hessian.
  • $\beta_k$ = the CG mixing number (section H); $B$ = the preconditioner (H8); $c_1,c_2,c$ = line-search constants; $s$ = backtracking factor; $\rho$ = golden-section fraction; $\theta_k$ = angle between $d_k$ and $-g_k$.
  • Letters the past papers reuse (read them by section): $c_1,c_2,c$ are line-search constants, but $c_i=d_i^Tg_0$ and $h_i=d_i^TQd_i$ are numbers in H4 and P4 (Midterm 1 VI's notation), and $h(z)$ in H3 and Quiz 2 Q1 is a function (not $h_i$) · $\varepsilon_i$ = the component of the error along $q_i$ (C2, D1) · $\mu$, $\mu_j$ = particular eigenvalues singled out (E4, H7); P2 (Midterm 1 III) calls its two outlier eigenvalues $\lambda_1,\lambda_2$, and there they are the two largest, not the smallest · $\eta$ = a fixed step length, the same role as a fixed $\alpha$ (E4, P2) · $\nabla f_k=\nabla f(x_k)=g_k$ (N8) · $r_k=\|x_k\|$ (a radius) in F and P3, but $r_k=g_k^Td_k/\|g_k\|^2$ in Quiz 2 Q12, and $r(t)$ = the CG polynomial in Quiz 2 Q8–Q9 (H7 calls it $R_k$) · $\rho$ = golden-section fraction in B5, but $\rho(\alpha)$ = worst-case factor in P1 · $s$ = backtracking factor (B4); the unknown in H2 is called $w$ (Quiz 2 Q3 calls it $s$) · $p_k$ = Newton step (G), $p$ = the exponent (F), $P(t)$ = a polynomial (E4).
  • $E(x)$ = an "error energy". Careful: Quiz 2 uses $E(x)=\|x-x^*\|_Q^2$ (no ½); the Ch 3 notes use $E(x)=\tfrac12\|x-x^*\|_Q^2=f(x)-f^*$. Read which one a question uses.

0. Why this topic exists

We want the lowest point of a function $f(x)$, with no constraints on $x$. Chapter 1 told you how to recognise a minimiser: $\nabla f(x^*)=0$ and the Hessian is positive semidefinite. But "solve $\nabla f(x)=0$" is a system of $n$ nonlinear equations. For real problems you can't solve it by hand, and $n$ may be in the thousands.

So instead we walk downhill. Start anywhere, look at the slope, take a step that goes down, and repeat until the slope is (nearly) zero. Every method in this module is a version of that walk. They differ in only two choices:

  • Which way to step (the direction $d_k$): straight down the slope (steepest descent), a curvature-corrected direction (Newton), or a direction that doesn't undo earlier progress (conjugate gradient, CG).
  • How far to step (the step length $\alpha_k$): the best possible along the line (exact line search), a fixed number, or anything "good enough" (Armijo, Wolfe).

Why quadratics get so much attention. Near a minimiser, every smooth function looks like a quadratic (that's Taylor's theorem). So how fast a method finishes is decided by how it behaves on $f=\tfrac12x^TQx-b^Tx$. On a quadratic everything can be computed exactly, which is why the exam questions are on quadratics.

Roadmap: A = the walk-downhill template. B = choosing the step length (Ch 2). C = the quadratic test case. D, E = gradient descent with fixed and with exact steps (Ch 3). F = a fixed-step counterexample family from Midterm 1. G = Newton (Ch 2 in 1-D, Ch 3 in n-D). H = conjugate gradient (Ch 4). I = the exam recipe. Past papers: Midterm 1 Q II, III, V, VI and all of Quiz 2 come from here. Ch 2 and Ch 3 Newton have never been examined, so expect cheap MCQs on them.

A. The descent template

A1. Which directions go downhill?

Plain words. Stand at a point $x$. If you take a tiny step $t$ in direction $d$, the height changes by about "slope along $d$" × $t$. The slope along $d$ is the dot product $\nabla f(x)^Td$. That comes from first-order Taylor:

$$f(x+td)\approx f(x)+t\,\nabla f(x)^Td\qquad(t\text{ small}).$$

So if $\nabla f(x)^Td\lt0$, small steps along $d$ go down.

With numbers (this function is used all through A and B)

$f(x)=x_1^2+4x_2^2$ at $x=(2,1)$. Then $f(x)=4+4=8$ and $\nabla f=(2x_1,\,8x_2)=(4,8)$.

direction $d$slope $\nabla f^Td$verdict
$(-1,0)$$-4$downhill (descent direction)
$(1,-1)$$4-8=-4$downhill, even though it increases $x_1$
$(2,-1)$$8-8=0$along the level curve: not a descent direction
$(1,0)$$+4$uphill
$-\nabla f=(-4,-8)$$-16-64=-80$steepest downhill

Sanity check with a real step: $f(1.99,\,1)=3.9601+4=7.9601\approx 8+0.01\times(-4)$ ✓.

Definition: descent direction

$d_k$ is a descent direction at $x_k$ if $\ \nabla f(x_k)^Td_k\lt0$. Then $f(x_k+\alpha d_k)\lt f(x_k)$ for all small enough $\alpha\gt0$.

Write $\theta_k$ for the angle between $d_k$ and $-g_k$: $\ \cos\theta_k=\dfrac{-g_k^Td_k}{\|g_k\|\,\|d_k\|}$. Descent ⇔ $\cos\theta_k\gt0$ ⇔ $d_k$ is less than 90° away from $-g_k$.

x* ∇f = (4,8): uphill (1,0): slope +4 (−1,0): slope −4 −∇f: steepest down x = (2,1) dashed: level-curve tangent (slope 0) shaded: every descent direction level curves f = 2, 8, 18
Level curves of $f=x_1^2+4x_2^2$ (ellipses). At $x=(2,1)$ the gradient (red) points uphill, perpendicular to the level curve. Every direction pointing into the green half-plane (the side of the dashed tangent line away from $\nabla f$) is a descent direction. $-\nabla f$ (blue) is the steepest one.

Why $-\nabla f$ is "steepest". For a unit-length $d$, $\nabla f^Td=\|\nabla f\|\cos(\text{angle between them})$. That is most negative when the angle is 180°, i.e. $d=-\nabla f/\|\nabla f\|$.

The template every method in this module follows

$$x_{k+1}=x_k+\alpha_k\,d_k,\qquad\text{with }d_k\text{ a descent direction and }\alpha_k\gt0.$$

Repeat until $\|\nabla f(x_k)\|$ is tiny. The methods differ only in how they choose $d_k$ (sections D–H) and $\alpha_k$ (section B).

Check A1. For $f=x_1^2+4x_2^2$ at $(2,1)$: is $d=(0,-1)$ a descent direction? What about $d=(-2,1)$?
Show answer

$(4,8)\cdot(0,-1)=-8\lt0$: yes. $(4,8)\cdot(-2,1)=-8+8=0$: no (it's tangent to the level curve; "descent" needs strictly negative).

A2. Turning the step-length choice into a 1-D problem: $\phi(\alpha)$

Once $x_k$ and $d_k$ are fixed, the only unknown is the number $\alpha$. So look at $f$ along the line:

$$\phi(\alpha)=f(x_k+\alpha d_k),\qquad \phi'(\alpha)=\nabla f(x_k+\alpha d_k)^Td_k\ \ \text{(chain rule)},\qquad\phi'(0)=g_k^Td_k\lt0.$$

$\phi(0)=f(x_k)$ is where we stand. $\phi'(0)$ is the starting slope, negative because $d_k$ is a descent direction.

With numbers

Same $f$, $x_k=(2,1)$, $d_k=-\nabla f=(-4,-8)$. Then $x_k+\alpha d_k=(2-4\alpha,\ 1-8\alpha)$ and

$$\phi(\alpha)=(2-4\alpha)^2+4(1-8\alpha)^2=(4-16\alpha+16\alpha^2)+(4-64\alpha+256\alpha^2)=8-80\alpha+272\alpha^2.$$

$\phi'(\alpha)=-80+544\alpha$, so $\phi'(0)=-80$, the same as $g_k^Td_k=-80$ from the table ✓. We use this $\phi$ for every rule in section B.

B. Choosing the step length $\alpha$ (Chapter 2)

B1. Exact line search: the best $\alpha$ along the line

Idea. Pick the $\alpha$ that makes $\phi$ smallest: $\alpha_k=\arg\min_{\alpha\gt0}\phi(\alpha)$. In our example $\phi'(\alpha)=-80+544\alpha=0$ gives $\alpha^*=\frac{80}{544}=\frac{5}{34}\approx0.147$, with $\phi(\alpha^*)=\frac{36}{17}\approx2.12$ (down from 8).

For any quadratic $f=\tfrac12x^TQx-b^Tx$ (here $Q$ is a fixed symmetric matrix with all eigenvalues positive and $b$ a fixed vector; its gradient is $g=Qx-b$; section C studies these properly) there is a formula. Expand: $\phi(\alpha)=f(x_k)+\alpha\,g_k^Td_k+\tfrac12\alpha^2\,d_k^TQd_k$. Set $\phi'(\alpha)=g_k^Td_k+\alpha\,d_k^TQd_k=0$:

$$\boxed{\alpha_k=-\frac{g_k^Td_k}{d_k^TQd_k}}\qquad\text{and for }d_k=-g_k:\quad\boxed{\alpha_k=\frac{g_k^Tg_k}{g_k^TQg_k}}.$$

Check: $x_1^2+4x_2^2=\tfrac12x^T\begin{pmatrix}2&0\\0&8\end{pmatrix}x$, so $d^TQd=2\cdot16+8\cdot64=544$ and $-g^Td=80$: $\alpha=80/544=5/34$ ✓.

Why not always do this? For a non-quadratic $f$ there's no formula. Finding the exact minimiser of $\phi$ takes many evaluations of $f$, and the next iteration throws the line away anyway. So in practice we accept any step that is "good enough". The rest of B says what "good enough" means.

B2. "Just make $f$ go down" is not enough. Armijo: not too long

Two ways to fail while $f$ decreases every step (take $f(x)=x^2$, minimiser 0):

  • Steps too short: $x_k=1+2^{-k}$: $2,\ 1.5,\ 1.25,\dots$ Every step lowers $f$, but the steps shrink so fast that you stop at 1, not 0.
  • Steps too long: $x_k=(-1)^k(1+2^{-k})$: $2,\ -1.5,\ 1.25,\dots$ Every step lowers $f$, but you bounce across the valley and end up oscillating between $\pm1$.

So we need a rule that demands a real decrease (stops long, bouncing steps) and a rule that forbids tiny steps.

Armijo (sufficient decrease). The tangent line at $\alpha=0$ "promises" a decrease of $\alpha|\phi'(0)|$. Demand that you get at least a fraction $c_1$ of that promise:

$$\boxed{\phi(\alpha)\le\phi(0)+c_1\,\alpha\,\phi'(0)},\qquad 0\lt c_1\lt1\ \text{(typically small, e.g. }0.1\text{ or }10^{-4}).$$

Picture: the right side is a straight line starting at $\phi(0)$, less steep than the tangent. Armijo asks the curve to lie below this line.

With numbers ($c_1=0.1$)

Armijo line: $8+0.1\cdot\alpha\cdot(-80)=8-8\alpha$. Condition: $8-80\alpha+272\alpha^2\le8-8\alpha\iff272\alpha^2\le72\alpha\iff\alpha\le\frac{72}{272}=\frac{9}{34}\approx0.265$.

So Armijo accepts every $\alpha\in(0,\,9/34]$. It caps the step from above. But it also accepts $\alpha=0.0001$, which barely moves: Armijo alone does not stop too-short steps.

φ(0) = 8 tangent, slope φ′(0) = −80 Armijo line 8 − 8α (slope c₁φ′(0)) φ(α) α* Armijo accepts 0 < α ≤ 9/34 ≈ 0.265 α 0.10.20.3
$\phi(\alpha)=8-80\alpha+272\alpha^2$ (blue). Red dashed: the tangent at 0, i.e. what a linear model promises. Purple: the Armijo line, a flatter copy. Armijo accepts $\alpha$ where blue is below purple: the green stretch $(0,\,9/34]$. Past the purple dot the curve rises above the line (too long).

B3. Not too short: Wolfe's curvature condition, strong Wolfe, Goldstein

Idea. If at your chosen $\alpha$ the curve is still going down steeply, you stopped too early: going further would clearly help. So demand that the slope has flattened enough:

$$\textbf{Wolfe curvature:}\quad\boxed{\phi'(\alpha)\ge c_2\,\phi'(0)},\qquad 0\lt c_1\lt c_2\lt1.$$

Both sides are slopes; the right side is a negative number. "≥" means the slope at $\alpha$ is less negative than $c_2$ times the starting slope. Near $\alpha=0$ the slope is still about $\phi'(0)$, which is below $c_2\phi'(0)$, so tiny steps fail. Wolfe conditions = Armijo + curvature. ($c_1\lt c_2$ guarantees that some $\alpha$ passes both, for any $f$ that is bounded below along the line.)

Strong Wolfe replaces the curvature condition by $\ |\phi'(\alpha)|\le c_2|\phi'(0)|$. This also forbids landing where the slope is steeply positive, i.e. far past the bottom of the dip.

Goldstein uses two straight lines and no derivative at $\alpha$ (needs $0\lt c\lt\tfrac12$):

$$\phi(0)+(1-c)\,\alpha\,\phi'(0)\ \le\ \phi(\alpha)\ \le\ \phi(0)+c\,\alpha\,\phi'(0).$$

The right inequality is Armijo with $c_1=c$. The left one is a lower fence: near $\alpha=0$ the curve hugs its tangent, which lies below the steeper fence line, so tiny steps fail. (Drawback: on a non-quadratic $\phi$ the fence can cut off the true minimiser of $\phi$.)

With numbers: all four rules on $\phi(\alpha)=8-80\alpha+272\alpha^2$

Take $c_1=0.1$, $c_2=0.5$, Goldstein $c=0.25$. Recall $\phi'(\alpha)=-80+544\alpha$, $\phi'(0)=-80$.

  1. Armijo (B2): $\alpha\le9/34\approx0.265$.
  2. Curvature: $-80+544\alpha\ge0.5\cdot(-80)=-40\iff\alpha\ge\frac{40}{544}=\frac{5}{68}\approx0.074$. Wolfe interval: $[5/68,\ 9/34]$.
  3. Strong Wolfe: $-40\le-80+544\alpha\le40\iff\frac{5}{68}\le\alpha\le\frac{120}{544}=\frac{15}{68}\approx0.221$.
  4. Goldstein: upper: $8-80\alpha+272\alpha^2\le8-20\alpha\iff\alpha\le\frac{60}{272}=\frac{15}{68}$; lower: $8-80\alpha+272\alpha^2\ge8-60\alpha\iff\alpha\ge\frac{20}{272}=\frac{5}{68}$. Interval $[5/68,\,15/68]$ (equal to strong Wolfe here only because of these constants).
Armijo Wolfe strong Wolfe Goldstein α* = 5/34 0 5/68 15/68 9/34
Which $\alpha$ each rule accepts for our $\phi$ ($c_1=0.1$, $c_2=0.5$, $c=0.25$). Armijo alone allows steps near 0. The curvature condition removes them. Plain Wolfe still allows big overshoots past $\alpha^*$ (up to $9/34$, where the slope is $+64$); strong Wolfe cuts those off.

Why you need both Wolfe conditions (he stressed this, see "What he said"). Armijo alone accepts tiny steps. Curvature alone accepts huge ones: $\alpha=0.3$ has $\phi'(0.3)=83.2\ge-40$, so it passes curvature, yet $\phi(0.3)=8.48\gt8$, so $f$ went up.

Armijo, Wolfe, strong Wolfe and Goldstein on φ(α) = 8 − 80α + 272α²

Drag left/right on the picture to move the trial step α (the dot on the curve); move the sliders for c₁, c₂ and Goldstein's c. Watch which coloured bars the dashed vertical line crosses: exactly those rules accept this α.

What to notice. With the page's values ($c_1=0.1$, $c_2=0.5$, $c=0.25$) the bars are exactly the B3 numbers: Armijo $(0,\,9/34]$, Wolfe $[5/68,\,9/34]$, strong Wolfe and Goldstein $[5/68,\,15/68]$. The Armijo bar always starts at 0 (tiny steps pass); the curvature condition is what cuts them off. Raise $c_2$ towards 1 and the lower end slides to 0; raise $c_1$ and the upper end shrinks. Plain Wolfe reaches well past $\alpha^*$ (an overshoot); strong Wolfe trims it. Try the buttons: they are the answers to Check B.
His Exercise 2.3: the general intervals for a quadratic $\phi$

$\phi(\alpha)=\phi(0)-\sigma\alpha+\tfrac{\omega}{2}\alpha^2$ with $\sigma,\omega\gt0$ (so $\phi'(0)=-\sigma$ and $\phi'(\alpha)=-\sigma+\omega\alpha$). Our example is $\sigma=80$, $\omega=544$.

  1. Exact minimiser: $\phi'(\alpha)=0\Rightarrow\alpha^*=\sigma/\omega$.
  2. Armijo: $-\sigma\alpha+\tfrac{\omega}{2}\alpha^2\le-c_1\sigma\alpha\iff\alpha\le\dfrac{2(1-c_1)\sigma}{\omega}$. So $\alpha\in(0,\,2(1-c_1)\alpha^*]$.
  3. Curvature: $-\sigma+\omega\alpha\ge-c_2\sigma\iff\alpha\ge(1-c_2)\alpha^*$. Wolfe interval: $[(1-c_2)\alpha^*,\ 2(1-c_1)\alpha^*]$.
  4. Strong Wolfe adds $-\sigma+\omega\alpha\le c_2\sigma\iff\alpha\le(1+c_2)\alpha^*$. Interval: $[(1-c_2)\alpha^*,\ \min\{1+c_2,\,2(1-c_1)\}\alpha^*]$.
  5. Goldstein: $\alpha\in[2c\,\alpha^*,\ 2(1-c)\alpha^*]$. Since $c\lt\frac12$, it always contains $\alpha^*$.
  6. Lesson: ordinary Wolfe can accept steps up to almost $2\alpha^*$ (a big overshoot); strong Wolfe limits the overshoot to $(1+c_2)\alpha^*$.

All five formulas checked with sympy; with $\sigma=80,\omega=544,c_1=0.1,c_2=0.5,c=0.25$ they give the numbers above.

B4. Backtracking: the practical Armijo rule

Try $\alpha=1$. If Armijo fails, multiply by a fixed $s\in(0,1)$ and try again: $\alpha=1,\,s,\,s^2,\dots$ Accept the first $\alpha$ that passes Armijo.

Why no curvature check is needed: you start big and shrink by a fixed factor, so you can't end up absurdly small. The accepted step is at least $s$ times a step that failed. Starting at $\alpha=1$ matters for Newton's method (section G), where $\alpha=1$ is the natural full step.

With numbers ($c_1=0.1$, $s=\tfrac12$)

$\alpha=1$: $\phi(1)=200\gt8-8=0$ ✗. $\alpha=\tfrac12$: $\phi=36\gt4$ ✗. $\alpha=\tfrac14$: $\phi=8-20+17=5\le6$ ✓. Accept $\alpha=0.25$. Note that it overshoots $\alpha^*\approx0.147$ and fails strong Wolfe ($\phi'(0.25)=+56$): Armijo only caps the step.

Traps in B
  • The curvature condition is $\phi'(\alpha)\ge c_2\phi'(0)$, a lower bound on the slope (the right side is negative). Students write $\le$.
  • $0\lt c_1\lt c_2\lt1$ (strict). Goldstein needs $c\lt\frac12$. The FR theorem (H9) needs $c_2\lt\frac12$.
  • Armijo bounds $\alpha$ from above only; curvature/Goldstein-left bound it from below. You cannot drop either Wolfe condition in general.
Check B. For $\phi(\alpha)=8-80\alpha+272\alpha^2$ with $c_1=0.1$, $c_2=0.5$: does $\alpha=0.02$ pass Armijo? Wolfe? Does $\alpha=0.25$ pass strong Wolfe?
Show answer

$\alpha=0.02$: $\phi=6.509\le7.84$, Armijo ✓; $\phi'(0.02)=-69.1\lt-40$, curvature ✗ (too short), so not Wolfe. $\alpha=0.25$: $|\phi'|=56\gt40$, strong Wolfe ✗ (too far past the bottom).

B5. Golden section: a 1-D search with no derivatives

Setting. $\phi$ is unimodal on a bracket $[a,b]$: it goes down, then up, with one dip. You can only evaluate $\phi$.

Idea. Put two interior points in the bracket and compare $\phi$ there. The dip can't be beyond the worse point (unimodality), so throw that outer piece away. To save work, place the points so that the surviving interior point can be reused in the next round: one new evaluation per round.

Deriving the golden fraction
  1. Bracket $[0,1]$, points at $\rho$ and $1-\rho$ (symmetric, $\rho\lt\tfrac12$).
  2. Say $\phi(\rho)\le\phi(1-\rho)$. Keep $[0,\,1-\rho]$ (length $1-\rho$). Its right interior point should sit at fraction $1-\rho$ of the new length: $(1-\rho)^2$.
  3. Reuse means that point is the old $\rho$: $(1-\rho)^2=\rho\iff\rho^2-3\rho+1=0\iff\rho=\dfrac{3-\sqrt5}{2}\approx0.382$.
  4. Each round multiplies the bracket length by $1-\rho=\frac{\sqrt5-1}{2}\approx0.618$, with one new evaluation.

Numbers. On $[0,10]$: points $3.82$ and $6.18$. If $\phi(3.82)\le\phi(6.18)$, the new bracket is $[0,6.18]$, whose points are $0.382\times6.18=2.36$ (new) and $0.618\times6.18=3.82$ (old, reused). After 4 rounds the length is $10\times0.618^4\approx1.46$.

010 3.826.18 2.36 (new)3.82 (reused) discarded: (6.18, 10] 0
Top: first bracket with its two points. If $\phi(3.82)\le\phi(6.18)$, keep $[0,6.18]$ (bottom, blue). Its two points are $2.36$ (one new evaluation) and $3.82$ (reused).

B6. Zoutendijk's theorem in plain words

Question. If we only use "good enough" steps, do we still reach a point where $\nabla f=0$? Answer: yes, provided the directions don't become nearly perpendicular to the gradient.

Zoutendijk

If $f$ is bounded below, $\nabla f$ is Lipschitz (it can't change arbitrarily fast), the $d_k$ are descent directions and every $\alpha_k$ satisfies the Wolfe conditions (B3; strong Wolfe also works, since it implies Wolfe), then $$\sum_k\cos^2\theta_k\,\|\nabla f(x_k)\|^2\lt\infty.$$ So if $\cos\theta_k\ge\delta\gt0$ for all $k$ (the angle stays bounded away from 90°), then $\|\nabla f(x_k)\|\to0$.

The Ch 2 notes state the theorem with strong Wolfe steps. The standard theorem needs only the ordinary Wolfe conditions (Armijo + curvature); strong Wolfe is a special case. So if an MCQ asks what is needed: Wolfe steps (not exact line search).

Reading it: each step makes "useful progress" of about $\cos^2\theta_k\|g_k\|^2$. The total progress is finite (because $f$ is bounded below), so these terms must shrink to 0. If the cosine can't shrink, the gradient must.

The standard way to guarantee the angle

Use $d_k=-D_kg_k$ where $D_k$ is symmetric with eigenvalues in $[m,M]$, $m\gt0$. Then

  • $-\nabla f^Td=\nabla f^TD\nabla f\ge m\|\nabla f\|^2$ (smallest eigenvalue), so $d$ is a descent direction;
  • $\|d\|=\|D\nabla f\|\le M\|\nabla f\|$ (largest eigenvalue);
  • so $\cos\theta=\dfrac{-\nabla f^Td}{\|\nabla f\|\|d\|}\ge\dfrac{m\|\nabla f\|^2}{\|\nabla f\|\cdot M\|\nabla f\|}=\dfrac{m}{M}\gt0$.

Steepest descent is $D=I$: $\cos\theta=1$. Newton with a PD Hessian whose eigenvalues stay in $[m,M]$ is $D=H^{-1}$: also covered.

Check B5–B6. (1) Golden section on $[0,20]$: first two points? (2) $D_k$ has eigenvalues in $[2,5]$. Lower bound on $\cos\theta_k$?
Show answer

(1) $0.382\times20=7.64$ and $0.618\times20=12.36$. (2) $m/M=2/5$.

C. Quadratics: the test case for every method

C1. The quadratic, its gradient, its minimiser, its error

$$f(x)=\tfrac12x^TQx-b^Tx,\qquad Q=Q^T\succ0.$$

$Q\succ0$ (positive definite) means $v^TQv\gt0$ for every $v\ne0$; equivalently, every eigenvalue of $Q$ is positive. It makes $f$ a bowl with exactly one bottom.

Gradient by hand on a 2×2, so you trust the formula

$Q=\begin{pmatrix}3&1\\1&2\end{pmatrix}$: $\ \tfrac12x^TQx=\tfrac12(3x_1^2+2x_1x_2+2x_2^2)$, so $f=\tfrac32x_1^2+x_1x_2+x_2^2-b_1x_1-b_2x_2$.

$\partial f/\partial x_1=3x_1+x_2-b_1$, $\ \partial f/\partial x_2=x_1+2x_2-b_2$. That's exactly the vector $Qx-b$.

Facts about the quadratic (used everywhere below)
  • Gradient $g(x)=Qx-b$; Hessian $=Q$ (constant).
  • Minimiser: $Qx^*=b$, so $x^*=Q^{-1}b$ (unique since $Q\succ0$).
  • Error $e=x-x^*$. Then $g=Qx-b=Qx-Qx^*=\boxed{Qe}$: the gradient is $Q$ times the error.
  • $f(x)-f^*=\tfrac12e^TQe=\tfrac12\|e\|_Q^2$. (Expand $f(x^*+e)=f^*+(Qx^*-b)^Te+\tfrac12e^TQe$ and use $Qx^*=b$.)
Reading $Q$ off a polynomial

$f=3(x_1^2+x_2^2)+4x_1x_2+\dots$: the Hessian is $\begin{pmatrix}6&4\\4&6\end{pmatrix}$. The diagonal is twice the coefficient of $x_i^2$ (because of the ½), and the off-diagonal is the whole coefficient of $x_1x_2$ (here 4, not 2): $\partial^2(4x_1x_2)/\partial x_1\partial x_2=4$. Safest: take the second derivatives directly.

C2. Eigen-directions: the natural axes of the bowl

$Q$ symmetric has $n$ perpendicular unit eigenvectors $q_1,\dots,q_n$ with $Qq_i=\lambda_iq_i$. Write any error as $e=\sum_i\varepsilon_iq_i$ (its components along the eigenvectors). Then:

  • $Qe=\sum_i\lambda_i\varepsilon_iq_i$: $Q$ just multiplies the $i$-th component by $\lambda_i$. No mixing between components.
  • $f-f^*=\tfrac12e^TQe=\tfrac12\sum_i\lambda_i\varepsilon_i^2$. A level set is an ellipse (ellipsoid) with axes along the $q_i$. Along $q_i$ its half-width is proportional to $1/\sqrt{\lambda_i}$: large eigenvalue = steep, narrow direction; small eigenvalue = flat, long direction.
  • $\kappa=\lambda_{\max}/\lambda_{\min}$ measures how stretched the ellipses are. $\kappa=1$: circles.
x* q₁ ∝ (1,−1), λ = 2: long, flat axis q₂ ∝ (1,1), λ = 10: short, steep axis Q = [6 4; 4 6], κ = 10/2 = 5 axis ratio √κ = √5 ≈ 2.24
Level sets of a quadratic with $Q=\begin{pmatrix}6&4\\4&6\end{pmatrix}$ (eigenvalues 2 and 10). The ellipses are long along the small-eigenvalue direction and narrow along the large one; the length ratio is $\sqrt{\kappa}$.
Check C. $Q=\begin{pmatrix}6&4\\4&6\end{pmatrix}$: verify that $(1,-1)$ and $(1,1)$ are eigenvectors and find their eigenvalues. What is $\kappa$?
Show answer

$Q(1,-1)=(2,-2)=2(1,-1)$; $Q(1,1)=(10,10)=10(1,1)$. $\kappa=10/2=5$.

D. Fixed-step gradient descent on a quadratic (Midterm 1 Q II)

The method: $d_k=-g_k$ and the same $\alpha$ every step: $x_{k+1}=x_k-\alpha g_k$.

D1. Deriving the error recursion

  1. Subtract $x^*$ from both sides: $e_{k+1}=e_k-\alpha g_k$.
  2. Use $g_k=Qe_k$ (C1): $\ \boxed{e_{k+1}=(I-\alpha Q)e_k}$. (Multiplying by $Q$ gives the same recursion for gradients: $g_{k+1}=(I-\alpha Q)g_k$.)
  3. Apply it to one eigenvector: $(I-\alpha Q)q_i=q_i-\alpha\lambda_iq_i=(1-\alpha\lambda_i)q_i$.
  4. So if $e_k=\sum_i\varepsilon_i^{(k)}q_i$ ($\varepsilon_i^{(k)}$ = the component of the error along $q_i$ after $k$ steps), then $\varepsilon_i^{(k+1)}=(1-\alpha\lambda_i)\,\varepsilon_i^{(k)}$, and after $k$ steps $\ \boxed{\varepsilon_i^{(k)}=(1-\alpha\lambda_i)^k\,\varepsilon_i^{(0)}}$.

In words: the error splits into independent pieces, one per eigen-direction. Each step multiplies piece $i$ by the fixed number $1-\alpha\lambda_i$, its multiplier. Everything (convergence, cycling, divergence, best step, rate) is read off from these multipliers.

By hand: his Ch 3 Exercise 1 function, two steps

$f(x)=3(x_1^2+x_2^2)+4x_1x_2+5x_1+6x_2+7$. Here $Q=\begin{pmatrix}6&4\\4&6\end{pmatrix}$ and the linear term is $+5x_1+6x_2$, so $\nabla f=Qx+(5,6)$.

  1. Minimiser: $Qx^*=-(5,6)$. $Q^{-1}=\frac1{20}\begin{pmatrix}6&-4\\-4&6\end{pmatrix}$, so $x^*=-\frac1{20}(30-24,\,-20+36)=(-0.3,\,-0.8)$.
  2. Start $x_0=(0,0)$: $e_0=(0.3,\,0.8)$. Split along the eigenvectors: $e_0=u(1,-1)+v(1,1)$ with $u=\frac{0.3-0.8}{2}=-0.25$ (λ = 2 piece) and $v=\frac{0.3+0.8}{2}=0.55$ (λ = 10 piece).
  3. Take $\alpha=0.1$. Multipliers: $1-0.1\cdot2=0.8$ and $1-0.1\cdot10=0$.
  4. Step directly: $g_0=Q\cdot0+(5,6)=(5,6)$, $x_1=(0,0)-0.1(5,6)=(-0.5,-0.6)$, $e_1=x_1-x^*=(-0.2,\,0.2)$.
  5. Step via multipliers: $e_1=0.8\cdot(-0.25)(1,-1)+0\cdot0.55(1,1)=(-0.2,\,0.2)$ ✓. The λ = 10 piece is gone in one step because $\alpha=1/10$ (more on this in E4).
  6. Step 2: $e_2=0.8\,e_1=(-0.16,\,0.16)$, i.e. $x_2=(-0.46,-0.64)$. From now on the error shrinks by 0.8 per step.

D2. The multipliers for different step sizes (same $Q$, eigenvalues 2 and 10)

Start with both pieces equal to 1. The table shows piece λ = 2 / piece λ = 10 after $k$ steps, i.e. $(1-2\alpha)^k$ / $(1-10\alpha)^k$:

$\alpha$multipliers$k=1$$k=2$$k=3$$k=4$what happens
0.050.9, 0.50.9 / 0.50.81 / 0.250.729 / 0.1250.656 / 0.0625converges; slow piece is λ = 2
0.10.8, 00.8 / 00.64 / 00.512 / 00.410 / 0λ = 10 piece killed at once
1/62/3, −2/30.667 / −0.6670.444 / 0.4440.296 / −0.2960.198 / 0.198best worst case: both shrink by 2/3
0.20.6, −10.6 / −10.36 / 10.216 / −10.130 / 1λ = 10 piece flips sign forever: 2-cycle
0.250.5, −1.50.5 / −1.50.25 / 2.250.125 / −3.3750.0625 / 5.06λ = 10 piece blows up: divergence

D3. Convergence range, best step, rate

  • Converges from every start ⇔ every multiplier has $|1-\alpha\lambda_i|\lt1$ ⇔ $0\lt\alpha\lambda_i\lt2$ for all $i$ ⇔ $\boxed{0\lt\alpha\lt2/\lambda_{\max}}$. The largest eigenvalue sets the limit. Endpoints: at $\alpha=0$ nothing moves; at $\alpha=2/\lambda_{\max}$ the top multiplier is exactly $-1$ (oscillation).
  • Worst-case factor per step on $\|e_k\|$: $\max_i|1-\alpha\lambda_i|=\max\{|1-\alpha\lambda_{\min}|,\,|1-\alpha\lambda_{\max}|\}$ (the extremes matter, since $1-\alpha\lambda$ is a straight line in $\lambda$).
  • Best $\alpha$: as $\alpha$ grows, the first term falls and the second rises; the max is smallest where they balance: $1-\alpha\lambda_{\min}=-(1-\alpha\lambda_{\max})$, so $\ \boxed{\alpha_{\rm opt}=\dfrac{2}{\lambda_{\min}+\lambda_{\max}}}$, with factor $\ \boxed{\dfrac{\lambda_{\max}-\lambda_{\min}}{\lambda_{\max}+\lambda_{\min}}=\dfrac{\kappa-1}{\kappa+1}}$ on $\|e\|$ (square it for $f-f^*$).
1 0.21/60.10 step αfactor0 2/3 |1−2α| (λ = 2 piece) |1−10α| (λ = 10 piece) worst case (max of the two); dot = best α = 1/6
Blue = slow piece λ = 2, red = fast piece λ = 10, wide gold band = worst case (it follows blue up to α = 1/6, then red). Dashed line = factor 1. Right of α = 0.2 the red piece exceeds 1 and the iteration diverges.

D4. Cycling, divergence and special starts

  • Multiplier exactly $-1$: that piece flips sign forever: the iterates jump between two points (a 2-cycle). $f(x_k)$ stays constant, but the iterates don't converge (Midterm 1 II(3): objective values converging doesn't mean iterates converge).
  • Multiplier with $|\cdot|\gt1$: that piece grows: divergence unless the start has zero component along that eigenvector. A zero stays zero forever, so from such starts (in 2-D: a line through $x^*$, the "eigen-line") the iteration still converges.
  • Adding a linear term $b^Tx$ moves $x^*$ but not the Hessian, so the range $0\lt\alpha\lt2/\lambda_{\max}$ doesn't change.
Gradient descent on a quadratic $f=\tfrac12(\lambda_1x_1^2+\lambda_2x_2^2)$

Drag the start point $x_0$ anywhere on the contour plot (or drag along the α strip at the bottom); move the sliders. The blue path is 30 steps of $x_{k+1}=x_k-\alpha\nabla f(x_k)$. It opens with λ = 2 and 10 (the $Q$ of D2) and the best step $\alpha=1/6$.

What to notice. The two multipliers $1-\alpha\lambda_i$ decide everything (D1): each step multiplies the $x_1$-piece and the $x_2$-piece of the error by them. Push α into the red part of the strip ($\alpha\gt2/\lambda_{\max}$) and the path blows up along the steep axis; at exactly $2/\lambda_{\max}$ it bounces between two points forever (a 2-cycle). Raise λ₂ (bigger κ): the zig-zag across the narrow valley grows and progress along the flat axis slows. Tick exact line search: no α to choose, yet the path still zig-zags with right-angle turns. Drag $x_0$ onto an axis (it snaps): only one eigen-piece is present, so even a "diverging" α can converge, and exact line search finishes in one step.
His Ch 3 Exercise 1, the way the exam asks it

Same $f=3(x_1^2+x_2^2)+4x_1x_2+5x_1+6x_2+7$. Find the largest $\alpha$ range for global convergence of $x_{k+1}=x_k-\alpha\nabla f(x_k)$.

  1. Hessian $Q=\begin{pmatrix}6&4\\4&6\end{pmatrix}$ (off-diagonal 4, not 2).
  2. Eigenvalues: $6\pm4$, i.e. $\lambda=2$ (eigenvector $(1,-1)$), $\lambda=10$ (eigenvector $(1,1)$).
  3. Range: $0\lt\alpha\lt2/10=\boxed{1/5}$.
  4. Best step $\alpha=2/(2+10)=1/6$; multipliers $1-2/6=2/3$ and $1-10/6=-2/3$; factor $2/3=(\kappa-1)/(\kappa+1)$ with $\kappa=5$.
Traps in D
  • The limit is set by the largest eigenvalue ($2/\lambda_{\max}$); the rate by the ratio $\kappa$.
  • The endpoint $\alpha=2/\lambda_{\max}$ is excluded (multiplier $-1$).
  • Constant $f(x_k)$ in a 2-cycle is not convergence.
Check D. $Q$ has eigenvalues 1, 4, 9. (1) Range of $\alpha$? (2) Best $\alpha$ and factor? (3) At $\alpha=0.25$, which piece misbehaves?
Show answer

(1) $0\lt\alpha\lt2/9$. (2) $\alpha=2/10=0.2$, factor $(9-1)/(9+1)=0.8$. (3) Multipliers $0.75,\ 0,\ 1-2.25=-1.25$: the λ = 9 piece grows (diverges unless its starting component is 0).

E. Steepest descent with exact line search (Midterm 1 Q III)

The method: $d_k=-g_k$, and $\alpha_k$ = the best step along that line (B1), recomputed every iteration. You no longer need to know the eigenvalues to pick $\alpha$.

E1. The step, and why the path zigzags

  1. $\phi(\alpha)=f(x_k-\alpha g_k)$. The gradient at the new point is $g_k-\alpha Qg_k$, so $\phi'(\alpha)=-(g_k-\alpha Qg_k)^Tg_k=-g_k^Tg_k+\alpha\,g_k^TQg_k$.
  2. $\phi'(\alpha)=0$: $\ \boxed{\alpha_k=\dfrac{g_k^Tg_k}{g_k^TQg_k}}$.
  3. At that $\alpha_k$, $\phi'(\alpha_k)=-g_{k+1}^Tg_k=0$. So $\boxed{g_{k+1}^Tg_k=0}$: each new gradient is perpendicular to the previous one. Geometrically: you walk until the line just touches a level ellipse; there the new gradient (perpendicular to the ellipse) is perpendicular to the line you walked. Consecutive steps are at right angles: a zigzag.
By hand: $Q=\mathrm{diag}(1,4)$, $b=0$, $x_0=(4,1)$ (so $x^*=0$, $f^*=0$)
  1. $g_0=Qx_0=(4,4)$. $g_0^Tg_0=32$, $Qg_0=(4,16)$, $g_0^TQg_0=16+64=80$, $\alpha_0=32/80=2/5$.
  2. $x_1=(4,1)-\tfrac25(4,4)=(2.4,\,-0.6)$. $g_1=(2.4,\,-2.4)$, and $g_1^Tg_0=9.6-9.6=0$ ✓.
  3. $f(x_0)=\tfrac12(16+4)=10$, $f(x_1)=\tfrac12(5.76+1.44)=3.6$. Ratio $3.6/10=9/25$.
  4. Next: $\alpha_1=2/5$ again, $x_2=(1.44,\,0.36)=\tfrac{9}{25}x_0$. The pattern repeats: $x_3=(0.864,-0.216)$, $x_4=(0.518,0.130)$, … with $f$ shrinking by $9/25$ every step, forever.
x₀ = (4,1)x₁ = (2.4, −0.6) x₂ x* blue: steepest descent, exact steps (right-angle turns, never arrives) green dashed: CG's 2nd step goes straight to x* (section H)
Level ellipses of $\tfrac12(x_1^2+4x_2^2)$ through $x_0,\dots,x_3$. Steepest descent with exact line search (blue) turns 90° each time and only creeps towards $x^*$. CG (green) takes the same first step and then lands exactly on $x^*$; section H explains how.

E2. How fast: the Kantorovich bound, in words

Each exact step reduces $f-f^*$ by at least a fixed fraction, and that fraction is worst when the ellipses are very stretched:

$$f(x_{k+1})-f^*\ \le\ \Big(\frac{\kappa-1}{\kappa+1}\Big)^2\big(f(x_k)-f^*\big).$$

The exact one-step formula (from the Ch 3 notes, with $E_k=f(x_k)-f^*=\tfrac12e_k^TQe_k$) is $E_{k+1}=\Big[1-\dfrac{(g_k^Tg_k)^2}{(g_k^TQg_k)(g_k^TQ^{-1}g_k)}\Big]E_k$; Kantorovich's inequality bounds the bracket by $\big(\frac{\kappa-1}{\kappa+1}\big)^2$.

In the example above $\kappa=4$: bound $(3/5)^2=9/25$, and the actual ratio was exactly $9/25$. So that start is a worst case: the bound is attained. Same factor as fixed-step GD with the best $\alpha$, but without needing to know the eigenvalues.

E3. The effective condition number

Suppose $g_0$ has components only along some of the eigenvectors (index set $J$). Then every later gradient also stays there, because $g_{k+1}=(I-\alpha_kQ)g_k$ and $I-\alpha_kQ$ multiplies each eigen-component by a number: a component that is zero stays zero. So the method never "sees" the other eigenvalues. Replace $\lambda_{\min},\lambda_{\max}$ by the smallest and largest eigenvalue within $J$: the effective $\kappa$.

Example: $Q=\mathrm{diag}(1,2,10,50)$, $x_0=(0,1,1,0)$, $b=0$: $g_0=(0,2,10,0)$ involves only λ = 2 and 10. Effective $\kappa=5$, bound $(4/6)^2=4/9$ instead of $(49/51)^2$ (Practice N7).

E4. Killing a known eigenvalue with one fixed step (Midterm 1 Q III)

Write $\eta$ for a fixed step length (the same role as a fixed $\alpha$; Midterm 1 III uses $\eta$). A gradient step with $\eta=1/\mu$, where $\mu$ is an eigenvalue of $Q$, multiplies the $\mu$-component of the error by $1-\mu/\mu=0$ (D1 did this with $\alpha=1/10$). Two such steps with $\eta_0=1/\mu_1$ and $\eta_1=1/\mu_2$ (either order) remove two known outlier eigenvalues $\mu_1,\mu_2$, without knowing the eigenvectors: after both steps the error has been multiplied by $P(Q)$ with $P(t)=(1-\eta_0t)(1-\eta_1t)$, which is zero at $t=\mu_1$ and $t=\mu_2$. (Midterm 1 III, Practice P2, calls the two outliers $\lambda_1,\lambda_2$.)

Traps in E
  • Exact line search reaches $x^*$ in one step iff $g_0$ is an eigenvector of $Q$ (his Ch 3 Ex 2): then $-g_0$ points straight at $x^*$.
  • The Kantorovich factor is for $f-f^*$ (or $\|e\|_Q^2$). For $\|e\|_Q$ take the square root.
  • "Consecutive gradients orthogonal" is for steepest descent; in CG all gradients are mutually orthogonal (H7).
Check E. $Q=\mathrm{diag}(1,4)$, $b=0$, $x_0=(1,0)$. What does one exact step do, and why?
Show answer

$g_0=(1,0)$ is an eigenvector. $\alpha_0=1/1=1$, $x_1=(1,0)-(1,0)=0=x^*$. One step.

F. The $\|x\|^p/p$ family: when the gradient isn't Lipschitz (Midterm 1 Q V)

Everything in D assumed a quadratic: the gradient changes at a bounded rate (it's "Lipschitz"). This family breaks that, and shows what goes wrong. His Ch 3 Exercise 7 is the case $p=3/2$; Midterm 1 Q V was "a modification of exercise 7".

The function: $f_p(x)=\frac1p\|x\|^p$ with $1\lt p\lt2$, minimiser $0$.

  1. Gradient. $f_p=\frac1p(x^Tx)^{p/2}$, so $\nabla f_p(x)=\frac1p\cdot\frac p2(x^Tx)^{p/2-1}\cdot2x=\|x\|^{p-2}x$ for $x\ne0$, and $\nabla f_p(0)=0$ (since $|f_p(h)-f_p(0)|/\|h\|=\frac1p\|h\|^{p-1}\to0$).
  2. Why it's not Lipschitz. $\|\nabla f_p(x)-\nabla f_p(0)\|/\|x\|=\|x\|^{p-2}\to\infty$ as $x\to0$ (the power $p-2$ is negative). 1-D picture for $p=1.5$: the slope is $\sqrt{|x|}$, so near 0 the slope changes infinitely fast. The bottom is a "sharpened" bowl.
  3. Fixed step. $x_{k+1}=x_k-\alpha r_k^{p-2}x_k=(1-\alpha r_k^{p-2})x_k$ with $r_k=\|x_k\|$. So $\boxed{r_{k+1}=r_k\,|1-\alpha r_k^{p-2}|}$: the multiplier now depends on where you are, and blows up as $r_k\to0$.
  • $f$ increases ⇔ $|1-\alpha r_k^{p-2}|\gt1$ ⇔ $\alpha r_k^{p-2}\gt2$ ⇔ $0\lt r_k\lt(\alpha/2)^{1/(2-p)}$. Too close to 0 ⇒ thrown out. (Raising to the negative power $1/(p-2)$ flips the inequality.)
  • $r_0=(\alpha/2)^{1/(2-p)}$: multiplier $-1$, iterates $x_0,-x_0,x_0,\dots$
  • $r_0=\alpha^{1/(2-p)}$: multiplier 0, lands on 0 in one step. Convergence to 0 can only happen by hitting 0 exactly, or not at all.
  • Exact line search along $-\nabla f_p$: $\alpha_k=r_k^{2-p}$, lands exactly on 0.
Numbers: $p=1.5$, $\alpha=0.3$

Critical radius $(\alpha/2)^{1/(2-p)}=0.15^2=0.0225$; one-step radius $\alpha^{2}=0.09$.

start $r_0$$r_1$$r_2$$r_3$$r_4$$r_5$behaviour
0.50.2880.1270.02000.02240.0225shrinks, overshoots below 0.0225, gets pushed back up, sticks in the ± cycle
0.0010.00850.01920.02240.02250.0225too close: thrown out to the cycle
0.0900000exact hit: done in one step
0.02250.02250.02250.02250.02250.0225$x_0,-x_0,x_0,\dots$ (2-cycle)
Check F. $p=1.5$, $\alpha=0.2$. For which $r_k$ does one step increase $f$? Which start lands on 0 in one step?
Show answer

$f$ increases for $0\lt r_k\lt(0.1)^2=0.01$. One-step hit: $r_0=0.2^2=0.04$.

G. Newton's method (Ch 2 in 1-D, Ch 3 in n-D)

Idea. Steepest descent uses only the slope. Newton also uses the curvature: replace $f$ near $x_k$ by its second-order Taylor model (a parabola / quadratic bowl) and jump straight to the bottom of the model.

G1. One dimension

  1. Model: $q(x)=f(x_k)+f'(x_k)(x-x_k)+\tfrac12f''(x_k)(x-x_k)^2$.
  2. Bottom of the model: $q'(x)=f'(x_k)+f''(x_k)(x-x_k)=0$, so $\ \boxed{x_{k+1}=x_k-\dfrac{f'(x_k)}{f''(x_k)}}$. (This is Newton root-finding applied to $f'$.)
  3. This is the bottom only if $f''(x_k)\gt0$. If $f''(x_k)\lt0$ the model is an upside-down parabola and the formula jumps to its top.
Failure 1: negative curvature sends you uphill

$f(x)=\tfrac14x^4-\tfrac12x^2$ at $x_0=0.5$: $f'=x^3-x=-\tfrac38$ (downhill is to the right), $f''=3x^2-1=-\tfrac14\lt0$.

Newton step $p=-f'/f''=-\dfrac{-3/8}{-1/4}=-\tfrac32$: to the left (the full step would jump to $x_1=-1$). Slope along it: $f'\cdot p=(-\tfrac38)(-\tfrac32)=+\tfrac{9}{16}\gt0$: an ascent direction. A small step $0.1p$ goes to $x=0.35$, where $f=-0.0575\gt f(0.5)=-0.109$: $f$ went up.

Failure 2 (his Exercise 2.6): convex, yet Newton fails. $f(x)=\sqrt{1+x^2}$
  1. $f'(x)=\dfrac{x}{\sqrt{1+x^2}}$, $f''(x)=(1+x^2)^{-3/2}\gt0$: strictly convex, minimiser $x^*=0$.
  2. Newton: $x_{k+1}=x_k-\dfrac{x_k(1+x_k^2)^{-1/2}}{(1+x_k^2)^{-3/2}}=x_k-x_k(1+x_k^2)=\boxed{-x_k^3}$.
  3. $|x_0|\lt1$: converges to 0 extremely fast ($0.5\to-0.125\to0.00195\to-7.5\times10^{-9}$). $|x_0|=1$: cycles $1,-1,1,\dots$ $|x_0|\gt1$: diverges ($1.5\to-3.375\to38.4\to\dots$).
  4. For $|x|\gt1$ the Newton direction is still downhill (it has the sign of $-f'$), but the full step overshoots and increases $f$. A line search (damping, G2) fixes this.
x₀ = 1.5 x₁ = −3.375, f = 3.52 x* = 0 f = √(1+x²) model q (dashed): too flat, its bottom is at −3.375
At $x_0=1.5$ the curvature $f''=0.17$ is small, so the Newton model (purple dashed) is a very flat parabola whose bottom is far to the left. The step lands at $x_1=-3.375$, higher on the curve ($f=3.52$ vs $1.80$).
Newton vs gradient in 1-D

Pick a function, drag left/right on the picture to place the start $x_0$, then press Step. Purple: Newton, with its parabola model at the current point (dashed) and the jump to the model's turning point. Green: gradient steps $x-\alpha f'(x)$ with the α you choose.

What to notice. On the quadratic the model is $f$, so one Newton step lands on the minimiser from any start. On $x^4/4-x^2/2$ start at $x_0=0.5$: $f''\lt0$ there, the model is an upside-down parabola, and Newton jumps to its top at $x_1=-1$ (it heads for where $f'=0$, which can be uphill). On $\sqrt{1+x^2}$ try $x_0=0.5$ (lightning fast: $-x^3$), $x_0=1$ (cycles $\pm1$) and $x_0=1.5$ (the flat model throws it to $-3.375$, then 38.4: diverges). The gradient steps are slower but steadier.

G2. Many dimensions

Model: $m_k(p)=f(x_k)+g_k^Tp+\tfrac12p^TH_kp$, with $H_k=\nabla^2f(x_k)$. Gradient of the model $=g_k+H_kp=0$:

$$\boxed{H_k\,p_k=-g_k,\qquad x_{k+1}=x_k+p_k}.$$

Solve the linear system; don't form $H_k^{-1}$.

  • One step solves a quadratic. If $f=\tfrac12x^TQx-b^Tx$ with $Q\succ0$, the model is $f$: $x_1=x_0-Q^{-1}(Qx_0-b)=Q^{-1}b=x^*$ from any $x_0$.
  • Descent needs a PD Hessian. $g_k^Tp_k=-p_k^TH_kp_k$ (substitute $g_k=-H_kp_k$). If $H_k\succ0$ this is negative: descent. If $H_k$ is indefinite the Newton direction can point uphill (as in G1), and no amount of damping fixes a non-descent direction.
  • Quadratic convergence, but only nearby. If $\nabla f(x^*)=0$, $\nabla^2f(x^*)$ is nonsingular and the Hessian is Lipschitz near $x^*$, then for $x_0$ sufficiently close to $x^*$: $\|x_{k+1}-x^*\|\le C\|x_k-x^*\|^2$. In words: once close, the number of correct digits roughly doubles each step. Far away there's no guarantee ($\sqrt{1+x^2}$).
  • Damped Newton: $x_{k+1}=x_k+\alpha_kp_k$ with Armijo backtracking starting at $\alpha=1$ (B4). Far away it takes shorter safe steps; near a minimiser with $\nabla^2f(x^*)\succ0$ (and $c_1\lt\tfrac12$) the full step $\alpha=1$ is eventually accepted, so the fast local rate comes back. (Why Newton counts as a "scaled steepest descent": in coordinates $y=H_k^{1/2}x$ the model's Hessian becomes $I$, i.e. the bowl looks round, as in H1. The steepest-descent step there, mapped back to $x$, is exactly $p_k=-H_k^{-1}g_k$.)
By hand: Newton on a quadratic

$f(x)=x_1^2+x_1x_2+x_2^2-3x_1$: $Q=\begin{pmatrix}2&1\\1&2\end{pmatrix}$, $b=(3,0)$. From $x_0=(0,0)$: $g_0=Qx_0-b=(-3,0)$. Solve $Qp=(3,0)$: $2p_1+p_2=3$, $p_1+2p_2=0$ ⇒ $p=(2,-1)$. $x_1=(2,-1)$, and $\nabla f(x_1)=(2\cdot2-1-3,\ 2-2)=(0,0)$ ✓. One step.

Watching quadratic convergence (Practice N6 function)

$f(x)=x_1^4+x_1^2+x_1x_2+x_2^2$ from $x_0=(1,0)$, pure Newton. Distance to $x^*=0$ after each step: $0.66,\ 0.33,\ 0.088,\ 0.0028,\ 9\times10^{-8},\ 3\times10^{-21}$. At first it only halves. Once close, the number of correct digits at least doubles each step (that is what quadratic convergence guarantees). Here it even roughly triples ($10^{-1.06}\to10^{-2.56}\to10^{-7.05}\to10^{-20.5}$), because all third derivatives of this $f$ vanish at $x^*=0$ (no cubic term), which makes Newton faster than the guarantee there.

Traps in G
  • "Strictly convex ⇒ Newton converges from anywhere" is false ($\sqrt{1+x^2}$, $|x_0|\gt1$).
  • Quadratic convergence is a local statement ("sufficiently close").
  • Indefinite Hessian: the Newton direction may be an ascent direction; damping can't fix that.
Check G. (1) 1-D Newton on $f(x)=x^2-2x$ from $x_0=7$? (2) For $f=\sqrt{1+x^2}$, what happens from $x_0=-0.5$?
Show answer

(1) $f'=2x-2=12$, $f''=2$: $x_1=7-6=1$, the exact minimiser (a quadratic: one step). (2) $x_1=-(-0.5)^3=0.125$, then $-0.00195$, …: converges to 0.

H. Conjugate gradient (CG), built from zero (Chapter 4)

Throughout H: $f=\tfrac12x^TQx-b^Tx$, $Q\succ0$, $g_k=Qx_k-b$, and every step uses exact line search along its direction.

H1. Why steepest descent zigzags, and the idea that fixes it

The problem. In the zigzag of E1, each line search makes the slope along the current direction zero. But the next step spoils the earlier ones. In the example: after two steps, $x_2=(1.44,0.36)$, $g_2=(1.44,1.44)$, and the slope along the first direction $d_0=-g_0=(-4,-4)$ is $g_2^Td_0=-11.52\ne0$. We'd want to go along $d_0$ again: the work of step 0 was undone. That's why it never finishes.

When does it work? If the level sets were circles ($Q=I$, $f=\tfrac12\|x-x^*\|^2$), a line search along a coordinate axis sets that coordinate exactly right and leaves the others alone. So $n$ line searches along any $n$ perpendicular directions finish exactly. Nothing gets undone.

The trick: make the ellipses round. Change variables $y=Q^{1/2}x$ (where $Q^{1/2}$ is the symmetric matrix with $Q^{1/2}Q^{1/2}=Q$). Then $\tfrac12x^TQx=\tfrac12\|y\|^2$: in $y$-coordinates the level sets are circles. A direction $d$ in $x$ becomes $Q^{1/2}d$ in $y$, and two directions are perpendicular in $y$ exactly when

$$(Q^{1/2}d_i)^T(Q^{1/2}d_j)=d_i^TQd_j=0.$$

So: choose directions that are perpendicular after rounding the bowl. Back in $x$ they don't look perpendicular; they're called Q-conjugate. Line searches along Q-conjugate directions never undo each other, and $n$ of them finish exactly.

x₀x₁x* x-coordinates (stretched) d₀ᵀd₁ ≠ 0, but d₀ᵀQd₁ = 0 y₀y₁y* y = Q^½ x (rounded): circles, the two steps are perpendicular
$Q=\mathrm{diag}(1,4)$, the CG path from $x_0=(4,1)$ (same start as the zigzag in E1). Left: in $x$ the second step (green) is not perpendicular to the first (blue), but $d_0^TQd_1=0$. Right: the same path in rounded coordinates $y=(x_1,2x_2)$: circles, and the two steps meet at a right angle, so the second line search lands on the centre.

H2. Q-conjugacy

Definition

Nonzero vectors $d_0,\dots,d_{k}$ are Q-conjugate if $d_i^TQd_j=0$ for all $i\ne j$.

  • They're linearly independent (so at most $n$ of them). If $\sum_ia_id_i=0$, multiply by $d_j^TQ$: every term dies except $a_jd_j^TQd_j$, and $d_j^TQd_j\gt0$, so $a_j=0$.
  • Eigenvectors of $Q$ are both orthogonal and Q-conjugate ($q_i^TQq_j=\lambda_jq_i^Tq_j=0$). In general, conjugate directions are not orthogonal.
By hand: making a direction conjugate (Quiz 2 Q3)

$Q=\begin{pmatrix}3&1\\1&2\end{pmatrix}$, $d_0=(1,0)$, $d_1=(w,1)$ (Quiz 2 calls the unknown $s$). $Qd_1=(3w+1,\ w+2)$, so $d_0^TQd_1=3w+1=0\Rightarrow w=-\tfrac13$. Then $d_0^Td_1=-\tfrac13\ne0$: conjugate but not orthogonal.

H3. The best point of a flat sheet: the gradient is perpendicular to the sheet, not zero

We'll need this: what does it mean to be the minimiser over $\bar x+\mathrm{span}\{d_1,\dots,d_m\}$ (a line, plane, … through $\bar x$)? Put the directions as columns of a matrix $D$. Points of the sheet are $\bar x+Dz$, so define $h(z)=f(\bar x+Dz)$.

  • Chain rule: $\nabla h(z)=D^T\nabla f(\bar x+Dz)$.
  • For convex $f$, $h$ is convex, so the minimiser is where $\nabla h=0$: $\ \boxed{D^T\nabla f(x_S)=0}$, i.e. $\nabla f(x_S)$ is perpendicular to every $d_i$.
  • Not $\nabla f(x_S)=0$: the sheet may simply not contain the true minimiser. No direction inside the sheet goes downhill, but directions out of it might.
  • For the quadratic this is an $m\times m$ system: $(D^TQD)z_S=-D^T\nabla f(\bar x)$.
With numbers

Minimise $f=x_1^2+4x_2^2$ on the line $x=(2,1)+t(-1,0)$: $h(t)=(2-t)^2+4$, $h'(t)=-2(2-t)=0\Rightarrow t=2$, $x_S=(0,1)$. There $\nabla f=(0,8)\ne0$, but $(−1,0)\cdot(0,8)=0$ ✓: perpendicular to the line.

His warning

At the sheet's minimiser $\nabla h=0$ but $\nabla f\ne0$ in general. Writing "$\nabla f(x_S)=0$" is the mistake he said memorisers make.

H4. The expanding subspace theorem (Midterm 1 Q VI asked its steps)

The key formula ("you have to remember"). One step changes the gradient by $\alpha_jQd_j$: $\ g_{j+1}=Qx_{j+1}-b=Q(x_j+\alpha_jd_j)-b=g_j+\alpha_jQd_j$. Adding these up:

$$\boxed{g_i=g_0+\sum_{j\lt i}\alpha_jQd_j}.$$

The theorem in plain words. Take any Q-conjugate $d_0,\dots,d_{K-1}$ and do exact line searches along them one after another. Then after $K$ steps, $x_K$ is the best point of the whole sheet $x_0+\mathrm{span}\{d_0,\dots,d_{K-1}\}$, not just of the last line. Each line search does its own job and never spoils the earlier ones. Consequently $g_K$ is perpendicular to every $d_i$ used so far (H3), and for $K=n$ the sheet is all of $\mathbb R^n$, so $x_n=x^*$.

The proof as a chain of steps (memorise the order; with $c_i=d_i^Tg_0$, $h_i=d_i^TQd_i$)
  1. The sheet objective separates. $\Phi(\beta)=f(x_0+\sum_i\beta_id_i)=f(x_0)+\sum_i\big(c_i\beta_i+\tfrac12h_i\beta_i^2\big)$. (Expand $f(x_0+v)=f(x_0)+g_0^Tv+\tfrac12v^TQv$; the cross terms $\beta_i\beta_jd_i^TQd_j$ die by conjugacy.) Here the $\beta_i$ are just coefficients, not CG's $\beta_k$.
  2. Each piece has one minimiser. $h_i\gt0$ ($Q\succ0$, $d_i\ne0$), so $\beta_i^*=-c_i/h_i$.
  3. Earlier steps don't change the slope along $d_i$. By the key formula, $d_i^Tg_i=d_i^Tg_0+\sum_{j\lt i}\alpha_jd_i^TQd_j=c_i$.
  4. So the line search finds exactly that minimiser. $\alpha_i=-d_i^Tg_i/h_i=-c_i/h_i=\beta_i^*$.
  5. Conclusion. $x_K=x_0+\sum\beta_i^*d_i$ is the minimiser over $x_0+\mathcal S_K$ ($\mathcal S_K=\mathrm{span}\{d_0..d_{K-1}\}$), and $g_K\perp\mathcal S_K$. The order of the directions doesn't matter.
Check H1–H4. (1) Why is $d_i^Tg_i=d_i^Tg_0$ for conjugate directions? (2) After the line search along $d_i$, what is $d_i^Tg_{i+1}$?
Show answer

(1) $g_i-g_0=\sum_{j\lt i}\alpha_jQd_j$ and $d_i^TQd_j=0$ for $j\ne i$. (2) 0: the exact line search makes the slope along $d_i$ zero at the new point.

H5. The CG algorithm: conjugate directions built on the fly

We need Q-conjugate directions without computing eigenvectors. CG builds them one at a time from the gradients.

  1. Start with steepest descent: $d_0=-g_0$.
  2. Step length by exact line search (B1): $\alpha_k=-\dfrac{g_k^Td_k}{d_k^TQd_k}$; then $x_{k+1}=x_k+\alpha_kd_k$ and $g_{k+1}=g_k+\alpha_kQd_k$.
  3. Next direction: the new steepest-descent direction plus a bit of the old direction, $d_{k+1}=-g_{k+1}+\beta_kd_k$, with $\beta_k$ chosen to make $d_{k+1}^TQd_k=0$: $\ -g_{k+1}^TQd_k+\beta_kd_k^TQd_k=0\Rightarrow\beta_k=\dfrac{g_{k+1}^TQd_k}{d_k^TQd_k}$.
  4. The surprise (CG theorem; proof not examinable): making $d_{k+1}$ conjugate to $d_k$ alone automatically makes it conjugate to all earlier directions. So H4 applies, and CG finishes in at most $n$ steps.

Simplifying $\alpha$ and $\beta$ (the efficient forms used in exams):

  • $g_k^Td_k=g_k^T(-g_k+\beta_{k-1}d_{k-1})=-\|g_k\|^2$, because $g_k^Td_{k-1}=0$ (the previous line search). So $\alpha_k=\dfrac{\|g_k\|^2}{d_k^TQd_k}$.
  • Gradients are mutually orthogonal: $g_{k+1}\perp d_0,\dots,d_k$ (H4), and each $g_j$ is a combination of $d_j$ and $d_{j-1}$ (since $d_j=-g_j+\beta_{j-1}d_{j-1}$ gives $g_j=-d_j+\beta_{j-1}d_{j-1}$; for $j=0$, $g_0=-d_0$), so $g_{k+1}^Tg_j=0$ for $j\le k$.
  • From $Qd_k=(g_{k+1}-g_k)/\alpha_k$: $g_{k+1}^TQd_k=\|g_{k+1}\|^2/\alpha_k$ and $d_k^TQd_k=\|g_k\|^2/\alpha_k$. Dividing: $\beta_k=\dfrac{\|g_{k+1}\|^2}{\|g_k\|^2}$.
CG (Fletcher–Reeves form) $$\begin{aligned} &d_0=-g_0;\qquad \alpha_k=\frac{\|g_k\|^2}{d_k^TQd_k};\qquad x_{k+1}=x_k+\alpha_kd_k;\qquad g_{k+1}=g_k+\alpha_kQd_k;\\ &\beta_k=\frac{\|g_{k+1}\|^2}{\|g_k\|^2};\qquad d_{k+1}=-g_{k+1}+\beta_kd_k.\qquad\text{Stop when }g_{k+1}=0. \end{aligned}$$

H6. Two full CG steps by hand (his Ch 4 Problem 3)

$Q=\begin{pmatrix}4&1\\1&3\end{pmatrix}$, $b=(1,2)$, $x_0=(0,0)$
  1. Start. $g_0=Qx_0-b=(-1,-2)$, $d_0=-g_0=(1,2)$, $\|g_0\|^2=1+4=5$.
  2. Step 0 length. $Qd_0=(4+2,\ 1+6)=(6,7)$, $d_0^TQd_0=6+14=20$, $\alpha_0=5/20=\tfrac14$.
  3. Move. $x_1=(0,0)+\tfrac14(1,2)=(\tfrac14,\tfrac12)$. $g_1=g_0+\tfrac14(6,7)=(-1+\tfrac32,\ -2+\tfrac74)=(\tfrac12,-\tfrac14)$. Check $g_1^Tg_0=-\tfrac12+\tfrac12=0$ ✓.
  4. New direction. $\|g_1\|^2=\tfrac14+\tfrac1{16}=\tfrac5{16}$, $\beta_0=\frac{5/16}{5}=\tfrac1{16}$. $d_1=-g_1+\tfrac1{16}d_0=(-\tfrac12+\tfrac1{16},\ \tfrac14+\tfrac18)=(-\tfrac7{16},\tfrac38)$. Check $d_1^TQd_0=(-\tfrac7{16})(6)+(\tfrac38)(7)=-\tfrac{42}{16}+\tfrac{42}{16}=0$ ✓.
  5. Step 1 length. $Qd_1=(-\tfrac{28}{16}+\tfrac38,\ -\tfrac7{16}+\tfrac98)=(-\tfrac{11}8,\tfrac{11}{16})$, $d_1^TQd_1=\tfrac{77}{128}+\tfrac{33}{128}=\tfrac{55}{64}$, $\alpha_1=\frac{5/16}{55/64}=\tfrac4{11}$.
  6. Move. $x_2=(\tfrac14,\tfrac12)+\tfrac4{11}(-\tfrac7{16},\tfrac38)=(\tfrac14-\tfrac7{44},\ \tfrac12+\tfrac3{22})=(\tfrac1{11},\tfrac7{11})$; $g_2=g_1+\tfrac4{11}(-\tfrac{11}8,\tfrac{11}{16})=(0,0)$. Indeed $Q^{-1}b=(\tfrac1{11},\tfrac7{11})$ ✓. Two steps for a 2×2.
  7. Energy check. $f$: $0\to-\tfrac58\to-\tfrac{15}{22}$. First drop $=\|g_0\|^4/(2d_0^TQd_0)=25/40=\tfrac58$ ✓; second $=(\tfrac5{16})^2/(2\cdot\tfrac{55}{64})=\tfrac5{88}$ ✓.
$k$$x_k$$g_k$$d_k$$\alpha_k$$\beta_k$$f(x_k)$
0$(0,0)$$(-1,-2)$$(1,2)$$1/4$$1/16$$0$
1$(1/4,1/2)$$(1/2,-1/4)$$(-7/16,3/8)$$4/11$–$-5/8$
2$(1/11,7/11)$$(0,0)$stop: $x_2=x^*$$-15/22$

Note $d_0^Td_1=-\tfrac7{16}+\tfrac34=\tfrac5{16}\ne0$: the directions are conjugate, not orthogonal. The gradients $g_0,g_1$ are orthogonal.

Check H5–H6. Run one CG step on $Q=\mathrm{diag}(1,4)$, $b=(1,1)$, $x_0=0$: find $\alpha_0$, $g_1$, $\beta_0$.
Show answer

$g_0=(-1,-1)$, $d_0=(1,1)$, $d_0^TQd_0=5$, $\alpha_0=2/5$; $g_1=(-1,-1)+\tfrac25(1,4)=(-\tfrac35,\tfrac35)$; $\beta_0=\frac{18/25}{2}=\tfrac9{25}$. (This is Quiz 2 Q6.)

Check H6 (full run). Run CG to the end on $Q=\begin{pmatrix}3&1\\1&2\end{pmatrix}$ (the matrix of C1 and H2), $b=(1,1)$, $x_0=(0,0)$. Find $\alpha_0,x_1,g_1,\beta_0,d_1,\alpha_1,x_2$ and check $x_2=Q^{-1}b$.
Show answer
  1. $g_0=-b=(-1,-1)$, $d_0=(1,1)$, $\|g_0\|^2=2$, $Qd_0=(4,3)$, $d_0^TQd_0=7$, $\alpha_0=\tfrac27$.
  2. $x_1=(\tfrac27,\tfrac27)$, $g_1=(-1,-1)+\tfrac27(4,3)=(\tfrac17,-\tfrac17)$. Check $g_1^Tg_0=-\tfrac17+\tfrac17=0$ ✓.
  3. $\|g_1\|^2=\tfrac2{49}$, $\beta_0=\frac{2/49}{2}=\tfrac1{49}$, $d_1=(-\tfrac17,\tfrac17)+\tfrac1{49}(1,1)=(-\tfrac6{49},\tfrac8{49})$. Check $d_1^TQd_0=(-\tfrac6{49})(4)+(\tfrac8{49})(3)=0$ ✓.
  4. $Qd_1=(-\tfrac{10}{49},\tfrac{10}{49})$, $d_1^TQd_1=\tfrac{60+80}{2401}=\tfrac{20}{343}$, $\alpha_1=\frac{2/49}{20/343}=\tfrac7{10}$.
  5. $x_2=(\tfrac27,\tfrac27)+\tfrac7{10}(-\tfrac6{49},\tfrac8{49})=(\tfrac27-\tfrac3{35},\ \tfrac27+\tfrac4{35})=(\tfrac15,\tfrac25)$. $Q^{-1}b=\tfrac15\begin{pmatrix}2&-1\\-1&3\end{pmatrix}(1,1)=(\tfrac15,\tfrac25)$ ✓, and $g_2=0$.
CG vs steepest descent on $Q=\begin{pmatrix}3&1\\1&2\end{pmatrix}$, $b=(1,1)$

Drag the start $x_0$ anywhere. Blue: steepest descent with exact steps. Green: CG (the H5 box). Both take the same first step $d_0=-g_0$; then CG bends its second direction just enough to be Q-conjugate and lands on $x^*=(0.2,\,0.4)$.

What to notice. The first steps coincide. At $x_1$ the two methods part: steepest descent turns a right angle ($g_1^Tg_0=0$) and then zig-zags forever; CG's $d_1$ is not perpendicular to $d_0$ ($d_0^Td_1\ne0$ in the readout) but is Q-conjugate ($d_1^TQd_0=0$), and it reaches $x^*$ in exactly 2 steps from every start. With $x_0=(0,0)$ the readout reproduces Check H6: $\alpha_0=2/7$, $\alpha_1=7/10$, $x_2=(1/5,\,2/5)$.

H7. What CG guarantees, and how many steps it needs

  • Gradients orthogonal ($g_i^Tg_j=0$), directions Q-conjugate ($d_i^TQd_j=0$). Never swap these.
  • $g_k^Td_k=-\|g_k\|^2$ and $g_k^Td_i=0$ for $i\lt k$.
  • Krylov space. Recall $g_0=Qe_0$ (C1), so $Q^jg_0=Q^{j+1}e_0$. Each new gradient is the old one plus $\alpha Q\times$(a direction), so one more power of $Q$ enters each step: $\mathrm{span}\{d_0,\dots,d_{k-1}\}=\mathrm{span}\{g_0,Qg_0,\dots,Q^{k-1}g_0\}$. After $k$ steps, $x_k$ minimises $f$ over $x_0+\mathrm{span}\{g_0,Qg_0,\dots,Q^{k-1}g_0\}$ ($k$ vectors, highest power $k-1$, shifted by $x_0$).
  • Decrease per step: $f(x_k)-f(x_{k+1})=\dfrac{\|g_k\|^4}{2\,d_k^TQd_k}$ (put $\alpha_k$ into $\phi(\alpha)=f(x_k)+\alpha g_k^Td_k+\tfrac12\alpha^2d_k^TQd_k$). For Quiz 2's $E=\|x-x^*\|_Q^2=2(f-f^*)$ the decrease is twice that.
  • $f$ always decreases, but $\|g_k\|$ can increase (Quiz 2 Q10: $\|g_0\|=1$, $\|g_1\|=\tfrac32$).

How many steps: count distinct eigenvalues. By the Krylov fact, $x_k-x_0$ is a combination of $g_0,\dots,Q^{k-1}g_0$, i.e. of $Qe_0,\dots,Q^ke_0$. Subtract $x^*$: $x_k-x^*=e_0+(\text{combination of }Qe_0,\dots,Q^ke_0)=R_k(Q)e_0$, where $R_k$ is a polynomial of degree $k$ with $R_k(0)=1$. Conversely, every such polynomial gives a point of the sheet $x_0+\mathrm{span}\{g_0,\dots,Q^{k-1}g_0\}$. By the expanding-subspace result (H4), $x_k$ is the best point of that sheet, so CG automatically picks the best such polynomial (smallest $f$, i.e. smallest error energy). On each eigen-component, $R_k(Q)$ multiplies by $R_k(\lambda_i)$. So:

  • If $e_0$ has nonzero components only on eigenvalues $\mu_1,\dots,\mu_r$ (distinct), the degree-$r$ polynomial $R(t)=\prod_j(1-t/\mu_j)$ has $R(0)=1$ and kills all of them: CG finishes in exactly $r$ steps. Fewer is impossible: a polynomial of degree less than $r$ with value 1 at 0 can't vanish at $r$ distinct points.
  • So: steps = number of distinct eigenvalues whose eigenspaces $e_0$ actually touches (at most $n$).
  • Partial bound: if $m$ outlier eigenvalues lie above an interval $[a,b]$ holding the rest, after $m+1$ steps $E_{\rm after}\le\big(\frac{b-a}{b+a}\big)^2E_{\rm before}$ (use $R(t)=(1-\frac{2t}{a+b})\prod_j(1-t/\mu_j)$ and bound the outlier factors by 1 on $[a,b]$).
His Ch 4 Problem 6b: count steps without iterating

$Q=\mathrm{diag}(2,2,5,5,11)$, $e_0=(1,-1,0,0,3)$. Components: coordinates 1–2 (eigenvalue 2) nonzero, 3–4 (eigenvalue 5) zero, 5 (eigenvalue 11) nonzero. Two distinct eigenvalues touched ⇒ exactly 2 CG steps (checked numerically), even though $n=5$ and $Q$ has 3 distinct eigenvalues.

Traps in H7
  • Krylov space after $k$ steps goes up to $Q^{k-1}g_0$, and is shifted by $x_0$.
  • Count distinct eigenvalues present in $e_0$, not $n$, nor all distinct eigenvalues of $Q$.
  • $\|g_k\|$ can increase; $f$ and $\|e\|_Q$ always decrease.
Check H7. $Q=\mathrm{diag}(3,3,8)$, $e_0=(1,2,0)$. How many CG steps? Why does one step suffice here?
Show answer

One: $e_0$ lies entirely in the eigenspace of 3, so $g_0=Qe_0=3e_0$ is an eigenvector, and $R(t)=1-t/3$ kills it.

H8. Preconditioned CG (PCG)

Idea. CG is fast when the eigenvalues are few or clustered. If they're spread out, change variables to make the problem rounder first. Pick an SPD matrix $B\approx Q^{-1}$ (cheap to apply, e.g. $B$ = inverse of the diagonal of $Q$). With $x=B^{1/2}y$ the Hessian in $y$ is $\hat Q=B^{1/2}QB^{1/2}$, close to $I$ if $B\approx Q^{-1}$. Run plain CG on $y$ and translate back to $x$: every "$g$" inside an inner product becomes "$Bg$".

PCG

$d_0=-Bg_0$, $\ \alpha_k=\dfrac{g_k^TBg_k}{d_k^TQd_k}$, $\ x_{k+1}=x_k+\alpha_kd_k$, $\ g_{k+1}=g_k+\alpha_kQd_k$, $\ \beta_k=\dfrac{g_{k+1}^TBg_{k+1}}{g_k^TBg_k}$, $\ d_{k+1}=-Bg_{k+1}+\beta_kd_k$.

Guarantees: $g_i^TBg_j=0$ (not $g_i^Tg_j$), $d_i^TQd_j=0$, $g_k^Td_k=-g_k^TBg_k$. Speed depends on the eigenvalues of $B^{1/2}QB^{1/2}$. $B=Q^{-1}$ (or $cQ^{-1}$): one step.

Scaling $B$ changes nothing. With $\tilde B=cB$: $\tilde d_k=cd_k$, $\tilde\alpha_k=\alpha_k/c$, $\tilde\beta_k=\beta_k$, so $\tilde\alpha_k\tilde d_k=\alpha_kd_k$ and the iterates are identical. So "eigenvalues of $\hat Q$ near 1" isn't the real criterion: their spread (clustering) is.

Trap (and a disagreement) In class he said that with PCG the original $f(x_k)$ "may not reduce monotonically" (Ch 4 lec 4 [19:30]). Mathematically, $f(x_k)=h(y_k)$ exactly (same point, $x=B^{1/2}y$), and each PCG step is an exact line search for $f$ along $d_k$, so $f(x_k)$ does decrease. What really need not decrease is the Euclidean gradient norm $\|g_k\|$. This is consistent with Quiz 2's key. If it is asked, write this reasoning.

H9. CG on non-quadratic functions (FR, PR)

On a non-quadratic $f$ there is no single $Q$: conjugacy and the $n$-step finish are lost. CG becomes a heuristic that is often faster than steepest descent, but it needs safety checks. His "four things that are different" (write $F(x_k)=\nabla^2f(x_k)$, the Hessian, in place of $Q$):

  1. $\beta_k$ goes back to the original formula with $Q\to F(x_k)$: $\beta_k=\dfrac{g_{k+1}^TF(x_k)d_k}{d_k^TF(x_k)d_k}$.
  2. If $d_k^TF(x_k)d_k\le0$ (no positive curvature along $d_k$), set $\beta_k=0$ (restart with steepest descent).
  3. $\alpha_k$ from a line search (Armijo/Wolfe); there's no closed form. The quadratic-model step $\hat\alpha_k=-g_k^Td_k/d_k^TF(x_k)d_k$ is only a trial value; it can increase $f$.
  4. Descent check: if $g_k^Td_k\ge0$, reset $d_k=-g_k$.

Gradient-only versions: $\beta^{FR}_k=\dfrac{\|g_{k+1}\|^2}{\|g_k\|^2}$ (Fletcher–Reeves), $\beta^{PR}_k=\dfrac{g_{k+1}^T(g_{k+1}-g_k)}{\|g_k\|^2}$ (Polak–Ribière). With exact line search any finite $\beta$ gives $g_{k+1}^Td_{k+1}=-\|g_{k+1}\|^2\lt0$ (descent, not convergence). FR + strong Wolfe with $0\lt c_1\lt c_2\lt\tfrac12$:

$$-\frac1{1-c_2}\le\frac{g_k^Td_k}{\|g_k\|^2}\le\frac{2c_2-1}{1-c_2}\lt0.$$
Plug in (Quiz 2 Q19)

$c_2=\tfrac14$: lower $-\frac1{3/4}=-\tfrac43$, upper $\frac{-1/2}{3/4}=-\tfrac23$. Both negative ⇒ every FR direction is a descent direction.

I. Exam recipe

Question type → what to write
  1. "Range of α for fixed-step GD": Hessian $Q$ (second derivatives directly) → eigenvalues → $0\lt\alpha\lt2/\lambda_{\max}$; justify each endpoint (0: no move; $2/\lambda_{\max}$: multiplier $-1$).
  2. "Describe the iterates for this α and $x_0$": $x^*$; $e_0$ split along eigenvectors; multipliers $1-\alpha\lambda_i$; $e_k=\sum(1-\alpha\lambda_i)^k\varepsilon_iq_i$. Multiplier $-1$ → 2-cycle; $|\cdot|\gt1$ → diverges unless that component is 0.
  3. "Best α / rate": $2/(\lambda_{\min}+\lambda_{\max})$, factor $(\kappa-1)/(\kappa+1)$ on $\|e\|$, squared for $f-f^*$.
  4. "One exact line-search step": $g_0=Qx_0-b$, $\alpha_0=g_0^Tg_0/g_0^TQg_0$, $x_1$, check $g_1^Tg_0=0$, compare the ratio with $((\kappa-1)/(\kappa+1))^2$ (effective $\kappa$ if $g_0$ misses some eigen-directions).
  5. "Run CG": the table of H6 ($g,d,Qd,d^TQd,\alpha,x,g_{\rm new},\beta$); check $g_{k+1}^Tg_k=0$, $d_{k+1}^TQd_k=0$; final $x$ = $Q^{-1}b$.
  6. "How many CG steps": eigen-components of $e_0$ (or $g_0$); count distinct eigenvalues with nonzero component.
  7. "Does α satisfy Armijo/Wolfe": write $\phi(\alpha)$ and $\phi'(\alpha)$ explicitly; plug in; state each inequality.
  8. "Newton step": gradient, Hessian at $x_k$; solve $H_kp=-g_k$; check $H_k\succ0$ (descent); on a quadratic say "one step, exact".
  9. Theory steps (expanding subspace): the 5-step chain in H4, in order.

What the professor said about this

In class (speech-to-text, wording rough)
  • Format: There'll be more short answers, not MCQs. Mix. Ch 4 lec 4 [30:00] → practise writing 2–3-line answers (Midterm 1 V(2), V(6), VI(2), VI(6) style), not only clicking options.
  • I will never ask full proof. That steps you may need for solving problems. Ch 3 lec 3 [1:11:00], and for CG: the whole proof can never be asked in exams, but the steps… Ch 4 lec 2 [47:00] → learn the expanding-subspace chain (H4) as steps.
  • modification of something, some difficult problem already solved, I might ask, then seven I solved Ch 2–3 tutorial [1:35:00] → Midterm 1 V was exercise 7 modified. Expect modified versions of Ch 3 Ex 1, 2, 4, 5, 7 and Ch 4 Problems 3, 4, 6.
  • Ch 2 exercises: exercise one is direct, straightforward; the guide's reading of [1:35:30]–[1:40:30] is "only up to 2.6", skip 8–11 Ch 2–3 tutorial → Ex 2.3 (intervals) and 2.6 ($\sqrt{1+x^2}$) are worked in B3 and G1 above.
  • Fixed-step GD slide: important… used repeatedly in Chapter Four Ch 3 lec 1 [18:00] → the eigen-mode recursion $(1-\alpha\lambda_i)$ is the core skill.
  • Effective condition number: condition number, you replace by effective condition number Ch 3 lec 2 [1:00:00]; invariance of the eigen-subspace under $I-\alpha Q$ is very important point [54:30].
  • Descent direction in the line-search template: That's very important. Ch 2 lec 1 [24:00]
  • Wolfe: You cannot throw away arbitrarily one of the conditions; this curvature condition you can never throw away Ch 2 lec 2 [42:00].
  • 1-D Newton: you must be where the second derivative is positive, Otherwise, Newton's method will fail. It's not enough. Ch 2 lec 2 [14:00] → $\sqrt{1+x^2}$ example.
  • Newton's theorem: sufficiently close… is very important Ch 3 lec 4 [57:00] → quadratic convergence is local only.
  • Affine minimum: gradient of the new function is zero, gradient of the original is orthogonal to the basis; If we just memorize, you may make that mistake. Ch 4 lec 1 [31:30]–[32:00]
  • $g_i=g_0+\sum\alpha_jQd_j$: This is key formula you have to remember. Ch 4 lec 1 [1:15:00]; $\beta=\|g_{k+1}\|^2/\|g_k\|^2$: This one is more important. [1:28:30]
  • Non-quadratic CG: Four things that are different (original β with Hessian, β = 0 if denominator ≤ 0, line search for α, descent check/reset) Ch 4 lec 4 [39:30]–[41:00].
  • PCG: The function value may not reduce monotonically. Ch 4 lec 4 [19:30] → see the disagreement box in H8.
From the end-term guide
  • Tier B (likely, medium marks): GD on quadratics (Midterm 1 II, III), CG computations and facts (Quiz 2, Midterm 1 VI).
  • Tier C (cheap MCQs): Ch 2 line search and Ch 3 Newton, never examined so far.
  • Skip: step-size rules 2/L, 1/L; Zangwill statement; Newton rate proofs; CG √κ proof; FR lim-inf theorem; FR vs PR comparison.

Practice (try first, then open the answer)

Part A is the full Midterm 1 questions from this module, Part B the 12 most instructive Quiz 2 MCQs, Part C new questions in his style (N1–N13). Do P1, P2, N1, N3 and N5 fully on paper.

A. Midterm 1, Questions II, III, V, VI (past paper, full)

P1 Midterm 1 Q II (past paper, 20 marks)Descriptive

$f(x)=\tfrac12(x_1+x_2-2)^2+(x_1-x_2)^2$ on $\mathbb R^2$, iteration $x_{k+1}=x_k-\alpha\nabla f(x_k)$, $\alpha\gt0$.

  1. Largest range of $\alpha$ with $x_k\to x^*$ for every $x_0$; justify both endpoints. (5)
  2. $\alpha=\frac12$, $x_0=(2,0)$: describe the iterates; do they converge? (3)
  3. For (2), find the objective values. What does this show about inferring convergence of iterates from convergence of objective values? (2)
  4. $\alpha=\frac34$: characterise exactly the $x_0$ for which $x_k\to x^*$. (4)
  5. Step size minimising the worst-case error, and the minimum contraction factor. (4)
  6. Replace $f$ by $f+b^Tx$. Does the range in (1) change? (2)
Hint

Find $x^*$ by making both squares zero. Hessian $H$; eigenvectors $(1,1)$ and $(1,-1)$. Write the multipliers $1-2\alpha$, $1-4\alpha$.

Show answer
  1. (1) Both squares vanish at $x^*=(1,1)$. $\nabla f=\begin{pmatrix}3x_1-x_2-2\\-x_1+3x_2-2\end{pmatrix}=H(x-x^*)$, $H=\begin{pmatrix}3&-1\\-1&3\end{pmatrix}$, eigenpairs $\lambda=2$, $q_+=\frac1{\sqrt2}(1,1)$; $\lambda=4$, $q_-=\frac1{\sqrt2}(1,-1)$. $H\succ0$ so $x^*$ is the unique minimiser. $e_{k+1}=(I-\alpha H)e_k$. Need $|1-2\alpha|\lt1$ and $|1-4\alpha|\lt1$: $\boxed{0\lt\alpha\lt\frac12}$. At $\alpha=0$ nothing moves; at $\alpha=\frac12$ the $q_-$ multiplier is $-1$ (oscillation); for $\alpha\gt\frac12$ it has modulus $\gt1$ (divergence).
  2. (2) $e_0=(1,-1)$ is entirely along $q_-$, multiplier $1-4\cdot\frac12=-1$. So $x_k=(1+(-1)^k,\,1-(-1)^k)$: $(2,0),(0,2),(2,0),\dots$ A 2-cycle; does not converge.
  3. (3) At both points $x_1+x_2-2=0$, $x_1-x_2=\pm2$, so $f(x_k)=4$ for all $k$ while $f^*=0$. The objective sequence converges (it is constant) but the iterates do not, and not to an optimum: convergence of $f(x_k)$ does not imply convergence of $x_k$.
  4. (4) $x_0-x^*=u_0(1,1)+v_0(1,-1)$, $u_0=\frac{x_{0,1}+x_{0,2}-2}{2}$, $v_0=\frac{x_{0,1}-x_{0,2}}{2}$. Multipliers $1-\frac32=-\frac12$ and $1-3=-2$: $x_k-x^*=(-\frac12)^ku_0(1,1)+(-2)^kv_0(1,-1)$. Converges iff $v_0=0$, i.e. $\boxed{x_{0,1}=x_{0,2}}$ (start on the eigen-line through $x^*$ along $(1,1)$). E.g. $x_0=(3,3)$: $(0,0),(1.5,1.5),(0.75,0.75),\dots\to(1,1)$.
  5. (5) $\rho(\alpha)=\max\{|1-2\alpha|,|1-4\alpha|\}$, minimised where $1-2\alpha=4\alpha-1$: $\alpha_{\rm opt}=\frac13=\frac{2}{2+4}$, $\rho_{\min}=\frac13=\frac{\kappa-1}{\kappa+1}$ with $\kappa=2$. (Here $\|e_{k+1}\|=\frac13\|e_k\|$ exactly, and $f-f^*$ shrinks by $\frac19$.)
  6. (6) No change. $\tilde f$ has the same Hessian $H$; $\tilde x^*=x^*-H^{-1}b$ and $\tilde e_{k+1}=(I-\alpha H)\tilde e_k$. Still $0\lt\alpha\lt\frac12$.
P2 Midterm 1 Q III (past paper, 20 marks)Descriptive

$f(x)=\frac12x^THx-c^Tx$, $H=H^T\succ0$, $n\ge4$. $n-2$ eigenvalues lie in $[a,b]$; the other two are $\lambda_1,\lambda_2$ with $0\lt a\le b\lt\lambda_1\lt\lambda_2$, $b\ll\lambda_1$, known exactly (eigenvectors not given). From any $x_0$ do two gradient steps $x_1=x_0-\eta_0g_0$, $x_2=x_1-\eta_1g_1$, then steepest descent with exact line search $\alpha_k=\frac{g_k^Tg_k}{g_k^THg_k}$ for $k\ge2$. Find $\eta_0,\eta_1$ so that for $k\gt2$ the convergence rate depends only on $a$ and $b$. What is that rate?

Hint

A gradient step multiplies the $\lambda$-component by $1-\eta\lambda$. Which $\eta$ makes that zero?

Show answer
  1. Recurrences (3). $x^*=H^{-1}c$, $e_k=x_k-x^*$, $g_k=He_k$. A step of length $\eta$: $e_{k+1}=(I-\eta H)e_k$ and $g_{k+1}=(I-\eta H)g_k$.
  2. Two preparatory steps (3). $e_2=p(H)e_0$, $g_2=p(H)g_0$ with $p(t)=(1-\eta_0t)(1-\eta_1t)$. The component along an eigenvector with eigenvalue $\lambda$ is multiplied by $p(\lambda)$. To remove both outliers for every $x_0$ we need $p(\lambda_1)=p(\lambda_2)=0$.
  3. Choice (4). $\boxed{\eta_0=1/\lambda_2,\ \eta_1=1/\lambda_1}$ (or the reverse order). Then $p(\lambda_1)=(1-\lambda_1/\lambda_2)(1-1)=0$, $p(\lambda_2)=(1-1)(1-\lambda_2/\lambda_1)=0$. No eigenvectors needed.
  4. Subspace preserved (3). Let $S$ = span of eigenvectors with eigenvalues in $[a,b]$. Then $e_2,g_2\in S$, and $HS\subseteq S$, so each $I-\alpha_kH$ maps $S$ into $S$: the removed components never come back (exact arithmetic).
  5. Rate (5). On $S$ the effective eigenvalues lie in $[a,b]$, effective $\kappa=b/a$. Exact line search beats the trial step $\bar\alpha=\frac{2}{a+b}$, for which every mode multiplier satisfies $|1-\frac{2\mu}{a+b}|\le q=\frac{b-a}{b+a}$. Hence $$f(x_{k+1})-f^*\le\Big(\frac{b-a}{b+a}\Big)^2\big(f(x_k)-f^*\big),\quad k\ge2,$$ i.e. $\|e_{2+m}\|_H\le q^m\|e_2\|_H$. No $\lambda_1,\lambda_2$ in the factor.
  6. (2) If $a=b$ the next exact step finishes; if $g_2=0$ stop.

Checked numerically ($n=8$, outliers 50 and 200, rest in $[1,3]$): after the two steps the outlier components are $\sim10^{-16}$ and the per-step ratios stay below $0.25=((3-1)/(3+1))^2$. In floating point the outliers slowly creep back after many steps; the question assumes exact arithmetic.

Midterm 1 Q V setup (parts P3a–P3f)

$f_p(x)=\frac1p\|x\|_2^p$, $x\in\mathbb R^n$, $1\lt p\lt2$, unique minimiser 0. Gradient descent $x_{k+1}=x_k-\alpha\nabla f_p(x_k)$, $\alpha\gt0$. Write $r_k=\|x_k\|_2$.

P3a Midterm 1 Q V(1)MCQ

Which statement is correct?

  1. (a) $f_p$ is not differentiable at 0.
  2. (b) $f_p$ is differentiable at 0 with gradient 0, but not twice differentiable there.
  3. (c) $f_p$ is twice differentiable at 0, with Hessian 0.
  4. (d) $f_p$ is differentiable at 0 with a nonzero gradient.
Show answer

Answer: (b). $|f_p(h)-f_p(0)|/\|h\|=\frac1p\|h\|^{p-1}\to0$ (since $p\gt1$), so $\nabla f_p(0)=0$. Away from 0, $\nabla f_p(x)=\|x\|^{p-2}x$, and $(\nabla f_p(tu)-0)/t=t^{p-2}u$ is unbounded as $t\downarrow0$ ($p-2\lt0$): no second derivative. (a) fails because $p\gt1$ (it would be true for $p=1$). (c) fails by the blow-up. (d) the gradient is 0 at a minimiser.

P3b Midterm 1 Q V(2)Short answer

Is $\nabla f_p$ Lipschitz continuous on any neighbourhood of 0? Give a reason.

Show answer

No. $\|\nabla f_p(x)-\nabla f_p(0)\|/\|x\|=\|x\|^{p-2}\to\infty$ as $x\to0$, so no constant $L$ works.

P3c Midterm 1 Q V(3)MCQ

For precisely which positive values of $r_k$ does one iteration strictly increase the objective?

  1. (a) $r_k\gt\alpha^{1/(2-p)}$
  2. (b) $0\lt r_k\lt(\alpha/2)^{1/(2-p)}$
  3. (c) $r_k\gt(\alpha/2)^{1/(2-p)}$
  4. (d) every $r_k\gt0$
Show answer

Answer: (b). $x_{k+1}=(1-\alpha r_k^{p-2})x_k$, $r_{k+1}=r_k|1-\alpha r_k^{p-2}|$. $f$ increases ⇔ $|1-\alpha r_k^{p-2}|\gt1$ ⇔ $\alpha r_k^{p-2}\gt2$ (it is positive) ⇔ $r_k^{p-2}\gt2/\alpha$ ⇔ $r_k\lt(\alpha/2)^{1/(2-p)}$ (the power $p-2$ is negative, so the inequality flips). (a),(c) have the direction wrong: large $r$ gives a small multiplier. (d) false: e.g. $r_k=\alpha^{1/(2-p)}$ sends you to 0.

P3d Midterm 1 Q V(4)MCQ

Suppose $\|x_0\|=(\alpha/2)^{1/(2-p)}$. What happens?

  1. (a) They reach 0 in finitely many iterations.
  2. (b) They converge asymptotically to 0.
  3. (c) They alternate between $x_0$ and $-x_0$.
  4. (d) Their norms tend to infinity.
Show answer

Answer: (c). $\alpha r_0^{p-2}=2$, so $x_1=(1-2)x_0=-x_0$, same norm, repeat: $x_{2j}=x_0$, $x_{2j+1}=-x_0$; $f$ stays $r_0^p/p\gt0$. Not (a)/(b): the norm never changes. Not (d): same reason.

P3e Midterm 1 Q V(5)MCQ

For a fixed $\alpha\gt0$, which statement is correct?

  1. (a) Every sufficiently small nonzero initial point produces convergence to 0.
  2. (b) No nonzero initial point produces convergence to 0.
  3. (c) Convergence to 0 can occur only asymptotically.
  4. (d) If the iterates converge to 0, they must reach it in finitely many iterations.
Show answer

Answer: (d). If $r_k\to0$ with all $r_k\gt0$, then eventually $r_k\lt r_c=(\alpha/2)^{1/(2-p)}$ and by P3c $r_{k+1}\gt r_k$ on the tail, so $r_k\ge r_N\gt0$: contradiction. Hence convergence needs an exact hit, which is possible ($\|x_0\|=\alpha^{1/(2-p)}$ gives $x_1=0$). That kills (b) and (c). (a) is false: small starts are pushed out.

P3f Midterm 1 Q V(6)Short answer

Replace the constant step by exact line search along $-\nabla f_p(x_k)$. What step is selected at $x_k\ne0$?

Show answer

$\alpha_k=\|x_k\|^{2-p}$. With $r=\|x_k\|$: $f_p(x_k-\tau\nabla f_p(x_k))=\frac{r^p}{p}|1-\tau r^{p-2}|^p$, minimum value 0 at $\tau=r^{2-p}$: the step lands exactly on 0.

Midterm 1 Q VI setup (parts P4a–P4g)

$f(x)=\frac12x^TQx-b^Tx$, $Q\succ0$. Nonzero mutually Q-conjugate $d_0,\dots,d_{K-1}$, $1\le K\le n$. From $x_0$: $\alpha_i=\arg\min_{\alpha\in\mathbb R}f(x_i+\alpha d_i)$, $x_{i+1}=x_i+\alpha_id_i$. $g_i=Qx_i-b$, $c_i=d_i^Tg_0$, $h_i=d_i^TQd_i$. $\Phi(\beta)=f(x_0+\sum_{i}\beta_id_i)$, $\beta^*=\arg\min\Phi$, $\hat x_K=x_0+\sum\beta_i^*d_i$ = minimiser over $x_0+\mathcal S_K$, $\mathcal S_K=\mathrm{span}\{d_0,\dots,d_{K-1}\}$.

P4a Midterm 1 Q VI(1)MCQ

Which identity is guaranteed?

  1. (a) $\Phi(\beta)=f(x_0)+\sum_i(c_i\beta_i+\frac12\beta_i^2)$
  2. (b) $\Phi(\beta)=f(x_0)+\sum_i(c_i\beta_i+\frac12h_i\beta_i^2)$
  3. (c) $\Phi(\beta)=f(x_0)+\sum_i(c_i\beta_i+h_i\beta_i^2)$
  4. (d) $\Phi(\beta)=f(x_0)+\frac12\sum_ih_i\beta_i^2$
Show answer

Answer: (b). $f(x_0+v)=f(x_0)+g_0^Tv+\frac12v^TQv$ with $v=\sum\beta_id_i$: linear term $\sum c_i\beta_i$, quadratic $\sum_{i,j}\beta_i\beta_jd_i^TQd_j=\sum h_i\beta_i^2$ (cross terms vanish). (a) drops $h_i$ (only right if directions were Q-normalised); (c) loses the ½; (d) loses the linear term.

P4b Midterm 1 Q VI(2)Short answer

Why does each scalar quadratic in the correct expansion have a unique minimiser?

Show answer

Strictly positive curvature: $h_i=d_i^TQd_i\gt0$ because $Q\succ0$ and $d_i\ne0$, so $\phi_i(\beta_i)=c_i\beta_i+\frac12h_i\beta_i^2$ has second derivative $h_i\gt0$.

P4c Midterm 1 Q VI(3)MCQ

What is $\beta_i^*$?

  1. (a) $-c_i$
  2. (b) $c_i/h_i$
  3. (c) $-c_i/h_i$
  4. (d) $-c_i/(2h_i)$
Show answer

Answer: (c). $\phi_i'(\beta_i)=c_i+h_i\beta_i=0$. (b) sign error; (d) from forgetting the ½ was already in the quadratic; (a) ignores $h_i$.

P4d Midterm 1 Q VI(4)MCQ

Using $g_i=g_0+\sum_{j=0}^{i-1}\alpha_jQd_j$, which identity holds for every $i=0,\dots,K-1$?

  1. (a) $d_i^Tg_i=c_i$
  2. (b) $d_i^Tg_i=0$
  3. (c) $d_i^Tg_i=c_i+\sum_{j\lt i}\alpha_jh_j$
  4. (d) $d_i^Tg_i=c_i+\alpha_ih_i$
Show answer

Answer: (a). $d_i^Tg_i=d_i^Tg_0+\sum_{j\lt i}\alpha_jd_i^TQd_j$ and every $j\lt i$ has $j\ne i$, so each term is 0. (b) is the condition after the $i$-th line search ($d_i^Tg_{i+1}=0$). (c) wrongly uses $d_j^TQd_j$. (d) mixes in the step not yet taken.

P4e Midterm 1 Q VI(5)MCQ

Combining exact line minimisation with P4d, which relation follows?

  1. (a) $\alpha_i=-\beta_i^*$
  2. (b) $\alpha_i=\beta_i^*-\sum_{j\lt i}\alpha_j$
  3. (c) $\alpha_i=\beta_i^*/h_i$
  4. (d) $\alpha_i=\beta_i^*$
Show answer

Answer: (d). $\frac{d}{d\alpha}f(x_i+\alpha d_i)=d_i^Tg_i+\alpha h_i=0\Rightarrow\alpha_i=-d_i^Tg_i/h_i=-c_i/h_i=\beta_i^*$. Sequential line searches give the joint minimiser's coefficients.

P4f Midterm 1 Q VI(6)Short answer

State the orthogonality relation between $g_K$ and $\mathcal S_K$.

Show answer

$g_K\perp\mathcal S_K$: for each $i\lt K$, $d_i^Tg_K=c_i+\sum_j\alpha_jd_i^TQd_j=c_i+\alpha_ih_i=0$.

P4g Midterm 1 Q VI(7)MCQ

What has been established about $x_K$?

  1. (a) $x_K=\hat x_K$, the unique minimiser over $x_0+\mathcal S_K$.
  2. (b) $x_K=Q^{-1}b$ regardless of $K$.
  3. (c) $x_K$ is the unique minimiser over the linear subspace $\mathcal S_K$.
  4. (d) $x_K$ is stationary over $x_0+\mathcal S_K$, but more assumptions are needed for minimality.
Show answer

Answer: (a). $\alpha_i=\beta_i^*$ for all $i$ gives $x_K=\hat x_K$; also $f(x_K+v)-f(x_K)=g_K^Tv+\frac12v^TQv=\frac12v^TQv\gt0$ for $0\ne v\in\mathcal S_K$. (b) only for $K=n$. (c) it is the affine space $x_0+\mathcal S_K$, not the subspace. (d) convexity already makes stationarity sufficient.

B. Quiz 2 (past paper): 12 most instructive MCQs

Common assumptions: $f=\frac12x^TQx-b^Tx$, $Q\succ0$, $g_k=Qx_k-b$, $E(x)=\|x-x^*\|_Q^2$ (no ½), exact line searches, CG starts with $d_0=-g_0$. Marking was +1 / −¼.

Q1 Quiz 2 Q1MCQ

$f$ differentiable and convex, $D\in\mathbb R^{n\times m}$ with independent columns, $0\lt m\lt n$, $x_S\in\bar x+\mathrm{range}(D)$. Necessary and sufficient for $x_S$ to minimise $f$ over this affine space:

  1. (a) $\nabla f(x_S)=0$
  2. (b) $\nabla f(x_S)\in\mathrm{range}(D)$
  3. (c) $D^T\nabla f(x_S)=0$
  4. (d) $D^T(x_S-\bar x)=0$
Show answer

Answer: (c). $h(z)=f(\bar x+Dz)$, $\nabla h=D^T\nabla f$, and $h$ is convex so $\nabla h=0$ is exactly optimality. (a) sufficient but not necessary: the full gradient need not vanish (his trap). (b) is the opposite: the gradient must be orthogonal to range$(D)$. (d) is a condition on position, not optimality; since $x_S-\bar x\in\mathrm{range}(D)$ it would force $x_S=\bar x$.

Q2 Quiz 2 Q5MCQ

For ordinary linear CG, which identity holds at every iteration with $g_k\ne0$?

  1. (a) $g_k^Td_k=0$
  2. (b) $g_k^Td_k=-\|g_k\|^2$
  3. (c) $g_k^Td_k=-\|d_k\|^2$
  4. (d) $g_k^Td_k=-g_k^TQg_k$
Show answer

Answer: (b). $k=0$: $d_0=-g_0$. $k\ge1$: $g_k^Td_{k-1}=0$ (previous exact line search), so $g_k^T(-g_k+\beta_{k-1}d_{k-1})=-\|g_k\|^2$. (a) confuses it with $g_{k+1}^Td_k=0$. (c),(d) only hold when $d_k=-g_k$ in special cases.

Q3 Quiz 2 Q6 (computational)MCQ

CG on $Q=\mathrm{diag}(1,4)$, $b=(1,1)$, $x_0=0$. Find $\alpha_0$ and $\beta_0=\|g_1\|^2/\|g_0\|^2$.

  1. (a) $\alpha_0=\frac25,\ \beta_0=\frac{18}{25}$
  2. (b) $\alpha_0=\frac52,\ \beta_0=\frac9{25}$
  3. (c) $\alpha_0=\frac25,\ \beta_0=-\frac9{25}$
  4. (d) $\alpha_0=\frac25,\ \beta_0=\frac9{25}$
Show answer

Answer: (d). $g_0=(-1,-1)$, $d_0=(1,1)$, $\|g_0\|^2=2$, $d_0^TQd_0=5$, $\alpha_0=2/5$. $g_1=g_0+\frac25(1,4)=(-3/5,3/5)$, $\|g_1\|^2=18/25$, $\beta_0=9/25$. (Continuing: $d_1=(24/25,-6/25)$, $\alpha_1=5/8$, $x_2=(1,1/4)=Q^{-1}b$.) (a) forgot to divide by $\|g_0\|^2=2$; (b) inverted $\alpha$; (c) $\beta$ is a ratio of squares, never negative.

Q4 Quiz 2 Q7MCQ

For ordinary linear CG and $i\ne j$ (nonzero gradients/directions), which pair is guaranteed for arbitrary SPD $Q$?

  1. (a) $g_i^Tg_j=0$ and $d_i^TQd_j=0$
  2. (b) $g_i^TQg_j=0$ and $d_i^Td_j=0$
  3. (c) $g_i^Tg_j=0$ and $d_i^Td_j=0$
  4. (d) $g_i^TQg_j=0$ and $d_i^TQd_j=0$
Show answer

Answer: (a). Directions are Q-conjugate by construction; $g_k\perp\mathrm{span}\{d_0..d_{k-1}\}=\mathrm{span}\{g_0..g_{k-1}\}$, so gradients are Euclidean-orthogonal. (b) swaps them. (c),(d) each claim one false relation (e.g. in the H6 example $d_0^Td_1=-7/16+3/4\ne0$).

Q5 Quiz 2 Q8MCQ

After $k\ge1$ CG steps (no early termination), $x_k$ minimises $f$ over:

  1. (a) $\mathrm{span}\{g_0,Qg_0,\dots,Q^{k-1}g_0\}$
  2. (b) $x_0+\mathrm{span}\{Qg_0,Q^2g_0,\dots,Q^kg_0\}$
  3. (c) $x_0+\mathrm{span}\{g_0,Qg_0,\dots,Q^{k-1}g_0\}$
  4. (d) $x_0+\mathrm{span}\{g_k\}$
Show answer

Answer: (c). $x_k=x_0+\sum_{j\lt k}\alpha_jd_j$ and span$\{d_0..d_{k-1}\}$ = span$\{g_0,..,Q^{k-1}g_0\}$ ($k$ vectors, top power $k-1$). (a) forgets the shift $x_0$. (b) wrong powers (starts at 1, ends at $k$). (d) is one direction only.

Q6 Quiz 2 Q9MCQ

With $E(x)=\|x-x^*\|_Q^2$, for a CG step from $g_k\ne0$:

  1. (a) $E(x_k)-E(x_{k+1})=\frac{\|g_k\|^4}{2d_k^TQd_k}$
  2. (b) $E(x_k)-E(x_{k+1})=-\frac{\|g_k\|^4}{d_k^TQd_k}$
  3. (c) $E(x_k)-E(x_{k+1})=\frac{\|g_k\|^2}{d_k^TQd_k}$
  4. (d) $E(x_k)-E(x_{k+1})=\frac{\|g_k\|^4}{d_k^TQd_k}$
Show answer

Answer: (d). $f(x_k)-f(x_{k+1})=-\alpha_kg_k^Td_k-\frac12\alpha_k^2d_k^TQd_k=\frac{\|g_k\|^4}{2d_k^TQd_k}$ and $E=2(f-f^*)$, so the $E$-decrease is twice that. (a) is the $f$-decrease (the ½ trap). (b) wrong sign (E decreases). (c) wrong power: $\alpha_k\|g_k\|^2=\|g_k\|^4/d^TQd$.

Q7 Quiz 2 Q10 (computational)MCQ

First CG step on $Q=\begin{pmatrix}2&3\\3&5\end{pmatrix}$, $b=(1,0)$, $x_0=0$. Find $(f(x_1)-f(x_0),\ \|g_1\|)$.

  1. (a) $(\frac14,\frac32)$
  2. (b) $(-\frac14,\frac32)$
  3. (c) $(-\frac14,\frac12)$
  4. (d) $(-\frac12,\frac32)$
Show answer

Answer: (b). Leading minors 2, 1 ⇒ $Q\succ0$. $g_0=(-1,0)$, $d_0=(1,0)$, $\alpha_0=1/2$, $x_1=(1/2,0)$, $g_1=g_0+\frac12(2,3)=(0,3/2)$. $f(x_1)=\frac12\cdot\frac14\cdot2-\frac12=-\frac14$ (also $=\|g_0\|^4/(2\cdot2)$ decrease). $\|g_1\|=3/2\gt\|g_0\|=1$: the Euclidean gradient grew while $f$ fell. (a) sign; (c) wrong $g_1$; (d) wrong decrease (forgot the ½).

Q8 Quiz 2 Q11 (steps from eigenvalues)MCQ

$Q=\mathrm{diag}(2,2,5,9)$, $x_0-x^*=(1,-1,0,1)$. How many CG steps to reach $x^*$?

  1. (a) Exactly 1
  2. (b) Exactly 3
  3. (c) Exactly 2
  4. (d) Exactly 4
Show answer

Answer: (c). Nonzero components only in the eigenspaces of 2 and 9; $r(t)=(1-t/2)(1-t/9)$ kills both; a degree-1 polynomial with $r(0)=1$ cannot vanish at two distinct values, so not 1. (a) needs $e_0$ in a single eigenspace. (b) counts eigenvalue 5, which has zero component. (d) is just $n$.

Q9 Quiz 2 Q12 (partial CG bound)MCQ

$n\ge3$; $Q$ has $n-2$ eigenvalues in $[1,3]$ and two eigenvalues $\mu_1,\mu_2\gt3$. For a three-step CG cycle use $r(t)=(1-\frac t2)(1-\frac t{\mu_1})(1-\frac t{\mu_2})$ and bound the last two factors by 1 on $[1,3]$. What $\rho$ in $E_{\rm after}\le\rho E_{\rm before}$?

  1. (a) $\frac14$
  2. (b) $\frac12$
  3. (c) $\frac18$
  4. (d) $\frac1{16}$
Show answer

Answer: (a). $r(\mu_1)=r(\mu_2)=0$; on $[1,3]$, $|1-t/2|\le\frac12$ and the outlier factors are in $(0,1)$. So $\max|r|\le\frac12$ and the energy bound uses $\max r^2=\frac14$. (b) forgot to square. (c),(d) no basis. General form: $((b-a)/(b+a))^2=(2/4)^2$.

Q10 Quiz 2 Q15 (PCG)MCQ

PCG with fixed SPD $B$. Which identity is guaranteed between distinct nonzero gradients $g_i,g_j$ (original coordinates)?

  1. (a) $g_i^Tg_j=0$
  2. (b) $g_i^TBg_j=0$
  3. (c) $g_i^TB^{-1}g_j=0$
  4. (d) $g_i^TQg_j=0$
Show answer

Answer: (b). $\hat g=B^{1/2}g$ and ordinary CG gives $\hat g_i^T\hat g_j=0=g_i^TBg_j$. (a) Euclidean orthogonality is lost under the change of variables (his Problem 7c shows a counterexample). (c),(d) wrong weight.

Q11 Quiz 2 Q16 (scaling B)MCQ

Two PCG runs from the same $x_0$ with $B$ and $\tilde B=cB$ ($c\gt0$, $c\ne1$), $d_0=-Bg_0$, usual recurrences. Which relations hold?

  1. (a) $\tilde x_k=x_k,\ \tilde d_k=cd_k,\ \tilde\alpha_k=c\alpha_k$
  2. (b) $\tilde x_k=x_k,\ \tilde d_k=d_k/c,\ \tilde\alpha_k=\alpha_k/c$
  3. (c) $\tilde x_k=cx_k,\ \tilde d_k=cd_k,\ \tilde\alpha_k=\alpha_k$
  4. (d) $\tilde x_k=x_k,\ \tilde d_k=cd_k,\ \tilde\alpha_k=\alpha_k/c$
Show answer

Answer: (d). $\tilde d_0=cd_0$; $\tilde\alpha_k=\frac{c\,g^TBg}{c^2d^TQd}=\alpha_k/c$, so $\tilde\alpha_k\tilde d_k=\alpha_kd_k$ (same step); $c$ cancels in $\beta$. Induction. (a) would make the step $c^2$ times larger; (b) has $d$ scaled the wrong way; (c) iterates cannot scale since $x^*$ is fixed. (Checked numerically on a 3×3 with $c=3$.)

Q12 Quiz 2 Q19 (FR under strong Wolfe)MCQ

FR with $d_0=-g_0$ and strong Wolfe steps, $c_1=\frac1{10}$, $c_2=\frac14$. Interval for $r_k=g_k^Td_k/\|g_k\|^2$ from the FR sufficient-descent theorem:

  1. (a) $-\frac43\le r_k\le-\frac23$
  2. (b) $-\frac23\le r_k\le\frac43$
  3. (c) $-\frac43\le r_k\le-\frac76$
  4. (d) $-\frac23\le r_k\le-\frac13$
Show answer

Answer: (a). $-\frac1{1-c_2}=-\frac43$, $\frac{2c_2-1}{1-c_2}=\frac{-1/2}{3/4}=-\frac23$. Both negative ⇒ descent every step. (b) has a positive upper end (would allow ascent). (c),(d) arithmetic slips. Note $r_0=-1$ lies inside.

C. New questions in his style (all numbers verified with sympy/numpy)

N1 New: fixed-step GD on a 3×3Descriptive

$f(x)=\frac12x^TQx-b^Tx$ with $Q=\begin{pmatrix}2&1&0\\1&2&0\\0&0&5\end{pmatrix}$, $b=(3,3,5)$. Iteration $x_{k+1}=x_k-\alpha\nabla f(x_k)$.

  1. Find $x^*$ and the largest $\alpha$-range for convergence from every $x_0$.
  2. Best fixed $\alpha$ and its worst-case factor on $\|e_k\|$.
  3. $\alpha=\frac25$, $x_0=(1,1,3)$: describe the iterates and $f(x_k)-f^*$.
  4. $\alpha=\frac9{20}$: for which $x_0$ does the iteration converge?
Hint

The 2×2 block has eigenvalues $2\pm1$; the third coordinate is decoupled with eigenvalue 5.

Show answer
  1. $Qx^*=b$: the block $\begin{pmatrix}2&1\\1&2\end{pmatrix}(x_1,x_2)=(3,3)$ gives $x_1=x_2=1$; $5x_3=5$. $x^*=(1,1,1)$. Eigenvalues: $1$ (eigvec $(1,-1,0)$), $3$ ($(1,1,0)$), $5$ ($(0,0,1)$). Range $0\lt\alpha\lt2/5$.
  2. $\alpha_{\rm opt}=2/(1+5)=1/3$; multipliers $2/3,\,0,\,-2/3$; factor $(\kappa-1)/(\kappa+1)=4/6=2/3$.
  3. Multipliers at $\alpha=\frac25$: $\frac35,\,-\frac15,\,-1$. $e_0=(0,0,2)$ lies on the $\lambda=5$ eigenvector, multiplier $-1$: $x_k$ alternates $(1,1,3),(1,1,-1),(1,1,3),\dots$; $f-f^*=\frac12\cdot5\cdot2^2=10$ forever. No convergence (endpoint $2/\lambda_{\max}$ excluded).
  4. Multipliers at $\alpha=\frac9{20}$: $\frac{11}{20},\,-\frac7{20},\,-\frac54$. The $\lambda=5$ mode blows up unless its component is zero: converges iff $e_0\perp(0,0,1)$, i.e. $\boxed{x_{0,3}=1}$, with $x_{0,1},x_{0,2}$ arbitrary (a plane through $x^*$). E.g. $x_0=(3,0,1)\to(1,1,1)$.
N2 New: one exact-line-search stepDescriptive

$Q=\begin{pmatrix}3&1\\1&3\end{pmatrix}$, $b=(4,4)$, $x_0=(2,1)$. Do one steepest-descent step with exact line search. Check the zigzag property, compute the ratio $\frac{f(x_1)-f^*}{f(x_0)-f^*}$ and compare it with the Kantorovich bound.

Show answer
  1. $x^*=Q^{-1}b=(1,1)$, $f^*=-4$. $g_0=Qx_0-b=(7-4,\,5-4)=(3,1)$.
  2. $g_0^Tg_0=10$, $Qg_0=(10,6)$, $g_0^TQg_0=36$, $\alpha_0=10/36=5/18$.
  3. $x_1=(2,1)-\frac5{18}(3,1)=(7/6,\,13/18)$. $g_1=Qx_1-b=(2/9,\,-2/3)$; $g_1^Tg_0=\frac23-\frac23=0$ ✓.
  4. $f(x_0)=-5/2$, $f(x_1)=-35/9$. Ratio $\frac{-35/9+4}{-5/2+4}=\frac{1/9}{3/2}=\frac2{27}\approx0.074$.
  5. Eigenvalues 2, 4 ⇒ $\kappa=2$, bound $(1/3)^2=1/9\approx0.111$. Actual $2/27\le1/9$ ✓ (this start is not a worst case). Formula check: $1-\frac{(g^Tg)^2}{(g^TQg)(g^TQ^{-1}g)}=1-\frac{100}{36\cdot(25/6)}=\frac{2}{27}$ ✓.
N3 New: two CG steps by handDescriptive

$Q=\begin{pmatrix}2&1\\1&3\end{pmatrix}$, $b=(1,0)$, $x_0=0$. Run CG until it stops. Verify $g_0^Tg_1=0$, $d_0^TQd_1=0$, and that $x_2=Q^{-1}b$.

Show answer
  1. $g_0=-b=(-1,0)$, $d_0=(1,0)$, $\|g_0\|^2=1$, $Qd_0=(2,1)$, $d_0^TQd_0=2$, $\alpha_0=\frac12$.
  2. $x_1=(\frac12,0)$, $g_1=g_0+\frac12(2,1)=(0,\frac12)$. $g_0^Tg_1=0$ ✓. $f(x_1)=-\frac14$.
  3. $\beta_0=\frac{1/4}{1}=\frac14$, $d_1=-g_1+\frac14d_0=(\frac14,-\frac12)$. $d_0^TQd_1=(2,1)\cdot(\frac14,-\frac12)=0$ ✓.
  4. $Qd_1=(0,-\frac54)$, $d_1^TQd_1=\frac58$, $\alpha_1=\frac{1/4}{5/8}=\frac25$.
  5. $x_2=(\frac12,0)+\frac25(\frac14,-\frac12)=(\frac35,-\frac15)$, $g_2=g_1+\frac25(0,-\frac54)=(0,0)$. $Q^{-1}b=\frac15\begin{pmatrix}3&-1\\-1&2\end{pmatrix}(1,0)=(\frac35,-\frac15)$ ✓. $f(x_2)=-\frac3{10}$.
  6. Why 2 steps: $Q$ has 2 distinct eigenvalues ($\frac{5\pm\sqrt5}{2}$) and $e_0$ touches both. Note $d_0^Td_1=\frac14\ne0$: conjugate, not orthogonal.
N4 New: how many CG stepsShort answer

$Q=\mathrm{diag}(1,3,3,7,7,7)$. (a) $x_0-x^*=(0,2,-1,0,1,1)$: exact number of CG steps? (b) Worst case over all $x_0$? (c) Condition on $e_0\ne0$ for one-step termination.

Show answer

(a) Components live in the eigenspaces of 3 (coords 2–3) and 7 (coords 5–6); eigenvalue 1 has 0 component. 2 steps (verified numerically). (b) 3 distinct eigenvalues ⇒ at most 3 steps, not 6. (c) $e_0$ (equivalently $g_0=Qe_0$) is an eigenvector of $Q$, i.e. lies in a single eigenspace.

N5 New: check Armijo / Wolfe / strong Wolfe / GoldsteinDescriptive

$f(x)=x_1^2+4x_2^2$, $x_k=(2,1)$, $d_k=-\nabla f(x_k)$. Take $c_1=0.1$, $c_2=0.5$, Goldstein $c=0.25$. (a) Is $d_k$ a descent direction? (b) For $\alpha\in\{0.02,\ 0.1,\ 0.25,\ 0.3\}$ decide which conditions hold. (c) Which $\alpha$ does Armijo backtracking with $s=\frac12$ (start $\alpha=1$) accept?

Hint

Form $\phi(\alpha)=f(x_k+\alpha d_k)$ explicitly; then each test is arithmetic.

Show answer
  1. $\nabla f=(2x_1,8x_2)=(4,8)$, $d_k=(-4,-8)$, $\nabla f^Td_k=-80\lt0$: descent ✓.
  2. $\phi(\alpha)=(2-4\alpha)^2+4(1-8\alpha)^2=8-80\alpha+272\alpha^2$, $\phi'(\alpha)=-80+544\alpha$. Exact $\alpha^*=5/34\approx0.147$.
  3. Tests: Armijo $\phi(\alpha)\le8-8\alpha$; Wolfe $\phi'(\alpha)\ge-40$; strong $|\phi'(\alpha)|\le40$; Goldstein $8-60\alpha\le\phi(\alpha)\le8-20\alpha$.
    αφ(α)Armijo RHSφ′(α)ArmijoWolfeStrong W.Goldstein
    0.026.5097.84−69.1✓✗ (too short)✗✗ (below 6.8)
    0.12.727.2−25.6✓✓✓✓ (in [2, 6])
    0.2556+56✓✓✗ (56 > 40)✗ (above 3)
    0.38.485.6+83.2✗(✓ curvature only)✗✗
  4. Intervals: Armijo $(0,\,9/34]$; Wolfe $[5/68,\,9/34]$; strong Wolfe $[5/68,\,15/68]$; Goldstein $[5/68,\,15/68]$ (same here by coincidence of the constants; matches the formulas of Ex 2.3 in B3 with $\sigma=80$, $\omega=544$).
  5. (c) $\alpha=1$: $\phi=200\gt0$ ✗; $\alpha=\frac12$: $\phi=36\gt4$ ✗; $\alpha=\frac14$: $5\le6$ ✓. Backtracking accepts $\alpha=0.25$, which overshoots $\alpha^*$ and fails strong Wolfe: Armijo alone only caps the step.
N6 New: one Newton step on a non-quadraticDescriptive

$f(x)=x_1^4+x_1^2+x_1x_2+x_2^2$, $x_0=(1,0)$. (a) Compute one Newton step. (b) Is the Newton direction a descent direction? (c) Did $f$ decrease? (d) Where is $x^*$ and what local rate do you expect?

Show answer
  1. $\nabla f=(4x_1^3+2x_1+x_2,\ x_1+2x_2)$, $\nabla^2f=\begin{pmatrix}12x_1^2+2&1\\1&2\end{pmatrix}$. At $x_0$: $g_0=(6,1)$, $H_0=\begin{pmatrix}14&1\\1&2\end{pmatrix}$, $\det=27$.
  2. Solve $H_0p=-g_0$: $p=-\frac1{27}\begin{pmatrix}2&-1\\-1&14\end{pmatrix}(6,1)=(-\frac{11}{27},-\frac8{27})$. $x_1=(\frac{16}{27},-\frac8{27})\approx(0.593,-0.296)$.
  3. (b) $H_0\succ0$ (minors 14, 27), so $g_0^Tp=-p^TH_0p=-\frac{74}{27}\lt0$: descent ✓.
  4. (c) $f(x_0)=2$, $f(x_1)\approx0.387$: decreased.
  5. (d) $\nabla f=0$: $x_2=-x_1/2$, then $4x_1^3+\frac32x_1=0\Rightarrow x_1=0$. $x^*=(0,0)$, $\nabla^2f(x^*)=\begin{pmatrix}2&1\\1&2\end{pmatrix}\succ0$, so quadratic convergence once close. Numerically $\|x_k\|$: $0.66,\ 0.33,\ 0.088,\ 0.0028,\ 9\times10^{-8},\ 3\times10^{-21}$ (slow at the start; at the end the digits more than double, roughly tripling: all third derivatives of $f$ vanish at $x^*=0$, so here it is even cubic. The guaranteed rate is quadratic.)
N7 New: effective condition numberMCQ

Steepest descent with exact line search on $Q=\mathrm{diag}(1,2,10,50)$, $b=0$, from $x_0=(0,1,1,0)$. Which guaranteed bound on $f(x_{k+1})/f(x_k)$ is the tightest valid one from the course results?

  1. (a) $(49/51)^2$
  2. (b) $(4/6)^2=4/9$
  3. (c) $(9/11)^2$
  4. (d) 0: it terminates in one step
Show answer

Answer: (b). $g_0=Qx_0=(0,2,10,0)$ lies in the eigenspaces of 2 and 10 only, which are invariant under every $I-\alpha_kQ$; effective $\kappa=10/2=5$, factor $((5-1)/(5+1))^2=4/9$. (a) uses the full $\kappa=50$ (valid but not tight). (c) uses $\kappa=10$ (mixing in eigenvalue 1, which is absent). (d) needs $g_0$ to be an eigenvector. (Numerically the ratio is 0.106 each step, below 4/9.)

N8 New: Zoutendijk / angle conditionMCQ

$d_k=-D_k\nabla f(x_k)$ where each $D_k$ is symmetric with eigenvalues in $[1,4]$, and $\alpha_k$ satisfies strong Wolfe ($f$ bounded below, $\nabla f$ Lipschitz). Which statement is correct?

  1. (a) $d_k$ is a descent direction, $\cos\theta_k\ge1/4$, and $\|\nabla f(x_k)\|\to0$.
  2. (b) $d_k$ may fail to be a descent direction unless $D_k$ is diagonal.
  3. (c) Zoutendijk gives $\sum_k\|\nabla f(x_k)\|^2\lt\infty$ without any angle condition.
  4. (d) The conclusion needs exact line search; strong Wolfe is not enough.
Show answer

Answer: (a). $-\nabla f^Td=\nabla f^TD\nabla f\ge1\cdot\|\nabla f\|^2\gt0$ and $\|d\|\le4\|\nabla f\|$, so $\cos\theta\ge1/4$; Zoutendijk then forces $\|\nabla f_k\|^2\to0$. (b) PD is all that matters. (c) the sum carries $\cos^2\theta_k$. (d) Zoutendijk needs only Wolfe steps (strong Wolfe is a special case), not exact line search.

N9 New: Newton trapsMCQ

Which statement is true?

  1. (a) For a strictly convex $C^2$ function, pure Newton converges quadratically from every $x_0$.
  2. (b) On $f=\frac12x^TQx-b^Tx$ with $Q\succ0$, one pure Newton step from any $x_0$ gives $x^*$.
  3. (c) If $\nabla^2f(x_k)$ is indefinite, a small enough damped step along the Newton direction always decreases $f$.
  4. (d) Damped Newton with Armijo backtracking never accepts the full step $\alpha=1$.
Show answer

Answer: (b). The model is exact: $x_1=x_0-Q^{-1}(Qx_0-b)=Q^{-1}b$. (a) false: $\sqrt{1+x^2}$ from $|x_0|\gt1$ diverges; the theorem is local ("sufficiently close"). (c) false: with indefinite $H$ the Newton direction may be an ascent direction, and damping cannot fix the direction. (d) false: near a minimiser with PD Hessian the full step is eventually accepted.

N10 New: golden sectionMCQ

Golden-section search on $[0,10]$. The first two interior points, and the bracket length after 4 reductions, are:

  1. (a) $3.82,\ 6.18$; about $1.46$
  2. (b) $3.82,\ 6.18$; $0.625$
  3. (c) $5,\ 5$; $0.625$
  4. (d) $3.82,\ 6.18$; about $0.21$
Show answer

Answer: (a). Points at $\rho L$ and $(1-\rho)L$ with $\rho=0.382$; each reduction multiplies the length by $0.618$: $10\times0.618^4\approx1.459$. (b),(c) are bisection-style halving ($10/16$). (d) multiplies by $0.382$ (that is the piece discarded, not kept).

N11 New: CG and conjugacy trapsMCQ

Linear CG on $f=\frac12x^TQx-b^Tx$, $Q\succ0$, after $k$ steps with $g_k\ne0$, $1\le k\lt n$. Which is true?

  1. (a) $\nabla f(x_k)=0$ because $x_k$ minimises $f$ over $x_0+\mathrm{span}\{d_0,\dots,d_{k-1}\}$.
  2. (b) The directions $d_0,\dots,d_{k-1}$ are mutually orthogonal.
  3. (c) $g_k^Td_i=0$ for all $i\lt k$, and $f(x_k)\lt f(x_{k-1})$.
  4. (d) $\|g_k\|\lt\|g_{k-1}\|$ always.
Show answer

Answer: (c). Affine-space optimality is $D^T\nabla f=0$: the gradient is orthogonal to every $d_i$, and each step decreases $f$ by $\|g\|^4/(2d^TQd)\gt0$. (a) is exactly his "memorise and make the mistake" trap. (b) directions are Q-conjugate, not orthogonal. (d) false: Quiz 2 Q10 has $\|g_1\|=3/2\gt1$.

N12 New: spot the non-descent directionMCQ

$f(x)=x_1^2+x_1x_2+2x_2^2$ at $x=(1,1)$. Which direction is not a descent direction?

  1. (a) $(-1,0)$
  2. (b) $(1,-1)$
  3. (c) $(-5,3)$
  4. (d) $(0,-1)$
Show answer

Answer: (c). $\nabla f=(2x_1+x_2,\ x_1+4x_2)=(3,5)$. Slopes: (a) $-3$, (b) $3-5=-2$, (c) $-15+15=0$, (d) $-5$. A descent direction needs a strictly negative slope; (c) is tangent to the level curve. (b) is the tempting wrong pick: it increases $x_1$, but the slope is still negative.

N13 New: 1-D Newton with negative curvatureShort answer

$f(x)=\tfrac14x^4-\tfrac12x^2$, $x_0=0.5$. (a) Compute the Newton step $p_0=-f'(x_0)/f''(x_0)$. (b) Is it a descent direction? (c) What happens to $f$ after a damped step $x_0+0.1p_0$? (d) What should a safeguarded method do instead?

Show answer
  1. (a) $f'(x)=x^3-x$, $f''(x)=3x^2-1$. At $0.5$: $f'=-\tfrac38$, $f''=-\tfrac14$. $p_0=-\frac{-3/8}{-1/4}=-\tfrac32$ (so the full step goes to $x_1=-1$).
  2. (b) No. Slope along $p_0$: $f'(x_0)p_0=(-\tfrac38)(-\tfrac32)=+\tfrac9{16}\gt0$: ascent. Since $f''\lt0$, the model parabola opens downward and Newton heads for its top.
  3. (c) $x=0.35$: $f(0.35)\approx-0.0575\gt f(0.5)=-0.109$: $f$ increases. (The full step happens to land on the minimiser $x=-1$, $f=-\tfrac14$, but that is luck, not a property of the method.)
  4. (d) Newton needs $f''(x_k)\gt0$ ($H_k\succ0$ in n-D). When it fails, use a descent direction instead, e.g. $-f'(x_k)$ (here: move right), or modify the curvature to be positive, then line-search.

Self-test (no looking)

S1

Fixed-step GD on a quadratic with eigenvalues $\lambda_1\le\dots\le\lambda_n$: write the error recursion, the convergence condition on $\alpha$, the best $\alpha$ and its rate.

Show answer

$e_{k+1}=(I-\alpha Q)e_k$, mode factors $1-\alpha\lambda_i$; $0\lt\alpha\lt2/\lambda_n$; $\alpha=2/(\lambda_1+\lambda_n)$; $\|e_{k+1}\|\le\frac{\kappa-1}{\kappa+1}\|e_k\|$.

S2

Exact line search along $-g_k$ on a quadratic: step formula, relation between consecutive gradients, and the rate for $f-f^*$. What changes if $g_0$ lies in a few eigen-directions?

Show answer

$\alpha_k=g_k^Tg_k/g_k^TQg_k$; $g_{k+1}^Tg_k=0$ (zigzag); $f(x_{k+1})-f^*\le((\kappa-1)/(\kappa+1))^2(f(x_k)-f^*)$; use the effective $\kappa$ = max/min eigenvalue among the directions present (that subspace is invariant).

S3

State the optimality condition for minimising a convex $f$ over $\bar x+\mathrm{range}(D)$, and the mistake he warned about.

Show answer

$D^T\nabla f(x_S)=0$ ($\nabla h(z)=0$ for $h(z)=f(\bar x+Dz)$). The mistake: claiming $\nabla f(x_S)=0$; it is only orthogonal to the $d_i$.

S4

Write the full CG iteration with the efficient formulas, and the identity for $g_k^Td_k$. Which vectors are orthogonal, which are Q-conjugate?

Show answer

$d_0=-g_0$; $\alpha_k=\|g_k\|^2/d_k^TQd_k$; $x_{k+1}=x_k+\alpha_kd_k$; $g_{k+1}=g_k+\alpha_kQd_k$; $\beta_k=\|g_{k+1}\|^2/\|g_k\|^2$; $d_{k+1}=-g_{k+1}+\beta_kd_k$; $g_k^Td_k=-\|g_k\|^2$. Gradients orthogonal; directions Q-conjugate.

S5

After $k$ CG steps, over which set does $x_k$ minimise $f$? How many steps does CG need in exact arithmetic?

Show answer

$x_0+\mathrm{span}\{g_0,Qg_0,\dots,Q^{k-1}g_0\}$. Exactly the number of distinct eigenvalues of $Q$ whose eigenspaces contain a nonzero component of $e_0$ (at most $n$).

S6

Write Armijo, Wolfe curvature, strong Wolfe and Goldstein in terms of $\phi(\alpha)=f(x_k+\alpha d_k)$, with the allowed constants. What does Zoutendijk say?

Show answer

Armijo $\phi(\alpha)\le\phi(0)+c_1\alpha\phi'(0)$; Wolfe $\phi'(\alpha)\ge c_2\phi'(0)$; strong $|\phi'(\alpha)|\le c_2|\phi'(0)|$; $0\lt c_1\lt c_2\lt1$. Goldstein $\phi(0)+(1-c)\alpha\phi'(0)\le\phi(\alpha)\le\phi(0)+c\alpha\phi'(0)$, $0\lt c\lt\frac12$. Zoutendijk: $\sum\cos^2\theta_k\|\nabla f_k\|^2\lt\infty$; with $\cos\theta_k\ge\delta\gt0$, $\|\nabla f_k\|\to0$.

S7

Newton: what happens in one step on a PD quadratic, when is convergence quadratic, when is the direction a descent direction, and what does damping guarantee? Give the 1-D failure example.

Show answer

Lands on $x^*$. Quadratic only for $x_0$ sufficiently close to $x^*$ with nonsingular Hessian (Lipschitz Hessian). Descent iff $H_k\succ0$. Damped Newton with Armijo eventually accepts $\alpha=1$ near a PD minimiser. $f=\sqrt{1+x^2}$: $x_{k+1}=-x_k^3$, diverges for $|x_0|\gt1$, cycles for $|x_0|=1$.

S8

Four changes when CG is used on a non-quadratic function; PCG orthogonality; effect of $B\to cB$.

Show answer

(1) $\beta_k=g_{k+1}^TF(x_k)d_k/d_k^TF(x_k)d_k$ (original formula, Hessian for $Q$); (2) $\beta_k=0$ if the denominator is $\le0$; (3) $\alpha_k$ by line search (Armijo/Wolfe); (4) if $g_k^Td_k\ge0$ reset $d_k=-g_k$. PCG: $g_i^TBg_j=0$, $d_i^TQd_j=0$. $cB$: same iterates, $d\to cd$, $\alpha\to\alpha/c$.

Summary card (for revision; the formula sheet copies this)

Symbols: $x_k$ point, $g_k=\nabla f(x_k)$ gradient, $d_k$ direction, $\alpha_k$ step, $\phi(\alpha)=f(x_k+\alpha d_k)$, $f=\tfrac12x^TQx-b^Tx$ with $Q\succ0$, $x^*=Q^{-1}b$, $e_k=x_k-x^*$ (so $g_k=Qe_k$), eigenvalues $\lambda_{\min}\le\dots\le\lambda_{\max}$ of $Q$, $\kappa=\lambda_{\max}/\lambda_{\min}$, $H_k$ Hessian, $F(x_k)$ Hessian in non-quadratic CG, $B$ preconditioner, $\theta_k$ angle between $d_k$ and $-g_k$. $E=\|x-x^*\|_Q^2$ in Quiz 2; $E=\tfrac12\|x-x^*\|_Q^2=f-f^*$ in the Ch 3 notes.

Memorise cold: line search (Ch 2)
  • Template $x_{k+1}=x_k+\alpha_kd_k$. Descent direction: $g_k^Td_k\lt0$. Exact step on a quadratic along any $d_k$: $\alpha_k=-\dfrac{g_k^Td_k}{d_k^TQd_k}$; for $d_k=-g_k$: $\alpha_k=\dfrac{g_k^Tg_k}{g_k^TQg_k}$.
  • $\phi'(0)=g_k^Td_k\lt0$. With $0\lt c_1\lt c_2\lt1$:
    Armijo (not too long): $\phi(\alpha)\le\phi(0)+c_1\alpha\phi'(0)$.
    Wolfe = Armijo + curvature (not too short) $\phi'(\alpha)\ge c_2\phi'(0)$.
    Strong Wolfe = Armijo + $|\phi'(\alpha)|\le c_2|\phi'(0)|$.
    Goldstein ($0\lt c\lt\tfrac12$): $\phi(0)+(1-c)\alpha\phi'(0)\le\phi(\alpha)\le\phi(0)+c\,\alpha\phi'(0)$.
    Backtracking: try $\alpha=1,s,s^2,\dots$ ($0\lt s\lt1$), accept the first that passes Armijo.
    Quadratic $\phi$ (Ex 2.3): Armijo $\alpha\le2(1-c_1)\alpha^*$; Wolfe $\alpha\ge(1-c_2)\alpha^*$; strong Wolfe $\alpha\le(1+c_2)\alpha^*$; Goldstein $[2c,\,2(1-c)]\alpha^*$.
  • Golden section: interior points at fraction $\rho=\frac{3-\sqrt5}{2}\approx0.382$ from each end; the bracket shrinks by $\frac{\sqrt5-1}{2}\approx0.618$ per new evaluation (one old point reused).
  • 1-D Newton: $x_{k+1}=x_k-f'(x_k)/f''(x_k)$. Needs $f''\gt0$, and can still fail far away ($\sqrt{1+x^2}$: $x_{k+1}=-x_k^3$).
  • Zoutendijk: Wolfe steps (strong Wolfe also fine) + $f$ bounded below + $\nabla f$ Lipschitz ⇒ $\sum_k\cos^2\theta_k\|g_k\|^2\lt\infty$, $\cos\theta_k=\frac{-g_k^Td_k}{\|g_k\|\|d_k\|}$. If $\cos\theta_k\ge\delta\gt0$ then $\|g_k\|\to0$. $d_k=-D_kg_k$ with eig$(D_k)\in[m,M]$ gives $\cos\theta_k\ge m/M$.
Memorise cold: gradient descent and Newton (Ch 3)
  • Fixed step: $e_{k+1}=(I-\alpha Q)e_k$; the eigen-component along $q_i$ is multiplied by $(1-\alpha\lambda_i)$ each step.
  • Converges from every $x_0$ ⇔ $|1-\alpha\lambda_i|\lt1\ \forall i$ ⇔ $\boxed{0\lt\alpha\lt 2/\lambda_{\max}}$. Best $\alpha=\dfrac{2}{\lambda_{\min}+\lambda_{\max}}$, worst-case factor $\dfrac{\kappa-1}{\kappa+1}$ on $\|e_k\|$.
  • Multiplier $=-1$ ⇒ that component flips sign forever (2-cycle, constant $f$). $|{\cdot}|\gt1$ ⇒ diverges, unless $e_0$ has zero component in that eigen-direction.
  • A gradient step with $\eta=1/\lambda$ kills the $\lambda$-component exactly ($1-\lambda/\lambda=0$).
  • Exact line search SD: $g_{k+1}^Tg_k=0$ (zigzag); $f(x_{k+1})-f^*\le\left(\dfrac{\kappa-1}{\kappa+1}\right)^2(f(x_k)-f^*)$ (Kantorovich). If $g_0$ lives only in some eigen-directions, use the effective $\kappa$ over those only. One-step finish ⇔ $g_0$ is an eigenvector.
  • Newton: $H_kp_k=-g_k$, $x_{k+1}=x_k+p_k$. One step on a quadratic with $Q\succ0$ lands on $x^*$. Quadratic convergence $\|e_{k+1}\|\le C\|e_k\|^2$ only for $x_0$ sufficiently close. Descent iff $H_k\succ0$ ($g_k^Tp_k=-p_k^TH_kp_k$). Damped Newton + Armijo ($c_1\lt\frac12$, start at $\alpha=1$) eventually accepts $\alpha=1$.
  • $\|x\|^p/p$, $1\lt p\lt2$: $\nabla=\|x\|^{p-2}x$, not Lipschitz at 0; $r_{k+1}=r_k|1-\alpha r_k^{p-2}|$; $f$ rises for $r_k\lt(\alpha/2)^{1/(2-p)}$; converges only by an exact hit ($r=\alpha^{1/(2-p)}$); exact line search $\alpha_k=r_k^{2-p}$.
Memorise cold: conjugate directions / CG (Ch 4)
  • Affine-sheet minimum ($f$ convex, directions = columns of $D$): $x_S$ minimises $f$ on $\bar x+\mathrm{range}(D)$ ⇔ $D^T\nabla f(x_S)=0$. The gradient of $h(z)=f(\bar x+Dz)$ is zero; the gradient of $f$ is only orthogonal to every $d_i$, not zero.
  • Q-conjugate: $d_i^TQd_j=0$ ($i\ne j$) = perpendicular after rounding the bowl ($y=Q^{1/2}x$). Nonzero Q-conjugate vectors are linearly independent. Eigenvectors of $Q$ are both orthogonal and Q-conjugate.
  • Key formula: $g_i=g_0+\sum_{j\lt i}\alpha_jQd_j$. With conjugate directions: $d_i^Tg_i=d_i^Tg_0$, $\alpha_i=\beta_i^*=-c_i/h_i$, and $g_k\perp d_0,\dots,d_{k-1}$ (expanding subspace).
  • CG: $d_0=-g_0$; $\ \alpha_k=\dfrac{\|g_k\|^2}{d_k^TQd_k}$; $\ x_{k+1}=x_k+\alpha_kd_k$; $\ g_{k+1}=g_k+\alpha_kQd_k$; $\ \beta_k=\dfrac{\|g_{k+1}\|^2}{\|g_k\|^2}$; $\ d_{k+1}=-g_{k+1}+\beta_kd_k$.
  • $g_k^Td_k=-\|g_k\|^2$. Gradients orthogonal ($g_i^Tg_j=0$), directions Q-conjugate ($d_i^TQd_j=0$). Never swap.
  • $x_k$ minimises $f$ over $x_0+\mathrm{span}\{g_0,Qg_0,\dots,Q^{k-1}g_0\}$ (highest power $k-1$).
  • CG steps to reach $x^*$ = number of distinct eigenvalues whose eigenspaces $e_0$ actually touches ($\le n$). Partial bound: $m$ outliers above $[a,b]$ ⇒ after $m+1$ steps $E$ shrinks by $\big(\frac{b-a}{b+a}\big)^2$.
  • Decrease per step: $f(x_k)-f(x_{k+1})=\dfrac{\|g_k\|^4}{2\,d_k^TQd_k}$ (for $E=\|x-x^*\|_Q^2$ the decrease is twice that). $\|g_k\|$ may increase.
  • PCG ($B\approx Q^{-1}$, SPD): $d_0=-Bg_0$, $\alpha_k=\dfrac{g_k^TBg_k}{d_k^TQd_k}$, $\beta_k=\dfrac{g_{k+1}^TBg_{k+1}}{g_k^TBg_k}$, $d_{k+1}=-Bg_{k+1}+\beta_kd_k$. Then $g_i^TBg_j=0$, $d_i^TQd_j=0$, $g_k^Td_k=-g_k^TBg_k$. $B\to cB$ changes nothing in $x_k$. Speed depends on eig$(B^{1/2}QB^{1/2})$. $f(x_k)$ still decreases; $\|g_k\|$ need not.
  • Non-quadratic CG, four changes: (1) $\beta$ back to the original formula with $Q\to F(x_k)$; (2) $\beta_k=0$ if $d_k^TF(x_k)d_k\le0$; (3) $\alpha_k$ by a line search; (4) if $g_k^Td_k\ge0$, reset $d_k=-g_k$. FR + strong Wolfe ($c_2\lt\frac12$): $-\frac{1}{1-c_2}\le\frac{g_k^Td_k}{\|g_k\|^2}\le\frac{2c_2-1}{1-c_2}\lt0$.