M04 — Optimisation and descent
Minimising and solving are the same problem. Walking downhill is the cheapest way to do either when is large and sparse, and the shape of the bowl decides whether the walk takes ten steps or ten thousand. This notebook derives that speed, fixes it with conjugate gradients and with curvature (Newton), and ends where the S track starts: a fit to data, and a minimum with a constraint attached.
Book pages: Optimisation, A step has a direction and a length and Saddle
point in books/numerical-methods.
The question. Gradient descent and conjugate gradients both only ever multiply by . Why does one need hundreds of times more of those products than the other, and what number predicts it?
By the end you can:
- show that minimising a quadratic is solving , and read the condition number off the shape of its level sets
- derive the stable window for a fixed step from the error rule
- predict and measure the speed of steepest descent, per step, and explain the zig-zag
- say why conjugate gradients finish in at most steps, and use the bound
- use Newton and Gauss–Newton, and say what each needs and when each slows
- write a constrained minimum as a KKT system, and treat a stiff spring as its compliant approximation
Assumes: M01 (measuring a rate) and M03 (the condition number); eigenvalues of a symmetric matrix; the gradient and Hessian of a function of several variables.
How to use it: predict before you reveal, commit before you check, and move the controls until the equation's behaviour stops surprising you.
Warm-up: remember
1. A minimum is a linear solve
Setting: the problem, its sets and its symbols
Problem. Given a symmetric positive definite and , find for the quadratic below, and relate , and the shape of the level sets of to .
| Symbol | In | Meaning |
|---|---|---|
| the number of unknowns; the picture has | ||
| symmetric positive definite (SPD): and for | ||
| the data | ||
| the gradient map and the (constant) Hessian | ||
| a point and the minimiser (the unknown) | ||
| the start in the picture, with | ||
| the error | ||
| the residual | ||
| the -norm, | ||
| the eigenvalues of and orthonormal eigenvectors, | ||
| the condition number ; the slider sets it in | ||
| a level: the level set is |
How these symbols connect
Given an SPD matrix and data , the quadratic defines both a minimisation problem for and a linear system through its gradient and constant Hessian . Measuring any point against defines the error and residual , while itself induces the energy norm and eigenpairs whose extreme ratio is . Setting a level traces the bowl's level set around , which the plot draws from as the slider varies ; all quantities are dimensionless.
Symbol-by-symbol notes
$A$ SPD — symmetric positive definite
Symmetry () guarantees real eigenvalues and a complete orthonormal basis of eigenvectors . Positive definiteness ( for every ) guarantees every , making invertible and strictly convex with a unique global minimiser.
$\nabla f$ and $\nabla^2 f$ — gradient and Hessian
is the vector of first partial derivatives , pointing in the direction of steepest ascent of . is the symmetric matrix of second partial derivatives , which is constant across for a quadratic.
$e$ vs $r$ — error against residual
The error measures displacement from the unknown minimiser, whereas the residual measures how far misses the equation . Notice the sign: , so the downhill direction equals .
$\lVert \cdot \rVert_A$ — the $A$-norm
Defined by for ; positive definiteness of is exactly what makes this a valid norm (strictly positive for ). It weights each eigenvector component by , unlike the Euclidean 2-norm which weights every direction equally.
$\kappa$ and $c$ — condition number and level sets
Because is SPD, its singular values equal its eigenvalues, so is identical to M03's 2-norm condition number . Each selects a single contour around .
Take symmetric positive definite (SPD) and . Its gradient and Hessian are
The gradient vanishes only at , and positive definite makes that the unique minimum. So a minimiser of is a linear solver, and every linear SPD solver is a minimiser. Write and use :
The gap to the minimum is the error in the -norm, and the gradient is minus the residual. A level set is an ellipse whose semi-axes along the eigenvectors are , so the ratio of its axes is : the condition number of M03 is the bowl's narrowness. Move and watch the steepest direction (orange) turn away from the direction to the minimum (green).
| axis ratio | angle between and | |
|---|---|---|
| 10 | 3.16 | 49.0° |
At the bowl is round and the gradient points at the minimum. As grows the gradient points across the valley, at nearly a right angle to where you want to go. Every method below is a different answer to that.
When minimising by solving $Ax = b$ breaks
- Assumes: is symmetric positive definite, so the stationary point is a minimum
- When it fails: with a negative eigenvalue the stationary point is a saddle and has no minimum; a descent method then runs off to along that eigenvector
- Check: a Cholesky factorisation succeeds exactly when is SPD; it is the cheapest test
2. Gradient descent and the step window
Setting: the problem, its sets and its symbols
Problem. Given with SPD, a start and a fixed step , find the set of for which the iterates converge to from every , and the error factor per step as a function of .
| Symbol | In | Meaning |
|---|---|---|
| the number of unknowns; the example has | ||
| SPD matrix and data, as in §1; the example is , , so in coordinates | ||
| the gradient, | ||
| the fixed step length; the slider sets it in | ||
| the iteration count | ||
| the -th iterate and the minimiser; the example starts at | ||
| the error | ||
| the identity | ||
| the eigenvalues of , with and the extremes | ||
| orthonormal eigenvectors, : the modes of the error |
How these symbols connect
Starting from on the SPD quadratic defined by and , fixed-step gradient descent applies the update for using a single scalar step length . Subtracting the minimiser turns that recurrence into a linear map on the errors involving , , and . Expanding in the orthonormal eigenvectors decouples the update into scalar recurrences controlled by the eigenvalues , which determines both which values of converge and the per-step error factor. All quantities are dimensionless.
Symbol-by-symbol notes
$t$ — fixed step length
A constant positive scalar reused at every iteration , independent of the current point . Because adds to , if carries units (such as stiffness), carries the reciprocal units of so is dimensionless.
$x_k$ vs $x, y$ — iterate vectors against coordinates
Subscripts index iterations, so is a full vector and is its error vector. In the example , the unsubscripted letters and denote the two scalar coordinates of a point.
$(\lambda\lt em>i, v\lt /em>i)$ — error modes
Because is symmetric positive definite, its eigenvectors form an orthonormal basis of with positive eigenvalues . Writing in this basis separates the iteration into independent scalar components (modes), with the softest curvature and the stiffest.
$I$ — identity matrix
The identity in , which leaves every eigenvector unchanged (). It pairs with when rewriting the vector update as a single matrix product.
Gradient descent takes with a fixed step . Subtract the fixed point and use :
The error is multiplied by the same matrix every step. Along eigenvector it is multiplied by , so every mode decays only if for all :
The largest curvature sets the limit. The speed is set by the worst factor, .
Reveal result (lock in your prediction above first)
Factors per step: gives , gives , and gives . The worst factor is smallest when the two extreme factors are equal and opposite, . The and lines lie on top of each other (the dashed one is ): the same rate, with the slow mode on opposite axes. Now move the step and watch the path.
| step | stiff mode | soft mode | error after 30 steps |
|---|---|---|---|
| 0.050 | 0.500 | 0.900 | 4.24e-02 |
Above the stiff factor passes 1 and the coordinate grows while it flips sign each step.
source: solvers/ot-solve/src/kernels/gradient.rs:95-126
The browser kernel behind the book's gradient figure: one-dimensional, , so the window is . The step is two lines (grad, next); it flags Unstable once .
pub fn step(a: &mut Arena<'_>) -> Status {
let curvature = a.params()[P_A];
let target = a.params()[P_B];
let step = a.params()[P_STEP];
if !curvature.is_finite() || curvature <= 0.0 || step <= 0.0 {
return Status::BadParameter;
}
let iteration = a.diag()[D_ITER] as usize;
let x = a.state()[S_X];
let grad = curvature * x - target;
let next = x - step * grad;
let state = a.state_mut();
state[S_X] = next;
let slot = (iteration + 1).min(HISTORY - 1);
let value = objective(curvature, target, next);
let out = a.out_mut();
out[O_X + slot] = next;
out[O_F + slot] = value;
let diag = a.diag_mut();
diag[D_ITER] += 1.0;
diag[D_F] = value;
diag[D_GRAD] = curvature * next - target;
diag[D_CONVERGED] = if (curvature * next - target).abs() < 1.0e-9 {
1.0
} else {
0.0
};
if !next.is_finite() || next.abs() > 1.0e6 {
return Status::Unstable;
}
Status::Ok
}
When a fixed step breaks
- Assumes: a known bound on the largest curvature
- When it fails: a step above multiplies the stiffest mode by more than 1 in size each step; the run looks plausible for a while, then overflows
- Check: watch : a fixed-step run whose ever rises on a convex problem has left the window
3. Conditioning sets the speed
Setting: the problem, its sets and its symbols
Problem. Given with SPD of condition number , find the worst-case factor by which steepest descent reduces the error per step, at the best fixed step and with an exact line search, and the number of steps that reduces by a factor .
| Symbol | In | Meaning |
|---|---|---|
| SPD matrix and data, as in §1; the runs use , | ||
| the extreme eigenvalues of | ||
| ; the slider sets it in | ||
| the fixed step that minimises the worst factor over all modes (§2) | ||
| the -th iterate and the minimiser | ||
| the error | ||
| the gradient | ||
| the exact line-search step, | ||
| the -norm, | ||
| the target: stop once ; the try-first question uses | ||
| the number of steps to reach the target |
How these symbols connect
For an SPD quadratic defined by and , the extreme eigenvalues set the condition number (varied by the slider on ). At each iterate with gradient , steepest descent moves along either with the optimal fixed step from §2 or with a step-dependent exact line-search length . Measuring the error in the -norm lets us link to the worst-case contraction factor per step and to the step count needed to meet the relative target ; all quantities are dimensionless.
Symbol-by-symbol notes
$t^*$ vs $t_k$ — best fixed step against exact line search
is a single constant chosen once from the extreme eigenvalues of and held fixed for every step. is recomputed at every iteration by minimising the one-dimensional function along the current gradient , requiring no advance knowledge of or .
$g_k$ — gradient at iterate $k$
Shorthand for , which equals and is minus the residual of §1. The subscript marks the iteration, not a vector component.
$\lVert \cdot \rVert_A$ — why the $A$-norm is measured
Because , reducing is equivalent to reducing the objective value . Every step of exact line search decreases , so decreases monotonically even when the Euclidean error may not.
$\varepsilon$ and $N$ — stopping target and step count
is a user-chosen dimensionless reduction factor (), not machine epsilon from M03. is the smallest iteration index at which that reduction is achieved.
At the best fixed step the worst factor is
So the step count to cut the error by is about : linear in .
Exact line search. Choose each step to minimise along . Setting the derivative in to zero, , gives
The second equation is the same condition read at the new point: each new gradient is perpendicular to the last step, which in a narrow bowl is a zig-zag. The Kantorovich inequality bounds the -norm error by the same per step, and the start attains it. The line search removes the need to know ; it does not remove the dependence on .
Reveal result (lock in your prediction above first)
Measured at : 691 steps to cut the -norm error by ; the factor predicts 691. Conjugate gradients' factor predicts 69 (§4). Move to see the zig-zag and the rate.
| predicted factor | measured factor (20 steps) | steps to | |
|---|---|---|---|
| 20 | 0.9048 | 0.9048 | 139 |
The measured factor is M01's observed rate: the slope of error against , read over 20 steps. From the worst start it equals the bound.
When steepest descent with a line search breaks
- Assumes: a moderate condition number, since the factor per step is
- When it fails: at the error falls by about of itself per step; the run looks converged because barely changes, while the error is still large
- Check: measure the rate as in M01: the slope of error per iteration against
4. Conjugate gradients
Setting: the problem, its sets and its symbols
Problem. Given an SPD , and , find iterates that minimise over that affine space, with -conjugate directions ; bound the number of steps to the exact answer and the error after steps.
| Symbol | In | Meaning |
|---|---|---|
| SPD matrix and data, as in §1; the runs take and the constant load | ||
| the -th iterate and its error , from in the runs | ||
| the residual | ||
| the search directions, -conjugate: for | ||
| the step length along and the weight of in | ||
| the Krylov space | ||
| a real polynomial of degree at most with | ||
| the number of distinct eigenvalues of whose eigenvectors has a component along | ||
| the extreme eigenvalues of and | ||
| the number of cells, set by the menu; is the grid spacing | ||
| the Poisson matrix, tridiagonal with on the diagonal and beside it, ; SPD | ||
| the stopping tolerance ; the runs use |
How these symbols connect
Given an SPD matrix , right-hand side , and start , conjugate gradients updates iterates , residuals , and -conjugate search directions using scalar weights . Each minimises over the affine Krylov space , which links the error to degree- polynomials evaluated at , and hence to both the active-eigenvalue count and the condition number . The test runs apply this on the -cell Poisson matrix with unknowns and until the relative residual falls to ; all quantities are dimensionless.
Symbol-by-symbol notes
$p_k$ and $A$-conjugacy
Two nonzero vectors are -conjugate (or -orthogonal) when , meaning they are orthogonal in the inner product that induces . Do not confuse this with Euclidean orthogonality .
$\mathcal{K}_k$ — Krylov subspace
grows by at most one dimension per step as increases. Since every vector in is a degree- polynomial in applied to , minimising over restricts to the form with .
$P_k \in \mathbb{R}[\lambda]$ and $m$ — polynomial space and active eigenvalues
denotes the ring of real polynomials in one scalar variable ; the constraint fixes the constant term so stays compatible with . The integer counts only the distinct eigenvalues of whose eigenvectors have a nonzero projection in , so can be strictly less than .
$\alpha\lt em>k$ and $\beta\lt /em>k$ — step length and direction weight
scales how far moves along (exact line search along ), while blends the previous direction into the new residual to keep -conjugate to earlier directions. Only carries the reciprocal units of when is dimensional; is always dimensionless.
$N$, $n$, $h$, and $T$ — the 1D Poisson test grid
A grid of cells with two fixed boundary nodes leaves interior unknowns spaced by . The matrix has on its main diagonal and on its first off-diagonals; it is symmetric positive definite and sparse.
Steepest descent forgets: a later step can undo progress along an earlier direction. Choose instead directions that are -conjugate, for . Then an exact line search along leaves the error's components along earlier directions untouched, so after steps minimises over the whole Krylov space . Each new direction needs only the last one, with , so the cost per step is one product with , as for steepest descent.
Minimising over a Krylov space means the error is for the best polynomial of degree with . Two consequences:
- Finite termination. If involves distinct eigenvalues, a degree- polynomial vanishes on all of them, so CG is exact after at most steps.
- The rate. A Chebyshev polynomial on gives
The square root is the whole gain: costs steepest descent about steps per factor and CG about .
Reveal result (lock in your prediction above first)
| cells | unknowns | modes in | CG steps | bound | steepest descent steps | |
|---|---|---|---|---|---|---|
| 64 | 62 | 1608 | 31 | 31 | 429 | 16776 |
CG stops when it has used one step per mode present in the load, here half the unknowns, long before the bound bites. Steepest descent is shown for four times as many steps and has barely started. Doubling the cells roughly quadruples , so steepest descent's count grows about fourfold and CG's bound about twofold: change the cells to compare.
source: solvers/ot-solve/src/kernels/cg.rs:139-157
One CG iteration in the browser kernel: one product with the Laplacian, two dot products ( and ), two vector updates, and the new direction . It stops at a relative residual of .
laplacian(&p_block[..cells], &mut ap_block[..cells], cells);
let p_ap = dot(&p_block[..cells], &ap_block[..cells]);
if !p_ap.is_finite() || p_ap <= 0.0 {
return Status::Unstable;
}
let rs_old = dot(&r_block[..cells], &r_block[..cells]);
let alpha = rs_old / p_ap;
for index in 0..cells {
u_block[index] += alpha * p_block[index];
r_block[index] -= alpha * ap_block[index];
}
let rs_new = dot(&r_block[..cells], &r_block[..cells]);
let beta = rs_new / rs_old;
for index in 0..cells {
p_block[index] = r_block[index] + beta * p_block[index];
}
let mut field = [0.0f64; CAP];
field[..cells].copy_from_slice(&u_block[..cells]);
(rs_new.sqrt(), rs_new.sqrt() < TOLERANCE * initial, field)
When conjugate gradients breaks
- Assumes: symmetric positive definite, and enough precision that the directions stay conjugate
- When it fails: in floating point the directions lose conjugacy, so finite termination is lost and the rate is what you get; an indefinite or non-symmetric breaks it outright
- Check: the residual should fall at least as fast as the bound; a stall means lost conjugacy, a non-SPD matrix, or a preconditioner that is not SPD
5. Newton and Gauss–Newton
Setting: the problem, its sets and its symbols
Problem. Given a twice continuously differentiable with a local minimiser at which is positive definite, and a start , find by Newton steps and measure the order of convergence. Then, for with a residual map , , whose Jacobian has full column rank, find by Gauss–Newton steps .
| Symbol | In | Meaning |
|---|---|---|
| unknowns and residuals; the examples have and | ||
| the objective, twice continuously differentiable; Newton's example is from , and the warning uses Rosenbrock's from | ||
| the -th iterate and the minimiser | ||
| the gradient and the Hessian | ||
| the step, | ||
| the error , measured in the 2-norm | ||
| the observed order , for | ||
| a constant, independent of | ||
| the residuals | ||
| the Jacobian at , full column rank | ||
| the fitted parameters of , so ; start | ||
| the nine sample times, equally spaced, and the data plus the misfit | ||
| the size of the fixed misfit pattern added to the data, set by the slider |
How these symbols connect
Given a smooth objective and a start , Newton's method evaluates the gradient and Hessian , solves for the step , and tracks the error and its observed order . When comes from a nonlinear residual map () with Jacobian , Gauss–Newton replaces with and solves at each step. In the exponential-fit example, the parameters are fitted to nine samples with misfit amplitude controlled by the slider; all quantities are dimensionless.
Symbol-by-symbol notes
$s_k$ vs $s$ — Newton step against misfit scale
is the vector update computed at iteration . The unsubscripted scalar is an unrelated parameter set by the Gauss–Newton slider to scale the fixed misfit pattern added to the data .
$p_k$ — observed convergence order
Defined for as , estimating the exponent in directly from three consecutive errors. Do not confuse this scalar with the search-direction vector of §4.
$r$ and $J_k$ — residual map and its Jacobian
maps the model parameters to the discrepancies , and has entries evaluated at . Requiring to have full column rank () makes symmetric positive definite.
$H\lt em>k$ vs $J\lt /em>k^{\mathsf T}J_k$ — exact Hessian against Gauss–Newton approximation
For , the exact Hessian is . Gauss–Newton keeps only the first-derivative term , avoiding the second-derivative matrices while matching whenever .
$c$, $\lambda$, and $(t\lt em>i, y\lt /em>i)$ — the exponential-fit data
Here parameterises the curve , so is a decay rate (not an eigenvalue of a Hessian as in §§1–4). The nine sample times and noisy measurements are fixed data; changing changes the target and therefore shifts the best-fit minimiser .
Descent methods use the slope only. Newton also uses the curvature: minimise the quadratic model , whose minimiser solves
On the quadratic of §1, and , so in one step: the Newton step is the linear solve, and its cost is the solve. On a general smooth the model is exact to second order, and near a minimum with positive definite the error obeys .
Measure it as in M01. Below, Newton on the convex function , minimum at , from . The observed order is .
| error | observed order | |
|---|---|---|
| 0 | 2.40e+00 | — |
| 1 | 1.47e+00 | — |
| 2 | 7.59e-01 | 1.36 |
| 3 | 3.91e-01 | 1.00 |
| 4 | 1.26e-01 | 1.72 |
| 5 | 1.32e-02 | 1.98 |
| 6 | 1.47e-04 | 2.00 |
| 7 | 1.79e-08 | 2.01 |
The first rows are pre-asymptotic, far enough away that the model is poor. Then the order settles at 2: each step doubles the number of correct digits, until the error meets the floor of double precision.
Gauss–Newton. A fit is a minimum of , with residuals and Jacobian . Differentiating twice,
Gauss–Newton drops the second term, which needs second derivatives and is small when the residuals are, and solves . Those are the normal equations of the linear least-squares problem , and (M03), so a careful code solves that problem by QR on instead of forming . With a zero residual at the fit the dropped term vanishes there and the rate is Newton's; with a misfit it is linear. Fitting a tyre model to rig data, a system the book's optimisation page lists, is this problem.
Below: fit to nine points from , , plus a fixed misfit pattern you can scale, starting at , .
| error to the fit | ratio | |
|---|---|---|
| 0 | 1.13e+00 | — |
| 1 | 2.93e-01 | 2.6e-01 |
| 2 | 6.75e-03 | 2.3e-02 |
| 3 | 1.49e-05 | 2.2e-03 |
| 4 | 2.88e-08 | 1.9e-03 |
| 5 | 1.98e-10 | 6.9e-03 |
| 6 | 1.36e-12 | 6.9e-03 |
| 7 | 9.24e-15 | — |
| 8 | 0.00e+00 | — |
Fit , , with residual = 1.30e-02; and . At zero misfit the ratio itself collapses towards zero: quadratic. With a misfit it levels off at a constant, which is linear convergence, and the constant grows with the misfit.
When Newton and Gauss–Newton breaks
- Assumes: a start close enough that the quadratic model is good, and a Hessian (or ) that is positive definite there
- When it fails: far from the minimum the pure Newton step can raise or head for a saddle; Gauss–Newton slows to linear when the residual at the fit is large
- Check: check falls at every step (else damp it with a line search), and measure the observed order: 2 for Newton, less for Gauss–Newton on a misfit
6. Constraints: the KKT system and the compliant spring
Setting: the problem, its sets and its symbols
Problem. Given an SPD , , a constraint matrix of full row rank () and , find minimising subject to , with its multipliers . Then, for each stiffness , find the unconstrained minimiser of , and how the distance behaves in doubles as grows.
| Symbol | In | Meaning |
|---|---|---|
| unknowns and constraints; the example has , | ||
| the displacements; the example is dimensionless, so no quantity in this section carries units | ||
| the stiffness matrix, SPD; the example is | ||
| the applied loads; the example is | ||
| the rule ; full row rank; the example is , | ||
| the Lagrange multipliers; is the reaction force | ||
| the Lagrangian | ||
| the bush stiffness; the slider sets | ||
| the penalised energy | ||
| the minimiser of and the bush force | ||
| the distance from the rigid answer, computed in doubles | ||
| the 2-norm condition number of an SPD matrix | ||
| machine epsilon for doubles, |
How these symbols connect
Given an SPD stiffness matrix , loads , and linear constraint ( of full row rank, ), introducing multipliers builds the Lagrangian whose stationary conditions give the rigid displacement and reaction . Replacing the hard constraint with a penalty term weighted by stiffness forms the unconstrained energy , yielding a compliant displacement and bush force . Comparing with in double precision () gives the distance , alongside the condition number of the penalised Hessian; the example is dimensionless.
Symbol-by-symbol notes
$B$ and $g$ — full-row-rank linear constraints
has fewer rows than columns () and full row rank , meaning the scalar constraints in are linearly independent and leave free degrees of freedom. If rows of were dependent, the constraint would be either redundant or inconsistent.
$p$ and $B^{\mathsf T}p$ — Lagrange multipliers and reaction force
has one entry per constraint row, while maps those multipliers back into the load space of as the generalised reaction force enforcing . Do not confuse this multiplier with the convergence order of §5 or the search direction of §4.
$\mathcal L(u, p)$ — the Lagrangian and its saddle point
takes both the primal unknown and the dual unknown , so its stationary point is found by setting both and . Because enters linearly, is unbounded below in and its stationary point is a saddle point rather than a minimum.
$k$, $E\lt em>k$, and $(u\lt /em>k, p_k)$ — the compliant penalty model
Here is a continuous real stiffness parameter (not an iteration index as in §§2–5), and adds the quadratic penalty to the unconstrained energy. Its minimiser satisfies in general, and is the resulting spring force that plays the role of .
$d(k)$ and $\kappa(\cdot)$ — rigid-limit error and conditioning
measures the Euclidean distance between the double-precision compliant solution and the rigid KKT solution as sweeps from to . Note that is evaluated on the SPD Hessian of , not on the indefinite KKT matrix.
Minimise subject to . Add a multiplier per constraint and make the Lagrangian stationary in both:
This is the KKT system, and is the force the rule exerts: is the reaction. The book's example, , , , , gives and . The matrix is symmetric but its eigenvalues are -0.651, 2.274, 3.377: indefinite. The solution is a saddle point of , not a minimum, so CG does not apply; MINRES, a Schur-complement method or a direct factorisation with pivoting does.
The compliant version. Replace the rigid rule by a stiff bush of stiffness : . Its minimum solves the SPD system , and the bush force is the multiplier. Writing gives the regularised KKT system with in the corner: rigid is compliance zero. This is the S track's bushed suspension, and its stiffness ladder is the test below.
Reveal result (lock in your prediction above first)
| bush force | rigid | |||
|---|---|---|---|---|
| (0.504000, 0.336000) | -0.007999 | -0.008000 | 8.0e+03 |
The distance falls tenfold per decade of and is smallest near ; above that the conditioning, about , costs more than the bush's softness. The force loses its digits first, because it is times a tiny violation : the multiplier page's "right displacements, wrong forces". A ladder of stiffnesses that keeps falling is the evidence; one very stiff run is not.
When the KKT system and its compliant version breaks
- Assumes: the constraint rows are independent, and for the compliant form a stiffness far above the structure's
- When it fails: redundant rows make the KKT matrix singular; a bush that is too soft gives the wrong answer, and one that is too stiff gives a Hessian too ill-conditioned to solve
- Check: run a ladder of stiffnesses and require the distance to the rigid answer to fall steadily; a turn upwards is the round-off floor
Practice
Hint 1
, so the factor is .
Hint 2
Take logs: , then round up.
Mixed practice. Which method, and why?
Check yourself (closed book)
Keep these:
- Minimising with SPD is solving ; the gap to the minimum is .
- A fixed step needs ; the best one contracts by , so the step count grows like .
- A line search fixes the length, not the direction: steepest descent still zig-zags at the same rate.
- CG makes each direction -conjugate: exact after as many steps as there are eigenvalues in play, and about steps per factor otherwise.
- Newton adds the curvature and converges with order 2; Gauss–Newton drops the residual term and is as fast only when the fit is exact.
- A constraint adds a multiplier and an indefinite KKT matrix; a stiff spring approximates it with error until conditioning wins.
Your connection
Pick one minimisation you have run or relied on (a fit, a training run, a solver's equilibrium). What was its condition number likely to be, and what told you it had converged?
Answers
Practice A. , factor .
Practice B. .
Practice C. , .
Mixed practice. preconditioned CG; Newton (order 2); QR on .
Where the maths is derived
Optional. These notes give the intuition and application; the sources below give the full derivations and proofs.
§1 A minimum is a linear solve
- Nocedal and Wright (2006), Numerical Optimization: first- and second-order optimality conditions for unconstrained problems (ch. 2).
§2 The step window
- Nocedal and Wright (2006), Numerical Optimization: line search methods, the Wolfe conditions, and the rate of steepest descent (ch. 3).
§3 Conditioning sets the speed
- Boyd and Vandenberghe (2004), Convex Optimization: gradient descent with exact and backtracking line search, and its convergence in terms of the condition number (ch. 9).
§4 Conjugate gradients
- Saad (2003), Iterative Methods for Sparse Linear Systems: CG as a Krylov method, its optimality in the A-norm, and the Chebyshev bound (ch. 6).
- Trefethen and Bau (1997), Numerical Linear Algebra: CG as polynomial approximation, and why a clustered spectrum converges fast.
§5 Newton and Gauss–Newton
- Nocedal and Wright (2006), Numerical Optimization: Newton's quadratic convergence (ch. 3) and Gauss–Newton for least squares (ch. 10).
§6 Constraints and the KKT system
- Benzi, Golub and Liesen (2005), Numerical solution of saddle point problems: the indefinite KKT matrix, its eigenvalues, the Schur complement, and penalty and regularised formulations.
- Boyd and Vandenberghe (2004), Convex Optimization: Lagrange multipliers, the KKT conditions, and equality-constrained Newton (ch. 5 and 10).
Compiled from notebooks/methods/m04_optimisation.py — run locally with cd notebooks && uv run marimo edit methods/m04_optimisation.py for live Python scratch cells.
Back to the book: Optimisation · A step has a direction and a length