Mathematical Foundations

VI.5 · Optimization

When does a larger step help, oscillate, or run away?

Follow the same quadratic from the same starting point at several learning rates. Curvature turns the shared rate into a separate error multiplier for each coordinate, making convergence and failure predictable.

Inspect stability and the actual learning-rate history

Parameter space: θ₁ and θ₂

Iteration 0: at θ ≈ (2, 1), L ≈ 4 and gradient ≈ (2, 4). Rate η ≈ 0.25 gives update ≈ (−0.5, −1). Adding that update gives θ next ≈ (1.5, 0) and L next ≈ 1.125. The step follows the negative gradient; a finite step can still increase loss. Iteration 0: at θ ≈ (2, 1), L ≈ 4 and gradient ≈ (2, 4). Rate η ≈ 0.25 gives update ≈ (−0.5, −1). Adding that update gives θ next ≈ (1.5, 0) and L next ≈ 1.125. The step follows the negative gradient; a finite step can still increase loss. Stop: iteration budget. Parameters outside the displayed window are retained in the table; the view never changes the path. Quadratic stability: monotone contraction; eigenvalues (1, 4), mode factors ≈ (0.75, 0). All starts converge exactly in real arithmetic only for 0 < η < 0.5. An initially zero unstable component is an exceptional run.

Loss slice: θ₂ = 0

This is a slice of the objective in parameter space, with θ₂ fixed at zero.

Current parameter vector
(2, 1)
Current objective value
4
Actual gradient components
(2, 4)
Learning rate
0.250000
Update vector
(−0.5, −1)
Next parameter vector
(1.5, 0)
New objective value
1.125000
Quadratic error multipliers
(0.75, 0)
All-mode stability bound
0.500000

≈ binary64 calculation · = analytic classification. Replay selects the same evaluated step in every view.

Iteration 0: at θ ≈ (2, 1), L ≈ 4 and gradient ≈ (2, 4). Rate η ≈ 0.25 gives update ≈ (−0.5, −1). Adding that update gives θ next ≈ (1.5, 0) and L next ≈ 1.125. The step follows the negative gradient; a finite step can still increase loss. Stop: iteration budget. Parameters outside the displayed window are retained in the table; the view never changes the path. Quadratic stability: monotone contraction; eigenvalues (1, 4), mode factors ≈ (0.75, 0). All starts converge exactly in real arithmetic only for 0 < η < 0.5. An initially zero unstable component is an exceptional run.

L=a2(θ1−c)2+2θ22L=\tfrac a2(\theta_1-c)^2+2\theta_2^2
θk+1=θk−η∇L(θk)\theta_{k+1}=\theta_k-\eta\nabla L(\theta_k)
θ1≈[21]+[−0.5−1]≈[1.50]\theta_{1}\approx \begin{bmatrix}2\\1\end{bmatrix}+\begin{bmatrix}-0.5\\-1\end{bmatrix}\approx \begin{bmatrix}1.5\\0\end{bmatrix}
ek+1,i=(1−ηλi)ek,i,0<η<2max⁡(a,4)e_{k+1,i}=(1-\eta\lambda_i)e_{k,i},\quad 0<\eta<\frac2{\max(a,4)}
Evaluated binary64 history. Replay changes the selected row, never the stored mathematics.
kθ(k)L(k)gradientηupdateθ(k+1)L(k+1)
0(2, 1)4(2, 4)0.25(−0.5, −1)(1.5, 0)1.125
1(1.5, 0)1.125(1.5, 0)0.25(−0.375, 0)(1.125, 0)0.632813
2(1.125, 0)0.632813(1.125, 0)0.25(−0.28125, 0)(0.84375, 0)0.355957
3(0.84375, 0)0.355957(0.84375, 0)0.25(−0.210938, 0)(0.632813, 0)0.200226
4(0.632813, 0)0.200226(0.632813, 0)0.25(−0.158203, 0)(0.474609, 0)0.112627
5(0.474609, 0)0.112627(0.474609, 0)0.25(−0.118652, 0)(0.355957, 0)0.063353
6(0.355957, 0)0.063353(0.355957, 0)0.25(−0.088989, 0)(0.266968, 0)0.035636
7(0.266968, 0)0.035636(0.266968, 0)0.25(−0.066742, 0)(0.200226, 0)0.020045
8(0.200226, 0)0.020045(0.200226, 0)0.25(−0.050056, 0)(0.150169, 0)0.011275
9(0.150169, 0)0.011275(0.150169, 0)0.25(−0.037542, 0)(0.112627, 0)0.006342
10(0.112627, 0)0.006342(0.112627, 0)0.25(−0.028157, 0)(0.08447, 0)0.003568
11(0.08447, 0)0.003568(0.08447, 0)0.25(−0.021118, 0)(0.063353, 0)0.002007

