Reading and display settings

Appearance

System follows your operating system and keeps following it, even if you change it later. The header's sun, moon and monitor cycle the same three options.

Text size (%) 100%

Default. Scales every text size on the site, equations and tables included.

Reading width 70ch

How much text runs across one line of prose. Narrower is easier to track; wider fits more on screen.

Line spacing 1.6

The leading on body text. Taller leading helps a tired eye stay on the line.

Density

Padding and gaps around controls, cards, and tables — how much breathing room the layout leaves itself.

Motion

System follows your operating system. Reduced removes every transition on this site. Full keeps them on unless your system asks for less.

1

Shape the surface

Curvature is a matrix, not a number

Our running example is the two-link planar arm reaching for a target. Near the target, the squared reach error as a function of the two joint angles is, to second order, a quadratic. Choose axes along its principal directions and the whole landscape is two independent parabolas:

$$ f(x,y) \;=\; \tfrac{1}{2}\!\left(\kappa\,x^{2} + y^{2}\right), \qquad H \;=\; \begin{bmatrix} \kappa & 0 \\ 0 & 1\end{bmatrix}, \qquad \lambda_1 = \kappa,\; \lambda_2 = 1. $$

The Hessian $H$ is the local curvature matrix from Multivariable Taylor & critical points. Its eigenvalues are the curvatures along the principal directions, and the level sets of $f$ are ellipses:

$$ \tfrac{1}{2}\!\left(\kappa x^2 + y^2\right) = c \;\Longleftrightarrow\; \frac{x^2}{\,2c/\kappa\,} + \frac{y^2}{2c} = 1. $$

Raise the condition-number slider and the ellipses stretch: the steep direction gets steeper while the shallow direction stays put. The magenta axis is the high-curvature eigendirection $\lambda_{\max}=\kappa$; the blue axis is the low-curvature one $\lambda_{\min}=1$. The ratio $\kappa=\lambda_{\max}/\lambda_{\min}$ is the page's whole story.

Level ellipses of the quadratic, with the two Hessian eigen-axes drawn through the minimum at the origin.

2

A race on one surface

Three optimizers, one landscape

Write the iterate as a sum of eigenvectors, $x_k = a_k \mathbf v_1 + b_k \mathbf v_2$. Gradient descent with step $\eta$ acts on each coordinate independently:

$$ a_{k+1} = (1-\eta\lambda_1)\,a_k, \qquad b_{k+1} = (1-\eta\lambda_2)\,b_k, \qquad \Longrightarrow \qquad f(x_k) - f^\star = \sum_i \tfrac{1}{2}\lambda_i\,(1-\eta\lambda_i)^{2k}\,c_i. $$

So every method is a contraction in the eigenbasis, and the spectrum $\{\lambda_i\}$ sets its rate. Momentum adds a velocity term that cancels the alternating sign of the steep mode; Adam rescales each coordinate by a running estimate of its gradient magnitude. Those are the algorithms of Nonlinear Optimization — here we only watch them race. Drag the start point, press Play, and read the iteration at which each one reaches $|f-f^\star| < 10^{-4}$ on the log-log plot below.

Top: the three trajectories on the contours; drag the white start dot. Bottom: the same runs on log-log axes — a straight line is geometric (linear) convergence.

Blue gradient descent   magenta momentum   purple Adam.
3

Why steepest descent zig-zags

The step is capped by λ_max, the progress by λ_min

Stability requires the step to satisfy $\eta < 2/\lambda_{\max}$, so the largest curvature decides how far you may step. But the smallest curvature decides how fast you finish, because its factor $1-\eta\lambda_{\min}$ is closest to one. With the best fixed step, $\eta = 2/(\lambda_{\max}+\lambda_{\min})$, both coordinates decay by the same ratio

$$ r \;=\; \frac{\kappa-1}{\kappa+1}, \qquad \text{so } f(x_k)-f^\star \;\lesssim\; r^{2k}\bigl(f(x_0)-f^\star\bigr). $$

The steep coordinate cannot decay monotonically at that step — it flips sign every iteration, decaying by $r$ each time. That is the zig-zag: large oscillations across the narrow valley while the valley floor is traversed at a crawl. The condition number is exactly the ratio that makes the two timescales disagree. Increase κ and count the reversals.

Steepest descent from a fixed start. The dashed blue line is the valley floor (the $\lambda_{\min}$ direction); the path bounces across it.

⚠️ A bigger κ does not just look worse — it makes the same fixed step less useful, because the step is forced down by $\lambda_{\max}$ while the slow direction is still paced by $\lambda_{\min}$. The ratio is the entire penalty.
4

