Gradient descent with \eta = 1/L reliably reaches a point where \nabla f(\mathbf{x}) \approx \mathbf{0}, and Newton’s method gets there even faster. Yet local stationarity alone cannot tell us whether a far deeper valley exists elsewhere:
Experiment (500 random starts on [-1.5, 1.5]): Run identical gradient descent (600 steps, \eta = 0.05) on two 1D functions:
Quadratic bowlf(x) = (x - \tfrac12)^2: Every single run converges to the unique global minimum x^\star = 0.5.
Tilted double well\phi(x) = (x^2 - 1)^2 + \tfrac12 x: Roughly 46\% of runs get trapped at x \approx 0.93(\phi \approx 0.48), nearly a full unit worse than the global minimum at x \approx -1.06(\phi \approx -0.52).
The geometric divide: Every chord drawn between two points on the bowl lies above its graph, whereas chords across the double well’s central hump slice below the curve.
What convexity buys: On a convex function, every tangent hyperplane under-estimates the objective globally—turning \nabla f(\mathbf{x}^\star) = \mathbf{0} into an ironclad certificate of global optimality.
Convex Sets: Segments Stay Inside the Set
Convex Sets
A set C \subseteq \mathbb{R}^d is convex if the line segment joining any two points \mathbf{x}, \mathbf{y} \in C remains entirely inside C for all \theta \in [0, 1]:
\theta\mathbf{x} + (1 - \theta)\mathbf{y} \in C
Nonconvex counterexample: The annulus \{1 \le \|\mathbf{x}\|_2 \le 2\} contains (\pm\tfrac32, 0), but their midpoint \mathbf{0} falls in the central hole.
Norm balls:\{\mathbf{x} : \|\mathbf{x}\| \le r\} for any norm (by triangle inequality and homogeneity).
Probability simplex:\Delta = \{\mathbf{p} \succeq \mathbf{0} : \mathbf{1}^\top\mathbf{p} = 1\}.
Intersections and Convex Hulls Build New Sets
Convex Sets
Arbitrary intersections preserve convexity: If every C_i is convex, then \bigcap_{i \in \mathcal{I}} C_i is convex (e.g., the simplex \Delta and the PSD cone \mathbb{S}_+^d).
Convex hull (from the inside out): The smallest convex set containing S is the set of all convex combinations: \mathrm{conv}(S) = \left\{\sum_{i=1}^m \theta_i \mathbf{x}_i : \mathbf{x}_i \in S,\; \theta_i \ge 0,\; \sum_{i=1}^m \theta_i = 1\right\}
The Zero-Order Test: Chords Lie Above the Graph
Convex Functions
A function f : C \to \mathbb{R} on a convex set C is convex if every chord lies on or above its graph (\theta \in [0, 1]):
Epigraphs:f is convex iff \mathrm{epi}(f) = \{(\mathbf{x}, t) : t \ge f(\mathbf{x})\} is a convex set.
Sublevel sets: Every sublevel set \{\mathbf{x} : f(\mathbf{x}) \le c\} of a convex function is convex (though the converse fails for \sqrt{|x|}).
Every Local Minimum of a Convex Function Is Global
Global Optimality
The zero-order chord inequality immediately rules out spurious local minima:
Theorem: If f is convex on a convex set C, every local minimizer \mathbf{x}^\star of f on C is a global minimizer.
Three-line proof: For any \mathbf{y} \in C and small \theta > 0, the point \mathbf{z}_\theta = (1 - \theta)\mathbf{x}^\star + \theta\mathbf{y} lies inside the local neighborhood where \mathbf{x}^\star is minimal: f(\mathbf{x}^\star) \le f(\mathbf{z}_\theta) \le (1 - \theta)f(\mathbf{x}^\star) + \theta f(\mathbf{y})
Subtracting (1-\theta)f(\mathbf{x}^\star) and dividing by \theta > 0 gives f(\mathbf{x}^\star) \le f(\mathbf{y}) for all \mathbf{y} \in C.
Competing Basins on the Tilted Double Well
Global Optimality
Running 600 steps of gradient descent (\eta = 0.05) from 500 uniform random initializations on [-1.5, 1.5] contrasts the single basin of (x - \tfrac12)^2 against the two basins of \phi(x) = (x^2 - 1)^2 + \tfrac12 x:
bowl: all 500 runs end at x = 0.500000 (spread 7e-16)
well, left : 263 runs, x = -1.0575, phi = -0.5148
well, right: 237 runs, x = 0.9304, phi = 0.4833
local max at 0.1271: predicted share right 0.458, observed 0.474
The local maximum separating the two basins of \phi is the middle root of \phi'(x) = 4x^3 - 4x + \tfrac12 = 0 at x_{\max} \approx 0.127, so a fraction (1.5 - 0.127)/3 \approx 45.8\% of starts land in the suboptimal right well.
The First-Order Test: Tangents Under-Estimate f
Convex Functions
When f is differentiable on a convex set C, convexity is equivalent to requiring the tangent hyperplane at any point \mathbf{x} \in C to be a global under-estimator of f for all \mathbf{y} \in C:
Why this powers optimization proofs: A single gradient evaluated at \mathbf{x} bounds f(\mathbf{y}) from below across the entire domain.
Immediate optimality certificate: If \nabla f(\mathbf{x}^\star) = \mathbf{0}, then f(\mathbf{y}) \ge f(\mathbf{x}^\star) + \mathbf{0}^\top(\mathbf{y} - \mathbf{x}^\star) = f(\mathbf{x}^\star) for every \mathbf{y} \in C.
The Second-Order Test: Positive Semidefinite Hessian
Convex Functions
When f is twice differentiable on an open convex set C, f is convex if and only if its Hessian matrix is positive semidefinite everywhere:
Geometric interpretation: Every 1D slice g(t) = f(\mathbf{x} + t\mathbf{v}) has nonnegative second derivative g''(0) = \mathbf{v}^\top \nabla^2 f(\mathbf{x})\mathbf{v} \ge 0, so the surface bends upward along every direction.
Workhorse examples certified in one line:
Quadratics:f(\mathbf{x}) = \tfrac12\mathbf{x}^\top\mathbf{A}\mathbf{x} + \mathbf{b}^\top\mathbf{x} has \nabla^2 f(\mathbf{x}) = \mathbf{A}, so it is convex \iff \mathbf{A} \succeq \mathbf{0}.
Linear least squares:f(\mathbf{w}) = \tfrac12\|\mathbf{X}\mathbf{w} - \mathbf{y}\|^2 has \nabla^2 f(\mathbf{w}) = \mathbf{X}^\top\mathbf{X}, and \mathbf{v}^\top\mathbf{X}^\top\mathbf{X}\mathbf{v} = \|\mathbf{X}\mathbf{v}\|^2 \ge 0 for all \mathbf{v}.
Scalar atoms:e^x(f'' = e^x > 0),-\log x on x > 0(f'' = 1/x^2 > 0), and x\log x on x > 0(f'' = 1/x > 0).
How the Three Characterizations Prove Each Other
Equivalence Proof
All three tests define the exact same class of smooth functions:
0th \Rightarrow 1st-Order: Divide the chord inequality at \mathbf{x} + \theta(\mathbf{y} - \mathbf{x}) by \theta and let \theta \downarrow 0.
1st \Rightarrow 0th-Order: Apply the tangent bound at \mathbf{z} = \theta\mathbf{x} + (1-\theta)\mathbf{y} toward \mathbf{x} and \mathbf{y}, then take their weighted sum.
1st \iff 2nd-Order: By 1D Taylor expansion along \mathbf{x} + t(\mathbf{y}-\mathbf{x}), the gap above the tangent is \tfrac12(\mathbf{y}-\mathbf{x})^\top\nabla^2 f(\mathbf{z}_\tau)(\mathbf{y}-\mathbf{x}) \ge 0.
Testing Chords, Tangents, and Hessians in Code
Empirical Verification
Sampling 1{,}000 random point pairs on [-1.5, 1.5]^d tests all three conditions on least squares \tfrac12\|\mathbf{X}\mathbf{w} - \mathbf{y}\|^2 versus the double well \phi(x):
worst chord gap worst tangent gap smallest Hessian eig
least squares -0.000 -0.003 24.375
double well 0.972 2.997 -4.000
worst chord of the double well: from -0.96 to 1.10
Asymmetry of numerical testing: A single positive chord or tangent gap is a complete counterexample that refutes convexity for the double well (\phi''(0) = -4 < 0), whereas proving convexity for least squares requires the analytical proof \mathbf{X}^\top\mathbf{X} \succeq \mathbf{0}.
Strict vs. Strong Convexity and the Quadratic Floor
Strong Convexity
Plain and even strict convexity allow arbitrarily flat regions where gradient descent crawls (such as f(x) = x^4 near x = 0, where f''(0) = 0). \mu-strong convexity(\mu > 0) requires f(\mathbf{x}) - \tfrac{\mu}{2}\|\mathbf{x}\|^2 to be convex:
Matrix characterization: For twice-differentiable f, \mu-strong convexity holds if and only if \nabla^2 f(\mathbf{x}) \succeq \mu\mathbf{I} everywhere (every Hessian eigenvalue is at least \mu).
Existence and uniqueness: Every continuous \mu-strongly convex function on a closed convex set has bounded sublevel sets and therefore possesses a unique global minimizer \mathbf{x}^\star.
Why weight decay helps optimization: Adding \tfrac{\lambda}{2}\|\mathbf{w}\|^2 to any convex loss immediately makes the objective \lambda-strongly convex.
The Curvature Sandwich and Condition Number
Strong Convexity
Combining \mu-strong convexity with L-smoothness (\mu\mathbf{I} \preceq \nabla^2 f(\mathbf{x}) \preceq L\mathbf{I}) sandwiches f(\mathbf{y}) between two tangent parabolas at every point \mathbf{x}:
General condition number:\kappa = L/\mu \ge 1(\mu = 1, L = 4 \implies \kappa = 4 for \tfrac12 x^2 + 3\log\cosh x at right).
Subgradients: Supporting Hyperplanes at Corners
Nonsmooth Convexity
Nonsmooth convex losses like \|\mathbf{x}\|_1 and the hinge loss \max(0, 1 - z) have kinks where no gradient exists. A vector \mathbf{g} \in \mathbb{R}^d is a subgradient of f at \mathbf{x} if it defines a global supporting hyperplane for all \mathbf{y}:
Three-line proof: Pick a subgradient \mathbf{g} \in \partial f(\mathbf{m}) so f(\mathbf{Z}) \ge f(\mathbf{m}) + \mathbf{g}^\top(\mathbf{Z} - \mathbf{m}); taking expectations kills the linear term \mathbf{g}^\top\mathbb{E}[\mathbf{Z} - \mathbf{m}] = 0.
Strict equality certificate: For strictly convex f, equality holds iff \mathbf{Z} = \mathbf{m} almost surely.
Jensen’s Inequality Proves KL Divergence ≥ 0
Information Theory
Jensen’s inequality is the workhorse behind fundamental inequalities across probability, statistics, and variational inference:
Nonnegativity of KL divergence (Gibbs’ inequality): For distributions p, q with R = q(Z)/p(Z) where Z \sim p, apply Jensen’s inequality to the strictly convex function -\log: D_{\mathrm{KL}}(p \,\|\, q) = \mathbb{E}_p\big[-\log R\big] \ge -\log\big(\mathbb{E}_p[R]\big) = -\log\sum_x p(x)\frac{q(x)}{p(x)} = -\log 1 = 0 Strict convexity of -\log guarantees D_{\mathrm{KL}}(p \,\|\, q) = 0 \iff R = 1 almost surely \iff p = q.
AM–GM inequality: Applying Jensen to concave \log gives \frac{1}{N}\sum_{i=1}^N x_i \ge \big(\prod_{i=1}^N x_i\big)^{1/N} for x_i > 0.
Drawing 10^6 standard normal samples Z \sim \mathcal{N}(0, 1) confirms the fixed structural Jensen gap for f(x) = e^x, while blending q into p shows quadratic O(\varepsilon^2) convergence of KL divergence:
E[exp(Z)] = 1.65 vs exp(E[Z]) = 1.00 (population: 1.6487 vs 1)
median KL(p || (1-eps) p + eps q), eps = 1e-2, 1e-3, 1e-4: 1.6e-04 1.6e-06 1.6e-08
For Z \sim \mathcal{N}(0, 1), \mathbb{E}[e^Z] = e^{1/2} \approx 1.6487 > 1 = e^{\mathbb{E}[Z]}.
Each 10\times reduction in \varepsilon cuts D_{\mathrm{KL}}(p \,\|\, (1-\varepsilon)p + \varepsilon q) \approx \frac{\varepsilon^2}{2}\sum_x \frac{(q(x)-p(x))^2}{p(x)} by 100\times.
Why Plain Convexity Can Still Crawl: x² vs. x⁴
Convergence Rates
Both f(x) = x^2 and f(x) = x^4 are smooth and strictly convex with unique global minimizer x^\star = 0, yet only x^2 is strongly convex. Running gradient descent (\eta = 1/8,x_0 = 1) reveals a vast speed gap:
x^2: first k with x_k < 1e-6: 49
x^4: x_k * sqrt(k) at k = 1e2, 1e3, 1e4: [0.973 0.996 1. ]
On x^2(\mu = 2),x_k = (0.75)^k drops below 10^{-6} in 49 steps; on x^4(f''(0) = 0), the contraction factor 1 - 4\eta x_k^2 \to 1 and x_k \sim 1/\sqrt{k}(f(x_k) \sim 1/k^2).
Proving the O(1/k) Rate for Smooth Convex Descent
Convergence Proof
For any convex, L-smooth function f with minimizer \mathbf{x}^\star, gradient descent with \eta = 1/L satisfies:
Measuring the True Contraction Factor on Quadratics
Empirical Verification
Testing gradient descent with \eta = 1/L on a least-squares problem with eigenvalues \mu = 1 and L = 10(\kappa = 10) shows that the actual loss gap contracts by (1 - \mu/L)^2 = 0.81 rather than 1 - \mu/L = 0.90:
mu = 1.0000, L = 10.0000: bound 1 - mu/L = 0.9000, its square 0.8100
first three ratios: [0.6084 0.81 0.81 ] largest ratio: 0.81
Why the factor is squared: At \eta = 1/L, the first step multiplies the stiff eigenvector error by 1 - L/L = 0; the remaining slow distance shrinks by 1 - \mu/L = 0.9 per step, so the quadratic loss gap shrinks by (1 - \mu/L)^2 = 0.81.
Pointwise maximum:\max_i f_i(\mathbf{x}) is convex because \mathrm{epi}(\max_i f_i) = \bigcap_i \mathrm{epi}(f_i) (certifies hinge loss and \|\mathbf{w}\|_1).
Monotone composition:h(g(\mathbf{x})) is convex when g is convex and h is convex and nondecreasing (dropping monotonicity gives the nonconvex double well (x^2 - 1)^2).
Log-Sum-Exp and the Softmax Covariance Hessian
Convex Calculus
For multiclass cross-entropy, \mathrm{lse}(\mathbf{x}) = \log\sum_{i=1}^d e^{x_i} has gradient \nabla\mathrm{lse}(\mathbf{x}) = \mathbf{s} = \mathrm{softmax}(\mathbf{x}) and Hessian equal to the covariance of a one-hot class vector \mathbf{e}_Y drawn from Y \sim \mathbf{s}:
c largest eigenvalue median
0.1 0.2193 0.1843
1.0 0.4546 0.3071
3.0 0.4983 0.2995
10.0 0.5000 0.0165
30.0 0.5000 0.0000
Because v_Y is bounded, \lambda_{\max}(\nabla^2\mathrm{lse}(\mathbf{x})) \le \tfrac12 everywhere (\tfrac12-smooth), with zero curvature along \mathbf{1} (shift invariance) and near-zero curvature when predictions are confident.
Why Deep Neural Networks Are Nonconvex
Beyond Convexity
Even a two-weight scalar network f(a, b) = (ab - 1)^2 breaks convexity because composition with a non-affine inner layer violates our closure rules:
Nonconvex minimizer set: The global minimizers form the hyperbola \{ab = 1\}. The midpoint of (1, 1) and (-1, -1) is the origin (0, 0), which is a saddle point with f(0, 0) = 1 and Hessian eigenvalues \pm 2.
Permutation symmetry in deep nets: Permuting the m hidden units of a layer produces m! distinct parameter vectors with identical loss, whose midpoints collapse the hidden features and raise the loss.
The Polyak–Łojasiewicz Condition and Implicit Bias
Beyond Convexity
Look back at our strong-convexity proof: it used convexity only to establish the Polyak–Łojasiewicz (PL) inequality:
PL constant on [-5, 5]: mu = 0.1755
min f'' = -4.00 (f is not convex)
guaranteed 0.9835; largest ratio 0.9778 from x = 2.19; last ratio 0.2500
Nonconvex PL landscapes:f(x) = x^2 + 3\sin^2 x has f''(x) \in [-4, 8] (nonconvex), yet satisfies PL with \mu \approx 0.1755 and converges linearly. Wide overparameterized networks satisfy local PL conditions around manifolds of interpolating minimizers, where the optimizer’s implicit bias selects a specific solution (e.g., minimum \ell_2 norm or maximum margin).
Concept Check: Convexity, Rates, and Subgradients
Concept Check
Test your grasp of convexity tests, subgradients, and convergence rates:
Consider f(x) = x\log x on x > 0. Is f convex on (0, \infty)? Is it \mu-strongly convex on (0, 1]? Is it \mu-strongly convex on (0, \infty)?
What is the subdifferential \partial f(z) of the hinge loss f(z) = \max(0, 1 - z) at the kink z = 1?
On f(\mathbf{x}) = \tfrac12(x_1^2 + 1000\,x_2^2) with \eta = 1/L = 10^{-3}, how many steps are needed to shrink f(\mathbf{x}_k) - f^\star by 10^{-6} according to the general (1 - \mu/L)^k bound versus the exact quadratic (1 - \mu/L)^{2k} rate?
Answers:(1) Since f''(x) = 1/x > 0, f is strictly convex on (0, \infty). On (0, 1], f''(x) \ge 1, so it is 1-strongly convex. On (0, \infty), f''(x) = 1/x \to 0 as x \to \infty, so no positive \mu > 0 can lower-bound f''(x) globally. (2) Left derivative is f'_-(1) = -1 and right derivative is f'_+(1) = 0, so \partial f(1) = [-1, 0]. (3) General class bound (1 - 10^{-3})^k \le 10^{-6} gives k \approx 13{,}815 steps; the exact quadratic contraction (1 - 10^{-3})^{2k} halves that to \approx 6{,}908 steps (and optimal \eta^\star = 2/(\mu+L) halves it again to 3{,}454).
Summary: Convexity and Optimization Guarantees
Key Takeaways
Function Class
Defining Mathematical Condition
Minimizer Properties
GD Rate (\eta = 1/L)
Canonical Examples
Convex (L-Smooth)
f(\mathbf{y}) \ge f(\mathbf{x}) + \nabla f(\mathbf{x})^\top(\mathbf{y}-\mathbf{x})(\nabla^2 f \succeq \mathbf{0})