Evaluated iteration 0

Iteration 0: at θ ≈ (2, 1), L ≈ 4 and gradient ≈ (2, 4). Rate η ≈ 0.25 gives update ≈ (−0.5, −1). Adding that update gives θ next ≈ (1.5, 0) and L next ≈ 1.125. The step follows the negative gradient; a finite step can still increase loss.

θ1≈[21]+[−0.5−1]≈[1.50]\theta_{1}\approx \begin{bmatrix}2\\1\end{bmatrix}+\begin{bmatrix}-0.5\\-1\end{bmatrix}\approx \begin{bmatrix}1.5\\0\end{bmatrix}

from −3 to 3, up to 2 decimal places

from −3 to 3, up to 2 decimal places

from 0.25 to 4, up to 2 decimal places

from −2 to 2, up to 2 decimal places

from 0.01 to 2, up to 2 decimal places

from 1 to 40, whole numbers only

Compare slow, contracting, damped, boundary, and divergent runs from the same quadratic start. Inspect both error factors beside the actual binary64 update history.

At the default η=1/4\eta=1/4, predict what happens separately to x and y. Now choose the no-decay preset η=1/2\eta=1/2. The first loss still drops, but does the entire parameter vector converge to the minimum? Read the y values over several iterations before answering.

Intuition: one distance scale, two sensitivities

A narrow valley has one direction in which small movements change the gradient sharply and another in which they change it slowly. A shared learning rate must handle both. Too small a rate makes progress slow in the gentle direction; too large a rate overshoots in the steep one.

Overshooting does not automatically mean failure. A coordinate can cross its target on every step and still get closer. The useful distinction is whether its error magnitude shrinks, remains constant, or grows. A path’s zigzag shape alone cannot decide that distinction, and a short initial loss decrease cannot prove long-run convergence.

Definition: error contraction and all-start stability

For L=a(x−c)2/2+2y2L=a(x-c)^2/2+2y^2 with a>0a>0, the unique minimizer is θ∗=(c,0)\theta^*=(c,0). Define error coordinates ex=x−ce_x=x-c and ey=ye_y=y. Gradient descent uses θk+1=θk−η∇L(θk)\theta_{k+1}=\theta_k-\eta\nabla L(\theta_k) with η>0\eta>0.

A scalar error mode with curvature λ>0\lambda>0 obeys

ek+1=(1−ηλ)ek.e_{k+1}=(1-\eta\lambda)e_k.

Here the Hessian eigenvalues are aa and 44, so the two multipliers are rx=1−ηar_x=1-\eta a and ry=1−4ηr_y=1-4\eta. In exact real arithmetic, convergence to the minimizer from every starting point requires

∣rx∣<1,∣ry∣<1⟺0<η<2max⁡(a,4).\abs{r_x}<1,\qquad\abs{r_y}<1 \quad\Longleftrightarrow\quad 0<\eta<\frac{2}{\max(a,4)}.

This is an all-start guarantee for this positive-curvature quadratic. An unstable or nondecaying mode whose initial error is exactly zero remains absent. Such a particular run can converge outside the all-start interval. Neither the formula nor a successful run supplies a universal rate bound for other objectives.

Mechanics: change the rate, keep the comparison controlled

Reset restores the default quadratic, a=1,c=0a=1,c=0, start (2,1)(2,1), and rate 1/41/4. The selected iteration exposes its current point, loss, gradient, rate, displacement, and next point. The error-factor rows connect that evaluated step with the recurrence’s longer-term prediction.

Compare the presets at η=0.03,0.25,0.4,0.5,0.75\eta=0.03,0.25,0.4,0.5,0.75. Their x factors are 0.97,0.75,0.6,0.5,0.250.97,0.75,0.6,0.5,0.25, while their y factors are 0.88,0,−0.6,−1,−20.88,0,-0.6,-1,-2. The first pair is slow, the middle negative factor produces decaying oscillation, and the final two y factors separate nondecay from growth.