How big a step?

The contraction factor is |1 − ηλ| per eigenvalue

Fix the Hessian and sweep the learning rate. Each eigendirection is contracted by $|1-\eta\lambda_i|$: below one it decays, above one it grows, and near one it stalls. The worst eigenvalue gives the worst factor, so the per-iteration contraction is $\max_i |1-\eta\lambda_i|$. For a fixed spectrum the useful window is

$$ 0 < \eta < \frac{2}{\lambda_{\max}}, \qquad \text{best at } \eta^\star = \frac{2}{\lambda_{\max}+\lambda_{\min}} \;\Longrightarrow\; \max_i|1-\eta^\star\lambda_i| = \frac{\kappa-1}{\kappa+1}. $$

Slide η from a crawl through the sweet spot into divergence. The readout prints both contraction factors and the verdict. This is the only knob the algorithms share; how each one chooses it belongs to Nonlinear Optimization.

Gradient descent at the chosen step, with the fixed spectrum $\lambda_{\max}=10$, $\lambda_{\min}=1$. The path leaves the frame when η exceeds $2/\lambda_{\max}$.

5

Curvature is the fix

One Newton step versus many gradient steps

Gradient descent has to guess a single step for a whole spectrum. Newton's method uses the curvature itself. Minimising the quadratic model $f + \mathbf g^{\mathsf T}p + \tfrac{1}{2}p^{\mathsf T}H p$ gives $\mathbf g + H p = 0$, so the Newton step is the solve

$$ p \;=\; -\,H^{-1}\mathbf g, \qquad \mathbf g=\nabla f(x). $$

On a quadratic the model is exact, so one step lands on the minimum — regardless of κ. The demo below solves $Hp=-\mathbf g$ with the same Gaussian elimination a Gauss–Newton or Levenberg–Marquardt step uses; slide κ and watch Newton keep its single step while gradient descent needs ever more. Cost per step is the trade: Newton forms and solves an $n\times n$ system, which is $O(n^3)$ and infeasible when the parameter count is large.

Gradient descent (blue, many small steps) and the single Newton arrow (magenta) to the minimum at the origin.

6

Methods at a glance

What curvature costs, and what it buys

For the current condition number $\kappa$, the iteration counts below are the ones the race actually runs to. Directional curvature is what separates them: gradient descent sees one number, momentum remembers the last direction, Newton reads the whole matrix. Their construction and their many variants are the subject of Nonlinear Optimization.

MethodCost per stepIterations to |f − f*| < 10⁻⁴Condition-number dependence
Gradient descent$O(n)$ — one gradient— at κ = —Rate $((\kappa-1)/(\kappa+1))^{2k}$; degrades fast as κ grows
Momentum (heavy ball)$O(n)$ — gradient + velocity— at κ = —Same spectrum, faster slow mode; still κ-limited
Newton$O(n^3)$ — solve $Hp=-g$— at κ = —Invariant to κ on a quadratic; one exact step
7

Where this shows up

The why behind the solvers

This page deliberately stopped at the explanation. The algorithms live in Nonlinear Optimization, and every one of them is a response to the picture above: Gradient Descent takes the step this page showed can only crawl in the shallow direction; Newton replaces it with the $H^{-1}$ solve from Step 5; Gauss–Newton builds an approximate Hessian $J^{\mathsf T}J$ when a true one is unavailable; and Levenberg–Marquardt interpolates between the two, damping exactly the ill-conditioned directions that make κ large. The curvature machinery itself — eigenvalues, the quadratic model, the second-derivative test — is Multivariable Taylor & critical points (Volume I, Part 14). And on the arm: the reach error is a surface whose conditioning changes with the pose, which is precisely why trust-region solvers watch it.

8

Notation to carry forward

ObjectReads asWhat it decides
H = ∇²fThe Hessian, the curvature matrixThe shape of the local quadratic; bowl, dome or saddle
λ₁ ≥ λ₂ ≥ …Eigenvalues of HCurvature along each principal direction
κ = λ_max / λ_minCondition numberHow mismatched the timescales are; sets the slow mode
|1 − ηλ_i|Contraction factor for eigendirection i< 1 decays, > 1 diverges; > 2/λ_max is unstable
η* = 2/(λ_max+λ_min)Best fixed gradient stepGives the rate ((κ−1)/(κ+1)) per step
p = −H⁻¹gThe Newton stepReaches the quadratic's minimum in one move
f(x_k) − f*SuboptimalityThe vertical axis of the log-log convergence plot
9

Further reading

10

Check your understanding

0/4 answered