Minimizing convex functions over convex sets: why every local minimum is global, the KKT conditions that certify optimality, and the duality that turns a hard search into an easier one.
IntuitionWhy shape matters: convex versus non-convex
Imagine searching for the lowest point in a landscape by always stepping downhill. In a landscape shaped like a single bowl, this greedy strategy always finds the true lowest point, no matter where you start. In a landscape with several dips, ridges, and saddle-shaped passes, the same strategy can get stuck at a dip that is not the lowest point at all. Convex optimization studies exactly the "single bowl" case — and explains, precisely, why it is so much easier.
A 3D bowl-shaped surface (paraboloid) opening upward, with a single lowest point at the origin; the surface curves up in every direction from that point.
z=x2+y2: a paraboloid. Every direction curves upward, so there is exactly one lowest point.
A 3D saddle-shaped surface that curves upward along one horizontal axis and downward along the perpendicular axis, crossing at a flat point in the middle that is a critical point but not a minimum.
z=x2−y2: a saddle. The surface curves up along one axis and down along the other, so the flat point at the origin is neither a minimum nor a maximum.
A 1-D version of the same trap: a cubic curve can have a valley (local minimum) that is not the lowest point overall, because the curve keeps descending further out. Convexity is exactly the property that rules this out.
The cubic curve y = x cubed minus 3x, rising from bottom left, reaching a local maximum near x = -1, dipping to a local minimum near x = 1, then rising again; an inflection point is marked at the origin.
y=x3−3x. The marked points are a local maximum, a local minimum, and an inflection point — the local minimum is not the global minimum, since the curve goes to −∞ as x→−∞.
UndergraduateConvex sets and convex functions
Definition: Convex set
A set C⊆Rn is convex if for every x,y∈C and every θ∈[0,1], the point θx+(1−θ)y also lies in C: the whole segment between any two points of C stays inside C.
Definition: Convex function
A function f:C→R on a convex set C is convex if for every x,y∈C and θ∈[0,1], f(θx+(1−θ)y)≤θf(x)+(1−θ)f(y): the graph of f never lies above the segment joining any two of its points.
f(θx+(1−θ)y)≤θf(x)+(1−θ)f(y),θ∈[0,1]
When f is twice differentiable, this is equivalent to the Hessian∇2f(x) being positive semidefinite at every point of C — the multivariable analogue of f′′≥0. A convex optimization problem minimizes a convex f over a convex feasible set C (for example, C={x:gi(x)≤0,hj(x)=0} with each gi convex and each hj affine).
If f is convex on a convex set C and x⋆ is a local minimum of f on C, then x⋆ is a global minimum of f on C.
Why is it true?
Suppose x⋆ is only a local minimum and some y∈C has f(y)<f(x⋆). Convexity forces f to lie below the segment from x⋆ to y arbitrarily close to x⋆: for small θ>0, f(θy+(1−θ)x⋆)≤θf(y)+(1−θ)f(x⋆)<f(x⋆). That contradicts x⋆ being a local minimum, since points θy+(1−θ)x⋆ come arbitrarily close to x⋆.
Proof
Suppose x⋆∈C is a local minimum, so there exists a radius r>0 such that f(z)≥f(x⋆) for all z∈C satisfying ∥z−x⋆∥≤r. Assume for contradiction that there exists a point y∈C with f(y)<f(x⋆).
For any θ∈(0,1), convexity of the set and function ensures zθ=θy+(1−θ)x⋆∈C and f(zθ)≤θf(y)+(1−θ)f(x⋆)=f(x⋆)+θ(f(y)−f(x⋆))<f(x⋆).
Since ∥zθ−x⋆∥=θ∥y−x⋆∥, choosing 0<θ≤∥y−x⋆∥r guarantees ∥zθ−x⋆∥≤r while f(zθ)<f(x⋆), contradicting that the point is a local minimum.
UndergraduateConstrained problems and the KKT conditions
For an unconstrained differentiable convex f, x⋆ is a global minimum if and only if ∇f(x⋆)=0. When there are constraints — minimize f(x) subject to gi(x)≤0 (i=1,…,m) and hj(x)=0 (j=1,…,p) — we introduce the Lagrangian by attaching a nonnegative multiplier λi≥0 to each inequality and a free multiplier νj∈R to each equality:
For a differentiable convex problem satisfying a regularity condition (such as Slater's condition: there exists a point where all gi(x)<0 and hj(x)=0), a point x⋆ is optimal if and only if there exist multipliers λ⋆,ν⋆ such that: (1) stationarity∇xL(x⋆,λ⋆,ν⋆)=0; (2) primal feasibilitygi(x⋆)≤0, hj(x⋆)=0; (3) dual feasibilityλi⋆≥0; and (4) complementary slacknessλi⋆gi(x⋆)=0 for all i.
Why is it true?
Complementary slackness says that an inequality constraint gi(x)≤0 either is inactive at x⋆ (gi(x⋆)<0, so the boundary is not pushing on x⋆ and its multiplier λi⋆=0) or is active (gi(x⋆)=0, so the wall can push back with force λi⋆≥0). Stationarity then states that −∇f(x⋆) is balanced by a nonnegative combination of the outward normals ∇gi(x⋆) of the active walls.
Proof
First, suppose (x⋆,λ⋆,ν⋆) satisfies the KKT conditions. Because λi⋆≥0 and the constraint functions are convex or affine, the Lagrangian x↦L(x,λ⋆,ν⋆) is convex, so stationarity ∇xL(x⋆,λ⋆,ν⋆)=0 implies that the candidate point minimizes the Lagrangian over all vectors.
For any feasible x with gi(x)≤0 and hj(x)=0, complementary slackness λi⋆gi(x⋆)=0 gives the chain f(x⋆)=L(x⋆,λ⋆,ν⋆)≤L(x,λ⋆,ν⋆)=f(x)+∑i=1mλi⋆gi(x)+∑j=1pνj⋆hj(x)≤f(x), proving global optimality.
Conversely, under Slater's condition, strong duality provides dual optimal multipliers such that f(x⋆)=g(λ⋆,ν⋆)=infxL(x,λ⋆,ν⋆)≤L(x⋆,λ⋆,ν⋆)=f(x⋆)+∑i=1mλi⋆gi(x⋆)≤f(x⋆). Both inequalities in this chain must be equalities, which forces stationarity and complementary slackness for every constraint.
Example: Closest point on a line to the origin
Minimize f(x,y)=x2+y2 subject to x+y=1.
Solution
Both f (paraboloid) and the equality h(x,y)=x+y−1=0 (affine) define a convex problem. The Lagrangian is L(x,y,ν)=x2+y2+ν(x+y−1). Stationarity gives 2x+ν=0 and 2y+ν=0, so x=y. Substituting into x+y=1 gives x⋆=y⋆=21 with minimum value f(x⋆,y⋆)=21. Because the problem is convex, this KKT point is automatically the global minimum.
Example: Active inequality constraint via complementary slackness
Minimize f(x)=(x−3)2 subject to the inequality constraint g(x)=x−1≤0.
Solution
Form the Lagrangian L(x,λ)=(x−3)2+λ(x−1). Because the objective is strictly convex and the constraint is affine, the KKT conditions are necessary and sufficient: stationarity ∂x∂L=2(x−3)+λ=0, primal feasibility x−1≤0, dual feasibility λ≥0, and complementary slackness λ(x−1)=0.
Test the two cases from complementary slackness: if λ=0, stationarity gives x=3, which violates x−1≤0.
Therefore the constraint must be active, giving x⋆=1 and λ⋆=2(3−1)=4>0, which satisfies λ≥0. The unique global minimum is x⋆=1 with optimal value f(1)=4.
AdvancedDuality and global optimization beyond convexity
Minimizing L(x,λ,ν) over x (without constraints!) defines the Lagrange dual functiong(λ,ν)=infxL(x,λ,ν). Because g is the pointwise infimum of affine functions of (λ,ν), g is always concave, even if the original problem is not convex. For any λ≥0 and any feasible x, every term λigi(x)≤0 and νjhj(x)=0, so g(λ,ν)≤f(x). Maximizing g(λ,ν) over λ≥0 gives the dual problem, whose optimal value d⋆ always satisfies weak duality: d⋆≤p⋆ (the primal optimal value). When d⋆=p⋆, we say strong duality holds and the duality gap p⋆−d⋆ is zero.
If a primal linear program min{c⊤x:Ax=b,x≥0} has an optimal solution x⋆, then its dual max{b⊤y:A⊤y≤c} also has an optimal solution y⋆, and the optimal values are equal: c⊤x⋆=b⊤y⋆.
Why is it true?
Linear programs are convex problems with polyhedral feasible sets; for polyhedral constraints no interior-point assumption is needed, and the separating-hyperplane theorem (Farkas' lemma) guarantees a dual multiplier y⋆ with zero duality gap. For general convex programs, strong duality holds whenever Slater's condition is satisfied.
Proof
For any primal feasible vector satisfying Ax=b, x≥0 and any dual feasible vector satisfying A⊤y≤c, taking inner products gives weak duality: b⊤y=(Ax)⊤y=x⊤(A⊤y)≤x⊤c=c⊤x.
Form the Lagrangian L(x,y,s)=c⊤x+y⊤(b−Ax)−s⊤x=b⊤y+(c−A⊤y−s)⊤x with multiplier s≥0. Taking the infimum over unconstrained primal variables yields a finite dual value only when c−A⊤y−s=0, which recovers the dual constraint and dual objective g(y,s)=b⊤y.
If x⋆ is primal optimal with value p⋆=c⊤x⋆, Farkas' lemma (hyperplane separation for polyhedral cones) guarantees a vector y⋆ satisfying A⊤y⋆≤c and b⊤y⋆≥p⋆. Combining this with weak duality forces b⊤y⋆=c⊤x⋆.
Three families of algorithms for smooth convex optimization in Rn
Method family
Information per step
Cost per step
Accuracy ε in
Gradient / accelerated gradient (Nesterov)
First-order (∇f)
O(n)
O(1/ε) or O(1/ε)
Newton's method
Second-order (∇f,∇2f)
O(n3) (linear system)
O(loglog(1/ε)) locally
Interior-point (barrier)
Second-order on −∑ln(−gi)
O(n3) per Newton step
O(mlog(1/ε))
Which function is convex on all of R?
In a convex optimization problem, a point that is a local minimum is
In the KKT conditions, complementary slackness λi⋆gi(x⋆)=0 means
For a linear program with a feasible, bounded optimum, strong duality tells us that