The history stores evaluated binary64 states. Replay selects a previous state rather than undoing arithmetic. When the path leaves the plotting window, use the retained table and stated stopping reason; leaving the visible rectangle does not change the mathematical recurrence.

Derivation: the curvature condition is a geometric-series condition

The gradient is (a(x−c),4y)(a(x-c),4y), so direct substitution gives

xk+1−c=xk−c−ηa(xk−c)=(1−ηa)(xk−c),yk+1=(1−4η)yk.x_{k+1}-c=x_k-c-\eta a(x_k-c)=(1-\eta a)(x_k-c), \qquad y_{k+1}=(1-4\eta)y_k.

Unrolling each recurrence yields

xk−c=(1−ηa)k(x0−c),yk=(1−4η)ky0.x_k-c=(1-\eta a)^k(x_0-c),\qquad y_k=(1-4\eta)^ky_0.

For a nonzero initial component, a power rkr^k tends to zero exactly when ∣r∣<1\abs r<1. Solve −1<1−ηλ<1-1<1-\eta\lambda<1: subtract 1 and divide by positive λ\lambda to obtain 0<η<2/λ0<\eta<2/\lambda. Both modes must satisfy this, so the larger curvature sets the shared upper boundary.

Mode factor rNonzero error behavior
0<r<10<r<1Same-side contraction
r=0r=0That component reaches its target in one step
−1<r<0-1<r<0Alternating, shrinking error
r=−1r=-1Alternating without decay
∣r∣>1\abs r>1Growing error magnitude

The loss follows squared factors:

Lk=a2rx2k(x0−c)2+2ry2ky02.L_k=\frac a2r_x^{2k}(x_0-c)^2+2r_y^{2k}y_0^2.

Within the strict all-start interval, each active contribution decreases. Negative factors can therefore produce decreasing loss even while coordinates alternate. At a boundary, an active contribution can remain fixed while another decreases.

Worked examples: a drop, a boundary, and an exception

With η=1/4\eta=1/4, the factors are (3/4,0)(3/4,0). The canonical first step is

(2,1)⟼(3/2,0),L:4⟼9/8.(2,1)\longmapsto(3/2,0),\qquad L:4\longmapsto9/8.

The second point is (9/8,0)(9/8,0) with loss 81/12881/128. For every k≥1k\geq1, the y component is zero and xk=2(3/4)kx_k=2(3/4)^k. This is the default worked replay.

Worked example: Inspect stability and the actual learning-rate history

Parameter space: θ₁ and θ₂

Iteration 0: at θ ≈ (2, 1), L ≈ 4 and gradient ≈ (2, 4). Rate η ≈ 0.25 gives update ≈ (−0.5, −1). Adding that update gives θ next ≈ (1.5, 0) and L next ≈ 1.125. The step follows the negative gradient; a finite step can still increase loss. Iteration 0: at θ ≈ (2, 1), L ≈ 4 and gradient ≈ (2, 4). Rate η ≈ 0.25 gives update ≈ (−0.5, −1). Adding that update gives θ next ≈ (1.5, 0) and L next ≈ 1.125. The step follows the negative gradient; a finite step can still increase loss. Stop: iteration budget. Parameters outside the displayed window are retained in the table; the view never changes the path. Quadratic stability: monotone contraction; eigenvalues (1, 4), mode factors ≈ (0.75, 0). All starts converge exactly in real arithmetic only for 0 < η < 0.5. An initially zero unstable component is an exceptional run.

Loss slice: θ₂ = 0

This is a slice of the objective in parameter space, with θ₂ fixed at zero.

Current parameter vector
(2, 1)
Current objective value
4
Actual gradient components
(2, 4)
Learning rate
0.250000
Update vector
(−0.5, −1)
Next parameter vector
(1.5, 0)
New objective value
1.125000
Quadratic error multipliers
(0.75, 0)
All-mode stability bound
0.500000

≈ binary64 calculation · = analytic classification. Replay selects the same evaluated step in every view.

Iteration 0: at θ ≈ (2, 1), L ≈ 4 and gradient ≈ (2, 4). Rate η ≈ 0.25 gives update ≈ (−0.5, −1). Adding that update gives θ next ≈ (1.5, 0) and L next ≈ 1.125. The step follows the negative gradient; a finite step can still increase loss. Stop: iteration budget. Parameters outside the displayed window are retained in the table; the view never changes the path. Quadratic stability: monotone contraction; eigenvalues (1, 4), mode factors ≈ (0.75, 0). All starts converge exactly in real arithmetic only for 0 < η < 0.5. An initially zero unstable component is an exceptional run.

