Force balance: No feasible move lowers f because the outward boundary normal \nabla g(\mathbf{x}^\star) pushes back with multiplier \lambda^\star = 4.
Equality Constraints and Tangency of Level Sets
Lagrange Multipliers
Consider minimizing a differentiable objective f(\mathbf{x}) on an equality surface h(\mathbf{x}) = 0 (such as the unit circle h(\mathbf{x}) = \tfrac12(\|\mathbf{x}\|^2 - 1) = 0):
Crossing level sets cannot be optimal: If a level set of f crosses \{h = 0\}, then \nabla f has a nonzero component tangent to the surface, providing a feasible descent direction.
Tangency condition: At any local extremum \mathbf{x}^\star where \nabla h(\mathbf{x}^\star) \neq \mathbf{0}, the level set of f is tangent to \{h = 0\}, so their normal vectors are parallel: \nabla f(\mathbf{x}^\star) + \nu^\star\,\nabla h(\mathbf{x}^\star) = \mathbf{0}
The Lagrangian and Stationarity on the Circle
Lagrange Multipliers
We package both requirements, parallel normals and feasibility h(\mathbf{x}) = 0, into a single function of (\mathbf{x}, \nu), the Lagrangian:
\nu^\star = +4:\mathbf{x}^\star = (0.6, 0.8) at distance 4 from \mathbf{y}(f = 8, the global minimum).
\nu = -6:\mathbf{x} = (-0.6, -0.8) at distance 6 from \mathbf{y}(f = 18, the global maximum).
Why \nabla h(\mathbf{x}^\star) \neq \mathbf{0} matters: On \min x_1 subject to h(x_1, x_2) = x_1^2 + x_2^2 = 0, the unique feasible point \mathbf{0} has \nabla f(\mathbf{0}) = (1, 0) but \nabla h(\mathbf{0}) = \mathbf{0}, so no multiplier \nu exists.
Closest Point on a Hyperplane and Shadow Prices
Lagrange Multipliers
Minimizing f(\mathbf{x}) = \tfrac12\|\mathbf{x}\|_2^2 on the hyperplane h(\mathbf{x}) = \mathbf{a}^\top\mathbf{x} - b = 0 gives \mathbf{x} = -\nu\mathbf{a} and:
Shadow price: Differentiating p^\star(b) with respect to threshold b reveals \frac{\partial p^\star(b)}{\partial b} = -\nu^\star.
Inequality Constraints: Active vs. Inactive Walls
Inequality Constraints
Minimizing \tfrac12\|\mathbf{x} - \mathbf{y}\|_2^2 over the solid ball g(\mathbf{x}) = \tfrac12(\|\mathbf{x}\|_2^2 - r^2) \le 0 splits into two regimes:
Inactive (g(\mathbf{x}^\star) < 0,\|\mathbf{y}\| < r):\mathbf{x}^\star = \mathbf{y} lies inside the ball and \lambda^\star = 0.
Active (g(\mathbf{x}^\star) = 0,\|\mathbf{y}\| \ge r):\mathbf{x}^\star = r\mathbf{y}/\|\mathbf{y}\| sits on the boundary sphere with \lambda^\star \ge 0.
Verifying Force Balance in Gradient Clipping
Inequality Constraints
For \mathbf{y} = (3, 4) and radius r = 1, the active constraint formula yields \lambda^\star = 5/1 - 1 = 4 and \mathbf{x}^\star = (0.6, 0.8):
x* = [0.6 0.8] lambda* = 4.0 f(x*) = 8.0
grad f(x*) = [-2.4 -3.2] lambda* grad g(x*) = [2.4 3.2] sum = [0. 0.]
Why inequality multipliers must be nonnegative (\lambda^\star \ge 0): Since \nabla g(\mathbf{x}^\star) points outward from the feasible set \{g \le 0\}, stationarity -\nabla f(\mathbf{x}^\star) = \lambda^\star \nabla g(\mathbf{x}^\star) with \lambda^\star \ge 0 ensures that the downhill direction -\nabla f pulls outward into the wall. If \lambda^\star < 0, -\nabla f would point inward, so stepping into the interior would lower f.
The Four Karush–Kuhn–Tucker (KKT) Conditions
KKT Conditions
For \min_{\mathbf{x}} f(\mathbf{x}) subject to g_i(\mathbf{x}) \le 0 and h_j(\mathbf{x}) = 0, form \mathcal{L}(\mathbf{x}, \boldsymbol{\lambda}, \boldsymbol{\nu}) = f(\mathbf{x}) + \sum_i \lambda_i g_i(\mathbf{x}) + \sum_j \nu_j h_j(\mathbf{x}):
Complementary slackness:\lambda_i^\star g_i(\mathbf{x}^\star) = 0 for every i (inactive walls exert zero force).
Normal Cone Geometry of Active Constraints
KKT Conditions
By complementary slackness, inactive constraints (g_i(\mathbf{x}^\star) < 0) have \lambda_i^\star = 0 and drop out of the stationarity sum. Let \mathcal{A}(\mathbf{x}^\star) = \{i : g_i(\mathbf{x}^\star) = 0\} denote the active set, with \lambda_i^\star \ge 0:
The normal cone: At an optimum, the steepest descent direction -\nabla f(\mathbf{x}^\star) must lie inside the convex cone spanned by the outward normals \nabla g_i(\mathbf{x}^\star) of the active walls.
Nonconvex caveat: On \min_{x \in [-1, 1]} -x^2, the interior point x = 0 satisfies all four KKT conditions with \lambda_1 = \lambda_2 = 0, yet x = 0 is the global maximum.
Constraint Qualifications: LICQ and Slater’s Rule
KKT Necessity & Sufficiency
Two regularity conditions guarantee that every local minimum is a KKT point (preventing degenerate boundary cusps where constraint gradients collapse):
1. Linear Independence Constraint Qualification (LICQ — general smooth problems): The gradients of all active inequalities and all equalities at \mathbf{x}^\star, \big\{\nabla g_i(\mathbf{x}^\star) : i \in \mathcal{A}(\mathbf{x}^\star)\big\} \cup \big\{\nabla h_j(\mathbf{x}^\star) : j = 1, \ldots, p\big\}, are linearly independent.
2. Slater’s Condition (convex problems — f, g_i convex, h_j affine): There exists a single strictly feasible point \bar{\mathbf{x}} satisfying: g_i(\bar{\mathbf{x}}) < 0 \;\text{ (for all non-affine } g_i\text{)}, \qquad g_i(\bar{\mathbf{x}}) \le 0 \;\text{ (for affine } g_i\text{)}, \qquad h_j(\bar{\mathbf{x}}) = 0 \;\forall\,j Checking Slater’s condition requires finding just one interior point (e.g., \bar{\mathbf{x}} = \mathbf{0} for any norm ball of radius r > 0), without knowing \mathbf{x}^\star in advance.
Proving KKT Sufficiency Under Convexity
KKT Necessity & Sufficiency
For convex problems (f and g_i convex and differentiable, h_j affine), the KKT conditions are always sufficient for global optimality—requiring no constraint qualification at all:
Proposition: If (\mathbf{x}^\star, \boldsymbol{\lambda}^\star, \boldsymbol{\nu}^\star) satisfies the KKT conditions on a convex problem, then f(\mathbf{x}^\star) \le f(\mathbf{x}) for every feasible \mathbf{x}.
Three-line proof:
Fix the KKT multipliers and consider \varphi(\mathbf{x}) = \mathcal{L}(\mathbf{x}, \boldsymbol{\lambda}^\star, \boldsymbol{\nu}^\star) = f(\mathbf{x}) + \sum_i \lambda_i^\star g_i(\mathbf{x}) + \sum_j \nu_j^\star h_j(\mathbf{x}). Because \lambda_i^\star \ge 0, \varphi(\mathbf{x}) is a nonnegative weighted sum of convex functions plus affine functions, so \varphi is convex on \mathbb{R}^n.
By KKT stationarity, \nabla\varphi(\mathbf{x}^\star) = \mathbf{0}, so \mathbf{x}^\star is an unconstrained global minimizer of \varphi: \varphi(\mathbf{x}) \ge \varphi(\mathbf{x}^\star) for all \mathbf{x} \in \mathbb{R}^n.
For any nonempty closed convex set C \subseteq \mathbb{R}^n, the Euclidean projection\Pi_C(\mathbf{y}) maps \mathbf{y} \in \mathbb{R}^n to the unique closest point in C:
Existence and uniqueness: Intersecting C with a closed ball around \mathbf{y} creates a compact set (guaranteeing existence by continuity), and 1-strong convexity of \tfrac12\|\mathbf{x} - \mathbf{y}\|^2 guarantees uniqueness.
Half-space \{ \mathbf{a}^\top\mathbf{x} \ge b \}:\Pi_C(\mathbf{y}) = \mathbf{y} + \frac{\max(0,\, b - \mathbf{a}^\top\mathbf{y})}{\|\mathbf{a}\|_2^2}\,\mathbf{a}.
The Obtuse-Angle Variational Inequality
Projections
A point \hat{\mathbf{x}} \in C is the projection \Pi_C(\mathbf{y}) if and only if the residual vector \mathbf{y} - \hat{\mathbf{x}} forms an obtuse (or right) angle \ge 90^\circ with every feasible chord \mathbf{x} - \hat{\mathbf{x}} into C(\forall\,\mathbf{x} \in C):
Fixed-point certificate:\mathbf{x}^\star = \Pi_C(\mathbf{x}^\star - \eta\nabla f(\mathbf{x}^\star)) iff \nabla f(\mathbf{x}^\star)^\top(\mathbf{x} - \mathbf{x}^\star) \ge 0 for all \mathbf{x} \in C (no feasible descent direction; global optimum when f is convex).
Why PGD Contracts as Fast as Unconstrained GD
Projected Gradient Descent
Does adding a projection step after every gradient update slow down convergence? On a \mu-strongly convex, L-smooth function (\mu\mathbf{I} \preceq \nabla^2 f(\mathbf{x}) \preceq L\mathbf{I}), nonexpansiveness guarantees the exact same worst-case contraction factor \rho = \max(|1 - \eta\mu|, |1 - \eta L|) as unconstrained gradient descent:
Step 1: Write \mathbf{x}^\star as a fixed point:\mathbf{x}^\star = \Pi_C\big(\mathbf{x}^\star - \eta\nabla f(\mathbf{x}^\star)\big).
Step 3: Apply the fundamental theorem of calculus: With \bar{\mathbf{H}} = \int_0^1 \nabla^2 f(\mathbf{x}^\star + t(\mathbf{x}_k - \mathbf{x}^\star))\,dt(\mu\mathbf{I} \preceq \bar{\mathbf{H}} \preceq L\mathbf{I}),\|\mathbf{x}_{k+1} - \mathbf{x}^\star\| = \big\|(\mathbf{I} - \eta\bar{\mathbf{H}})(\mathbf{x}_k - \mathbf{x}^\star)\big\| \le \max\big(|1 - \eta\mu|,\, |1 - \eta L|\big)\,\|\mathbf{x}_k - \mathbf{x}^\star\|
Two-Phase PGD Dynamics on the κ = 1000 Valley
Projected Gradient Descent
Minimize f(\mathbf{x}) = \tfrac12(x_1^2 + 1000\,x_2^2) over the half-space x_1 + x_2 \ge 1(\mathbf{x}^\star = (\frac{1000}{1001}, \frac{1}{1001}),\lambda^\star = \frac{1000}{1001}) using PGD with \eta = 1.5 \times 10^{-3} from (3, 4):
bound rho = 0.9985 largest ratio in a step = 0.9977
steps to |x - x*| < 1e-6: 738 every step projected from step 733 on
ratio per step on the line: 0.2492 1 - 500.5 eta = 0.2492
grad f at the end = [0.999001 0.999001]
Why 738 steps instead of 10{,}200? For the first 732 steps, the iterate drifts through the interior at the slow rate 1 - \eta = 0.9985. Once it hits the boundary line x_1 + x_2 = 1 at step 733, the restricted quadratic along the line has curvature 500.5, contracting at 1 - 500.5\eta = 0.249 per step.
Projecting onto the Probability Simplex (Sparsemax)
Simplex Projection
To project a score vector \mathbf{y} \in \mathbb{R}^n onto the probability simplex \Delta = \{\mathbf{x} \succeq \mathbf{0} : \mathbf{1}^\top\mathbf{x} = 1\}, solve \min_{\mathbf{x} \in \Delta}\tfrac12\|\mathbf{x} - \mathbf{y}\|^2:
KKT stationarity & slackness: With multiplier \tau on \sum_i x_i = 1 and \lambda_i \ge 0 on -x_i \le 0, stationarity x_i - y_i + \tau - \lambda_i = 0 and \lambda_i x_i = 0 collapse to x_i^\star = \max(y_i - \tau,\, 0), where \tau is uniquely determined by the unit-sum budget: \sum_{i=1}^n \max(y_i - \tau,\, 0) = 1
Exact O(n\log n) sort-and-threshold: Sort u_1 \ge \cdots \ge u_n, form \tau_k = \frac{1}{k}\big(\sum_{j=1}^k u_j - 1\big), and pick the largest k with u_k > \tau_k.
Certifying Simplex Projections via Vertex Tests
Simplex Projection
Because x_i(\tau) = \max(y_i - \tau, 0) and \lambda_i(\tau) = \max(0, \tau - y_i) satisfy stationarity, dual feasibility, and complementary slackness for every scalar \tau, checking those three KKT residuals alone can be fooled by an incorrect \tau:
x* = [0.666 0.334 0. 0. 0. 0. ] zeros: 4 tau = 1.662
tau = 1.662: stationarity 0e+00, comp. slack 0e+00, dual feas. True, sum x = 1.000
tau = 1.962: stationarity 0e+00, comp. slack 0e+00, dual feas. True, sum x = 0.400
certificate max_i (y - x*)^T(e_i - x*) = -3e-16 (<= 0 up to rounding: True)
Only the unit-sum budget \sum_i x_i = 1 and the obtuse-angle certificate tested at the n simplex vertices \mathbf{e}_i, \max_{1 \le i \le n}(\mathbf{y} - \mathbf{x}^\star)^\top(\mathbf{e}_i - \mathbf{x}^\star) \le 0, certify that \mathbf{x}^\star = \Pi_\Delta(\mathbf{y}).
Why Subgradient Descent Fails to Produce Sparsity
Proximal Operators
The lasso minimizes F(\mathbf{w}) = \tfrac12\|\mathbf{A}\mathbf{w} - \mathbf{b}\|_2^2 + \lambda\|\mathbf{w}\|_1(\mathbf{A} \in \mathbb{R}^{100 \times 8},5 planted zero weights, \lambda = 3). What happens if we run subgradient descent \mathbf{w}_{k+1} = \mathbf{w}_k - \eta\big(\mathbf{A}^\top(\mathbf{A}\mathbf{w}_k - \mathbf{b}) + \lambda\,\mathrm{sign}(\mathbf{w}_k)\big) at \eta = 1/L?
exact zeros: 0 of 8; sign flips of the null coordinates, last 20 steps: 95 of 95
largest null coordinate: 0.033; eta * lam = 0.021
Why subgradient steps chatter across zero: At a planted zero coordinate, the smooth gradient has magnitude < \lambda, so the subgradient kick \pm\eta\lambda overpowers it and flips the coordinate’s sign on nearly every step, leaving 0 exact zeros.
Soft-Thresholding and the Proximal Operator
Proximal Operators
The proximal operator minimizes a nonsmooth convex penalty \psi(\mathbf{x}) against a quadratic tether to \mathbf{z}:
1D soft-thresholding (\psi(x) = \lambda|x|): By Fermat’s rule 0 \in \lambda\partial|x| + (x - z), \mathrm{prox}_{\lambda|\cdot|}(z) = \mathrm{sign}(z)\max(|z| - \lambda, 0), with an exact zero dead zone for |z| \le \lambda.
For composite objectives F(\mathbf{w}) = s(\mathbf{w}) + \psi(\mathbf{w}) where s is convex and L-smooth and \psi is proper closed convex, proximal gradient descent minimizes the L-smoothness quadratic upper bound of s plus the exact penalty \psi:
exact zeros: 5 of 8; support recovered: True; max deviation on the support: 0.029
When \psi(\mathbf{w}) = \lambda\|\mathbf{w}\|_1, this update is ISTA (Iterative Shrinkage-Thresholding Algorithm): its dead zone [-\eta\lambda, \eta\lambda] absorbs the exact chattering amplitude of subgradient descent, recovering all 5 planted zeros cleanly.
Cyclic Coordinate Descent on the Lasso
Coordinate Descent
Because \|\mathbf{w}\|_1 = \sum_{j=1}^d |w_j| separates across coordinates, minimizing the lasso along a single weight w_j (with partial residual \mathbf{r}_{-j} = \mathbf{b} - \sum_{i \neq j}\mathbf{a}_i w_i and correlation c_j = \mathbf{a}_j^\top\mathbf{r}_{-j}) has an exact closed form:
Why coordinate sweeps beat ISTA: Each coordinate step uses its own single-column curvature L_j = \|\mathbf{a}_j\|_2^2 \approx 100 rather than the global eigenvalue ceiling L = \lambda_{\max}(\mathbf{A}^\top\mathbf{A}) \approx 160, reaching 10^{-8} in 4–6 passes vs. \sim 20 for ISTA.
passes to gap < 1e-8: ISTA 12, coordinate descent 5
Concept Check: KKT, Simplex Projection, and Prox
Concept Check
Work out these three calculations using the KKT and proximal rules:
We project \mathbf{y}_1 = (1.5, 2.0) and \mathbf{y}_2 = (0.3, 0.4) onto the unit disk g(\mathbf{x}) = \tfrac12(\|\mathbf{x}\|_2^2 - 1) \le 0. What are the optimal point \mathbf{x}^\star and KKT multiplier \lambda^\star for each?
Project the score vector \mathbf{y} = (0.9, 0.5, -0.2) onto the probability simplex \Delta: which coordinates survive (k), what is the threshold \tau, and what is \Pi_\Delta(\mathbf{y})?
Evaluate the soft-thresholding operator \mathrm{prox}_{\lambda|\cdot|}(z) with \lambda = 0.7 at z = 0.5 and at z = -2.0.
Answers:(1)\|\mathbf{y}_1\|_2 = 2.5 > 1 (active): \lambda^\star = 2.5 - 1 = \mathbf{1.5} and \mathbf{x}^\star = \mathbf{y}_1 / 2.5 = \mathbf{(0.6, 0.8)}. \|\mathbf{y}_2\|_2 = 0.5 < 1 (inactive): \lambda^\star = \mathbf{0} and \mathbf{x}^\star = \mathbf{(0.3, 0.4)}. (2) Candidate thresholds \tau_k = (\sum_{j \le k} y_j - 1)/k: \tau_1 = -0.1 < 0.9 (valid), \tau_2 = (1.4 - 1)/2 = 0.2 < 0.5 (valid), \tau_3 = 0.2/3 \approx 0.067 \not< -0.2 (invalid). Thus k = 2, \tau = \mathbf{0.2}, and \Pi_\Delta(\mathbf{y}) = \mathbf{(0.7, 0.3, 0.0)}. (3) At z = 0.5, |0.5| \le 0.7 falls inside the dead zone so \mathrm{prox}_{0.7|\cdot|}(0.5) = \mathbf{0}. At z = -2.0, \mathrm{prox}_{0.7|\cdot|}(-2.0) = -(2.0 - 0.7) = \mathbf{-1.3}.