L=a2(θ1−c)2+2θ22L=\tfrac a2(\theta_1-c)^2+2\theta_2^2
θk+1=θk−η∇L(θk)\theta_{k+1}=\theta_k-\eta\nabla L(\theta_k)
θ1≈[21]+[−0.5−1]≈[1.50]\theta_{1}\approx \begin{bmatrix}2\\1\end{bmatrix}+\begin{bmatrix}-0.5\\-1\end{bmatrix}\approx \begin{bmatrix}1.5\\0\end{bmatrix}
ek+1,i=(1−ηλi)ek,i,0<η<2max⁡(a,4)e_{k+1,i}=(1-\eta\lambda_i)e_{k,i},\quad 0<\eta<\frac2{\max(a,4)}
Evaluated binary64 history. Replay changes the selected row, never the stored mathematics.
kθ(k)L(k)gradientηupdateθ(k+1)L(k+1)
0(2, 1)4(2, 4)0.25(−0.5, −1)(1.5, 0)1.125
1(1.5, 0)1.125(1.5, 0)0.25(−0.375, 0)(1.125, 0)0.632813
2(1.125, 0)0.632813(1.125, 0)0.25(−0.28125, 0)(0.84375, 0)0.355957
3(0.84375, 0)0.355957(0.84375, 0)0.25(−0.210938, 0)(0.632813, 0)0.200226
4(0.632813, 0)0.200226(0.632813, 0)0.25(−0.158203, 0)(0.474609, 0)0.112627
5(0.474609, 0)0.112627(0.474609, 0)0.25(−0.118652, 0)(0.355957, 0)0.063353
6(0.355957, 0)0.063353(0.355957, 0)0.25(−0.088989, 0)(0.266968, 0)0.035636
7(0.266968, 0)0.035636(0.266968, 0)0.25(−0.066742, 0)(0.200226, 0)0.020045
8(0.200226, 0)0.020045(0.200226, 0)0.25(−0.050056, 0)(0.150169, 0)0.011275
9(0.150169, 0)0.011275(0.150169, 0)0.25(−0.037542, 0)(0.112627, 0)0.006342
10(0.112627, 0)0.006342(0.112627, 0)0.25(−0.028157, 0)(0.08447, 0)0.003568
11(0.08447, 0)0.003568(0.08447, 0)0.25(−0.021118, 0)(0.063353, 0)0.002007

Evaluated iteration 0

Iteration 0: at θ ≈ (2, 1), L ≈ 4 and gradient ≈ (2, 4). Rate η ≈ 0.25 gives update ≈ (−0.5, −1). Adding that update gives θ next ≈ (1.5, 0) and L next ≈ 1.125. The step follows the negative gradient; a finite step can still increase loss.

θ1≈[21]+[−0.5−1]≈[1.50]\theta_{1}\approx \begin{bmatrix}2\\1\end{bmatrix}+\begin{bmatrix}-0.5\\-1\end{bmatrix}\approx \begin{bmatrix}1.5\\0\end{bmatrix}

Replay the canonical η=1/4 run: x errors multiply by 3/4, y reaches zero in one step, and the first losses are 4, 9/8, 81/128.

At η=1/2\eta=1/2, the factors become (1/2,−1)(1/2,-1). The first two next points and losses are

θ1=(1,−1), L1=5/2,θ2=(1/2,1), L2=17/8.\theta_1=(1,-1),\ L_1=5/2,\qquad \theta_2=(1/2,1),\ L_2=17/8.

Loss approaches 22 while y alternates between 11 and −1-1. The vector does not converge to (0,0)(0,0); decreasing loss has concealed a nondecaying mode.

At η=3/4\eta=3/4, a start (2,1)(2,1) has yk=(−2)ky_k=(-2)^k, so its y error grows. A start (2,0)(2,0) instead has yk=0y_k=0 and xk=2(1/4)kx_k=2(1/4)^k, so it converges. This zero-mode exception does not refute the all-start boundary 1/21/2.

For a balanced comparison inside the interval, η=2/5\eta=2/5 gives factors (3/5,−3/5)(3/5,-3/5). Its first point is (6/5,−3/5)(6/5,-3/5) and loss 36/2536/25. Both squared contributions multiply by 9/259/25 thereafter. This first loss is higher than the canonical first loss, yet its worst error factor is smaller: fastest initial improvement and fastest eventual contraction need not select the same rate.

Executable reference code

The standard-library program uses exact Fraction arithmetic for the gradient steps, then independently checks every stored point against the closed-form powers. Literal assertions cover slow contraction, canonical steps, the boundary, damped oscillation, a growing mode, and a zero-mode exception. It also supports positive curvature beyond the bounded explorer, including the hand-worked a=8a=8 exercise.

The NumPy program advances multiple rates simultaneously with matrix operations, then compares the complete bounded path with a separately broadcasted power grid. Its documented tolerances apply to these binary64 calculations; the analytic recurrence establishes the convergence condition. No finite iteration budget proves an asymptotic theorem by itself.

code/python/optimization_rate.py
"""Exact quadratic error factors and rate-dependent trajectories; no third-party imports."""
from fractions import Fraction as F


def factors(eta, a=1):
    eta, a = F(eta), F(a)
    if eta <= 0 or a <= 0:
        raise ValueError("Require positive curvature a and learning rate eta")
    return (1-eta*a, 1-4*eta)


def trajectory(start=(2, 1), eta=F(1, 4), iterations=8, a=1, c=0):
    if type(iterations) is not int or not 0 <= iterations <= 1000:
        raise ValueError("Require an integer iteration count in [0,1000]")
    x, y = map(F, start)
    eta, a, c = F(eta), F(a), F(c)
    fx, fy = factors(eta, a)
    path = [(x, y)]
    for _ in range(iterations):
        gradient = (a*(x-c), 4*y)
        x, y = x-eta*gradient[0], y-eta*gradient[1]
        path.append((x, y))
    for k, point in enumerate(path):
        assert point == (c+(F(start[0])-c)*fx**k, F(start[1])*fy**k)
    losses = [a*(x-c)**2/2+2*y*y for x, y in path]
    return path, losses


def main():
    assert factors(F(1, 10)) == (F(9, 10), F(3, 5))
    path, losses = trajectory(eta=F(1, 10), iterations=1)
    assert path[1] == (F(9, 5), F(3, 5)) and losses[1] == F(117, 50)
    assert trajectory(eta=F(1, 4), iterations=1)[1] == [4, F(9, 8)]
    boundary, boundary_losses = trajectory(eta=F(1, 2))
    assert boundary[1:3] == [(F(1), F(-1)), (F(1, 2), F(1))]
    assert boundary_losses[:3] == [4, F(5, 2), F(17, 8)]
    assert all(loss > 2 for loss in boundary_losses)
    zero_mode, zero_mode_losses = trajectory((2, 0), F(3, 4))
    assert zero_mode[1] == (F(1, 2), F(0))
    assert all(b < a for a, b in zip(zero_mode_losses, zero_mode_losses[1:]))
    divergent, _ = trajectory((2, 1), F(3, 4), 4)
    assert divergent[-1][1] == 16
    alternating, alternating_losses = trajectory(eta=F(3, 8))
    assert alternating[1] == (F(5, 4), F(-1, 2))
    assert all(b < a for a, b in zip(alternating_losses, alternating_losses[1:]))
    balanced, balanced_losses = trajectory(eta=F(2, 5), iterations=2)
    assert balanced[1] == (F(6, 5), F(-3, 5))
    assert balanced_losses == [4, F(36, 25), F(324, 625)]
    assert factors(F(1, 8), a=8) == (0, F(1, 2))
    assert trajectory((2, 1), F(1, 8), 1, a=8, c=1)[0][1] == (1, F(1, 2))
    assert F(2, max(8, 4)) == F(1, 4)
    for invalid in (0, -1):
        try:
            factors(invalid)
        except ValueError:
            pass
        else:
            raise AssertionError("Nonpositive learning rate accepted")
    print("Exact default factors at eta=1/4:", factors(F(1, 4)))
    print("Exact eta=1/2 boundary path:", boundary[:4], "; y does not decay")
    print("All-start stability: 0 < eta < 2/max(a,4), for a>0.")
    print("A zero starting component can hide an unstable mode; finite runs are not proofs.")


if __name__ == "__main__":
    main()
code/python/optimization_rate_numpy.py
"""Vectorized binary64 GD paths for many rates, checked by a closed-form power grid."""
import numpy as np


def trajectories(start, rates, iterations=12, a=1.0, c=0.0):
    start, rates = np.asarray(start, dtype=np.float64), np.asarray(rates, dtype=np.float64)
    if start.shape != (2,) or rates.ndim != 1 or not rates.size:
        raise ValueError("Require one two-component start and a nonempty rate vector")
    if not np.all(np.isfinite(start)) or not np.all(np.isfinite(rates)) or np.any(rates <= 0):
        raise ValueError("Require finite start and positive finite rates")
    if not np.isfinite(a) or a <= 0 or not np.isfinite(c):
        raise ValueError("Require positive finite a and finite c")
    if type(iterations) is not int or not 0 <= iterations <= 1000:
        raise ValueError("Require an integer iteration count in [0,1000]")
    center, hessian = np.array([c, 0.0]), np.diag([a, 4.0])
    path = np.empty((iterations+1, rates.size, 2), dtype=np.float64)
    path[0] = start
    for k in range(iterations):
        path[k+1] = path[k] - rates[:, None]*((path[k]-center) @ hessian)
        if not np.all(np.isfinite(path[k+1])):
            raise OverflowError(f"Non-finite binary64 iterate at step {k+1}")
    shifted = path-center
    losses = np.einsum("kni,ij,knj->kn", shifted, hessian, shifted)/2
    if not np.all(np.isfinite(losses)):
        raise OverflowError("Non-finite binary64 loss")
    return path, losses


def main():
    rates = np.array([0.03, 0.25, 0.4, 0.5, 0.75])
    path, losses = trajectories([2, 1], rates)
    factors = 1-rates[:, None]*np.array([1.0, 4.0])
    powers = np.arange(13)[:, None, None]
    direct = np.array([2.0, 1.0])*factors[None, :, :]**powers
    np.testing.assert_allclose(path, direct, rtol=2e-14, atol=1e-14)
    np.testing.assert_array_equal(path[1, 1], [1.5, 0])
    np.testing.assert_array_equal(path[:3, 3, 1], [1, -1, 1])
    assert np.all(np.diff(losses[:, :3], axis=0) < 0)
    assert path[-1, 4, 1] == 4096
    exception, _ = trajectories([2, 0], [0.75], 8)
    np.testing.assert_array_equal(exception[:, 0, 1], np.zeros(9))
    assert exception[-1, 0, 0] == 2*(0.25**8)
    np.testing.assert_array_equal(np.linalg.eigvalsh(np.diag([1.0, 4.0])), [1, 4])
    for invalid in ([0], [-1], [np.nan]):
        try:
            trajectories([2, 1], invalid)
        except ValueError:
            pass
        else:
            raise AssertionError("Invalid rate accepted")
    print("Binary64 final losses by rate ≈", losses[-1])
    print("The eta=0.5 y mode alternates without decay; eta=0.75 grows unless y starts at zero.")
    print("Closed-form cross-check: rtol=2e-14, atol=1e-14 on this bounded grid.")


if __name__ == "__main__":
    main()

Explore: predict an active mode before running

Compare the slow preset with the canonical run. Identify the error factor closest to magnitude 1, then predict which coordinate will dominate after many steps. On the default quadratic the x curvature is smaller, so a small rate can erase y error sooner while leaving x progress slow.

Choose damped oscillation and count sign changes in y while comparing its magnitude. Then choose no decay and repeat the comparison. Finally choose the divergent preset with y set to zero, predict the exceptional behavior, and introduce a small nonzero y start to excite the unstable mode.

Move the center c while leaving a and the rate fixed. The x error remains x−cx-c; the multiplier does not change. As a hand extension, use a=8,c=1a=8,c=1, rate 1/81/8, and start (2,1)(2,1). The x error disappears immediately and y halves, producing (1,1/2)(1,1/2). The all-start upper boundary is now 1/41/4, set by the x curvature rather than y.

Common mistakes and counterexamples

The rate is not the error multiplier. Different curvatures convert the same rate into different factors. Also apply the x factor to x−cx-c, not to x, when the center is shifted.

Oscillation does not imply divergence: a factor of −1/2-1/2 contracts, while −1-1 does not decay and −2-2 grows. A short decreasing loss trace does not imply parameter convergence, as the η=1/2\eta=1/2 example demonstrates. A zero starting mode can also make an unstable rate appear safe until that mode is perturbed.

Numerical considerations

The convergence derivation concerns exact real arithmetic. A binary64 trajectory can stagnate when a displacement rounds away, underflow to zero, overflow, or stop at a finite iteration budget. These are computational events, distinct from the behavior of rkr^k as k→∞k\to\infty.

Near a boundary, a small rate or curvature perturbation can move a factor from slightly inside to slightly outside magnitude 1. Compare the unrounded state and a stated numerical error scale rather than a rounded displayed factor. An exactly absent mode is also a special case; small representation or input errors in that coordinate can matter greatly when its factor has magnitude above 1.

The references label numerical trajectories binary64 and reject non-finite states. Their finite tolerance checks verify implementation on a bounded set of runs; the tolerance is not part of the mathematical definition of stability.

Engineering and ML connections

The Hessian describes directional curvature, and gradient descent turns that curvature into repeated errors. For a positive-definite quadratic, a large ratio of largest to smallest curvature can force a shared stable rate that contracts the gentle direction slowly. Parameter scaling can therefore change how efficiently the same optimizer moves.

A neural-network objective usually lacks one constant Hessian valid across the full path, so this quadratic interval must not be presented as its global safety certificate. It is a local mechanism to inspect: changes in curvature, gradient scale, and parameter units can change a rate’s behavior. The next chapter adds momentum, whose extra memory changes the recurrence and requires its own analysis.

Exercises

Calculate factors before predicting a path. State whether a claim concerns every start, an active mode, a finite numerical run, or an exact limit.

calculation

Compute both error factors

For L=x²/2+2y², start at (2,1) and use η=1/10. Give the x and y error factors 1−ηλ, the next x and y, and the next loss.

prediction

Inspect the stability boundary

For the same objective and start, use η=1/2. Give next x, next y, next loss, and the limiting loss as k→∞.

explanation

An inactive mode can hide instability

Use η=3/4 on L=x²/2+2y², but start at (2,0). What does this run imply about the all-start stability bound?

Choose one answer

construction

Account for a different largest curvature

In a hand calculation beyond the explorer bounds, take a=8,c=1 in L=a(x−c)²/2+2y². Give the strict upper rate boundary for convergence from every start. Then use η=1/8 at (2,1) and give both error factors and next x,y.

prediction

Oscillation can still contract

At η=3/8 from (2,1) on the default quadratic, the y coordinate changes sign each step. Which interpretation is correct?

Choose one answer

Summary and checkpoints

A quadratic gradient step multiplies each error mode by 1−ηλ1-\eta\lambda. Check that you can derive the all-start interval, distinguish shrinking oscillation from nondecay, recover the boundary’s limiting loss 22, and explain why an absent unstable mode is an exception. A rate controls a complete trajectory, and its first few favorable updates do not establish the limiting outcome.

The map of the book

97 of 97 chapters written · eight Parts

demo Foundation demo Try the live vector example Open as a page

Part I

Mathematical Language

The notation and mental objects everything else uses.

9 of 9 chapters written

  1. I.1 Scalars, quantities, units, powers and roots available
  2. I.2 Coordinates and points available
  3. I.3 Vectors: components, magnitude, and direction reference chapter available
  4. I.4 Algebraic expressions, equations and inequalities available
  5. I.5 Functions as input → transformation → output available
  6. I.6 Essential function families available
  7. I.7 Sets, intervals, and relations available
  8. I.8 Indexed quantities and summation available
  9. I.9 The notation map for ML available

Part II

Linear Algebra

Matrices as transformations: the strongest foundation in the book.

19 of 19 chapters written

  1. II.1 Vector addition and subtraction available
  2. II.2 Scalar multiplication and vector scaling available
  3. II.3 Norms, magnitude, and normalization available
  4. II.4 Dot product, angle, and orthogonality available
  5. II.5 Projection and distance to a direction available
  6. II.6 Linear combinations and span available
  7. II.7 Linear independence, basis, and coordinates available
  8. II.8 Matrices as linear transformations available
  9. II.9 Matrix × vector available
  10. II.10 Matrix × matrix as composition available
  11. II.11 Transpose and orthogonality available
  12. II.12 Determinant: orientation and area/volume scaling available
  13. II.13 Linear systems as intersecting constraints available
  14. II.14 Gaussian elimination and row operations available
  15. II.15 Rank and invertibility available
  16. II.16 Inverse matrices available
  17. II.17 Eigenvalues and eigenvectors available
  18. II.18 Orthogonal bases and least-squares geometry available
  19. II.19 Singular Value Decomposition available

Part III

Calculus

Change, local approximation, and sensitivity made visible.

15 of 15 chapters written

  1. III.1 Limits through approach available
  2. III.2 Continuity and local behavior available
  3. III.3 Derivative as secant → tangent available
  4. III.4 Derivative as rate of change and local linear model available
  5. III.5 Derivative rules available
  6. III.6 Chain rule available
  7. III.7 Multivariable functions and partial derivatives available
  8. III.8 Gradient and directional derivatives available
  9. III.9 Jacobian available
  10. III.10 Computational graphs and automatic differentiation available
  11. III.11 Hessian and curvature available
  12. III.12 Integrals as accumulation available
  13. III.13 Fundamental derivative/integral connection available
  14. III.14 Numerical differentiation available
  15. III.15 Numerical integration available

Part IV

Probability

Uncertainty through sample spaces, evidence, and repetition.

16 of 16 chapters written

  1. IV.1 Random experiments, outcomes, and sample spaces available
  2. IV.2 Events and probability mass available
  3. IV.3 Counting and finite probability where needed available
  4. IV.4 Conditional probability as restricted sample space available
  5. IV.5 Independence available
  6. IV.6 Bayes' theorem as probability-mass update available
  7. IV.7 Random variables available
  8. IV.8 PMF, PDF, and CDF available
  9. IV.9 Bernoulli and Binomial distributions available
  10. IV.10 Uniform and Gaussian distributions available
  11. IV.11 Expectation available
  12. IV.12 Variance and standard deviation available
  13. IV.13 Joint, marginal, and conditional distributions available
  14. IV.14 Covariance and correlation available
  15. IV.15 Law of Large Numbers available
  16. IV.16 Central Limit Theorem available

Part V

Statistics

From observed data to estimates, intervals, and likelihood.

10 of 10 chapters written

  1. V.1 Data summaries: mean, median, mode available
  2. V.2 Spread: variance, standard deviation, robust interpretation available
  3. V.3 Population, sample, and sampling variability available
  4. V.4 Estimators and estimation available
  5. V.5 Confidence intervals through repeated sampling available
  6. V.6 Covariance matrices and multivariate spread available
  7. V.7 Regression fundamentals available
  8. V.8 Likelihood available
  9. V.9 Maximum Likelihood Estimation available
  10. V.10 Maximum A Posteriori estimation available

Part VI

Optimization

Learning as repeated parameter updates governed by an objective.

10 of 10 chapters written

  1. VI.1 Objective functions and optimization landscapes available
  2. VI.2 Local vs global optima and stationary points available
  3. VI.3 Convexity available
  4. VI.4 Gradient descent flagship chapter available
  5. VI.5 Learning rate and convergence behavior available
  6. VI.6 Momentum available
  7. VI.7 Stochastic and mini-batch gradient descent available
  8. VI.8 Adam intuition available
  9. VI.9 Constraints and projected/penalized intuition available
  10. VI.10 Numerical stopping and optimization diagnostics available

Part VII

Information Theory

Logarithms, entropy, and the loss behind token prediction.

8 of 8 chapters written

  1. VII.1 Logarithms and log probabilities in computation available
  2. VII.2 Self-information available
  3. VII.3 Entropy available
  4. VII.4 Cross entropy and negative log-likelihood available
  5. VII.5 KL divergence available
  6. VII.6 Logits and softmax available
  7. VII.7 Numerical stability: log-sum-exp and stable softmax available
  8. VII.8 From token logits to language-model loss available

Part VIII

Numerical Computing

Why equivalent expressions behave differently on real machines.

10 of 10 chapters written

  1. VIII.1 Floating-point representation available
  2. VIII.2 Rounding and representation error available
  3. VIII.3 Error propagation and conditioning available
  4. VIII.4 Catastrophic cancellation available
  5. VIII.5 Overflow and underflow available
  6. VIII.6 Stable algorithms available
  7. VIII.7 Numerical linear algebra realities available
  8. VIII.8 Sparse matrices and sparse structure available
  9. VIII.9 Vectorized computation available
  10. VIII.10 Reproducibility, random seeds, and nondeterminism available