Bellman equation Created 2026-09-24 Updated 2026-10-14
A Bellman equation expresses the dynamic programming principle as a recurrence relation for a value function: optimize the current reward plus the best attainable continuation. Let be a dynamic programming state, the allowed actions at time , the immediate reward, and the next dynamic programming state. With terminal time and terminal reward , the deterministic finite-horizon Bellman equation is
Here measures total reward from time through the terminal reward. Start with and evaluate backwards; the terminal condition anchors the recurrence relation. For finite nonempty action sets, finite rewards, and finite terminal rewards, a maximum exists at each step. If an optimum need not be attained, use a supremum. A minimization problem instead uses a minimum or infimum. The 0-1 knapsack problem above is the same comparison between an immediate item value plus a continuation and the continuation after skipping. See Bertsekas, MIT lecture 2: the backwards recursion.
In a Markov decision process, the next dynamic programming state is random. If denotes the expected immediate reward and is a discount factor, the finite-horizon Bellman equation becomes
The conditional expectation averages over the next dynamic programming state before choosing the current action; that action cannot use a future outcome that has not yet been observed. For a finite state space with transition probabilities , the continuation term is . Taking gives the undiscounted finite-horizon problem. With a discount factor , rewards steps ahead carry a factor , including the terminal reward. A maximizing action for each specifies a Markov policy, which contains decisions rather than just optimal scores.
For an infinite horizon with a finite state space, finite nonempty action sets, time-independent transition probabilities, bounded rewards , and a discount factor , the optimal value function satisfies
In this setting the maximizing dynamic programming operator is a contraction mapping in the supremum norm, so the Banach fixed-point theorem gives a unique bounded fixed point and convergence of repeated application to it. See Bertsekas, MIT lecture 15: bounded discounted problems. These hypotheses matter: with one state, one action, zero reward, and , the Bellman equation is merely , so every finite constant is a fixed point, although the actual total-reward value function is zero. The average-reward Bellman equation and Hamilton-Jacobi-Bellman equation address other settings with their own conditions.
Convex optimization Created 2026-09-24 Updated 2026-10-13
Convex optimization is a minimization problem with a convex function as its objective function and a convex set of feasible points. For a finite-valued , the problem is to find with for every . The displayed infimum describes its value even when no minimizing point exists. The two convexity requirements concern different objects: the allowed decisions and the scores assigned to them.
A convex set contains the whole line segment between any two of its points:
A convex function lies below the interpolation of its endpoint values:
Thus mixing two allowed decisions preserves feasibility, and the mixed score is no worse than the same mixture of endpoint scores. The objective function may have flat regions or corners. For a strictly convex function, the second inequality is strict when and .
A useful constraint representation is
where are convex functions on a common convex set , and the equalities are affine functions. Each inequality defines a convex sublevel set; their intersection with and the equality set is a convex set. An equality involving a general convex function need not preserve this geometry: allows and but excludes their midpoint . See Boyd and Vandenberghe, Convex Optimization (2004), §4.2.1 for the standard problem form.
Why local information can certify a global answer. Every local minimum of a convex optimization problem is a global minimum, including minima on the boundary. If a feasible point had , points would remain feasible and have value strictly below for every . Taking arbitrarily small contradicts a local minimum at . This argument explains the special power of convexity: a better distant decision would reveal an improving direction immediately nearby.
If a minimizer exists and the objective function is strictly convex on , it is unique. Two distinct minimizers of value would have a feasible midpoint with value strictly below . Existence is a separate question: the exponential function is strictly convex on , but its infimum is approached only as . Even a bounded convex set need not suffice: on also has unattained infimum . A continuous function on a nonempty compact set attains its minimum by the extreme value theorem.
Nor does strict convexity imply differentiability. For , the squared term gives the strict inequality while the triangle inequality gives the weak inequality for the absolute value. At zero the left and right derivatives are and , so no derivative exists there, although zero is the unique minimizer. Such objectives require subgradients or proximal operators rather than an ordinary gradient at every point.
For a differentiable convex function on an open convex set containing , the constrained first-order condition is
Indeed, the subgradient inequality makes this sufficient; taking the one-sided derivative along feasible line segments makes it necessary. At an interior minimizer, both directions are feasible and the gradient must vanish. At a boundary minimizer it can be nonzero: it only needs to make every feasible direction nondecreasing. See Boyd and Vandenberghe, §§3.1.3 and 4.2.3.
A fully computed nearest-point problem. Project onto the half-space by minimizing half the squared Euclidean distance:
The Hessian matrix is the identity matrix, so the objective function is strictly convex. The unconstrained minimizer violates the inequality. With the convention , the optimization Lagrangian is , where the Lagrange multiplier satisfies . Its Karush-Kuhn-Tucker conditions are
The last two equations give , . The choice is infeasible, so complementary slackness forces . Consequently , giving , and . The Euclidean distance is , rather than the objective function value . The gradient at the answer balances ; the displacement from to is a normal vector to the boundary.
Figure 1.
The nearest feasible point is where an objective contour first touches the half-space boundary
. Details.
There is an exact certificate independent of numerical search. Completing squares gives
For every feasible point, implies . Thus every feasible objective is at least , and attains this bound. More generally the Lagrangian dual problem has objective for . Its maximum is also , illustrating strong duality through matching computed bounds. This makes the example a model for Euclidean projection onto a convex set and the projection step in projected gradient descent.
What the multiplier conditions require. For differentiable convex functions on an open convex set and equalities defined by affine functions, the KKT conditions combine feasibility, , complementary slackness , and stationarity
with unrestricted equality Lagrange multipliers . They suffice to certify a global minimum without an additional regularity assumption: the optimization Lagrangian is convex, stationarity minimizes it, and feasibility with complementary slackness gives the same certificate as above. To guarantee their necessity at an attained finite optimum, a regularity hypothesis suffices: Slater's condition requires some with and . The projection example has the strictly feasible point . See Boyd and Vandenberghe, §§5.2.3 and 5.5.3. This hypothesis guarantees suitable multipliers, not existence of a primal minimizer.
Without regularity, necessity can fail even for convex functions: minimize subject to . The sole feasible point is optimal, but stationarity would require . No Lagrange multiplier works. There is no strictly feasible point, and the gradient of the constraint vanishes at the answer.
The nonconvex contrast. The polynomial has derivative and second derivative . Numerically solving the cubic gives stationary points , , and . Their objective values are respectively , , and , with second derivatives , , and . Hence both outer points are local minima, and the middle point is a local maximum. Since at both ends, its global minimum exists and must be one of the stationary minima: it is the left one. A method stopping at the right local minimum misses a better value by approximately .
Figure 2.
A strictly convex quadratic has one minimum; a tilted quartic has two local minima with different values
. Details.
The practical appeal of convex optimization is the ability to check an answer globally using geometry and matching Lagrangian duality bounds. The projection certificate certifies every feasible alternative at once; the tilted quartic shows why a zero gradient alone cannot do that for general nonlinear optimization.
Historically, an early landmark is Kuhn and Tucker's [ref]. Its §3 explicitly states a regularity hypothesis for inequality-constrained Lagrange multipliers; its discussion of saddle points explains how concave functions support global conclusions for maximization. This documents an early formulation of the multiplier approach; it does not establish sole discovery of today's KKT conditions or of convex optimization as a whole.
Duality gap 2026-10-18
For finite primal and dual optimal values in a minimization problem, the duality gap is . Strong duality means this difference is zero.
Adding an optimization constraint removes possibilities: if it permits a set , the new feasible region is . It can leave unchanged when all its members already satisfy the added restriction. For a fixed objective function, restricting the feasible set cannot lower a minimization problem's infimum. In the equality slice of a feasible triangle, it raises the attained value from to .
Instead add to the feasible triangle with a squared-distance objective. No point can have both and . The resulting feasible set is the empty set, so there is no feasible point and no optimizing decision. Under the extended-value convention for a minimization problem, its infimum is .[ref]
A nonempty feasible set can also lack an optimizing decision. With domain , minimize subject to the strict inequality . The feasible region is an open set. Its infimum is , approached by the feasible points , but is excluded. Every feasible point is beaten by , so no minimum is attained. Replacing by includes the missing optimum. Open feasible regions do not always prevent attainment: minimizing on the same open set attains value at . A useful sufficient condition is instead the extreme value theorem: a continuous objective function on a nonempty compact set attains its minimum.
Exact line search 2026-10-24
A line search that finds a global minimizer along the chosen ray, provided one exists. For a negative gradient direction, its decrease in the objective function is at least that of any admissible fixed step size. The cost of solving this one-dimensional minimization problem must be included when comparing computation time.
Target: vector-space.bigb, under Vector subspace.
Fenchel–Young gap Created 2026-10-05 Updated 2026-10-14
The Fenchel–Young gap is the nonnegative discrepancy
for a proper convex function and its convex conjugate. It can be . When is finite, it is the vertical distance between and its affine minorant . The Fenchel–Young gap vanishes exactly when , so it measures whether an input and a slope satisfy the subgradient relation.
For the convex quadratic function , completing the square gives
At and , the function value is and the tangent line has value , giving a Fenchel–Young gap of . In , the same calculation for gives and , half the squared Euclidean norm of the mismatch.
Figure 1. . The left panel fixes and marks the distance between the convex quadratic function and its tangent line . The right panel plots the Fenchel–Young gap , which vanishes at the matching input . Details.
An exact optimization error certificate. Fix a slope with and minimize the linearly tilted objective function . By the definition of the convex conjugate, , so
This identity holds even when the infimum is not attained. Thus a computed finite Fenchel–Young gap is exactly the error in objective value for this minimization problem. For the convex quadratic function, implies . A general proper convex function need not convert a small gap into a small distance: the absolute value has zero gap at for every .
The Fenchel–Young gap also connects convex analysis to optimal transport. For a proper convex function , define Kantorovich potentials and . The half-squared Euclidean distance cost satisfies . For a transport plan with finite integrated cost and integrable Kantorovich potentials, integrating this identity gives the difference between transport cost and the potentials' bound. This is the same local subgradient mismatch summed over transported pairs.
Consider the chosen finite minimization problem
Only adjacent integers are neighbors. At each interior state propose left or right with probability each; at an endpoint propose its sole neighbor with probability and itself with probability . This proposal distribution is symmetric, including at the endpoints. The local minimum at is relative to these allowed moves; is the unique global minimum.
Figure 1.
An uphill step opens a route out of a local minimum in a chosen five-state problem
. Points are the only allowed states; joining lines show adjacency, not additional feasible points. Starting at , improving-only local search is trapped. The possible route first raises the objective function by , then lowers it twice. Details.
At , improving-only local search rejects both neighbors because and exceed . For simulated annealing, choose , using the natural logarithm. Conditional on proposing from , the acceptance probability is
The one-step transition probability is instead . Both subsequent rightward proposals are downhill, so the conditional probability of the precise next three states being , given and fixed , is
This is one possible escape route, not the probability of eventually reaching . Rejections, excursions toward , and repeated attempts give many other sample paths. The calculation establishes possibility, without claiming a general performance advantage from a selected sample path.
For comparison, halving makes the uphill acceptance probability ; doubling it makes that probability . Cooling makes it harder to leave this local minimum, even though the stationary distribution increasingly favors the global minimum. That tension is the central scheduling problem.
Karush-Kuhn-Tucker conditions Created 2026-09-24 Updated 2026-10-14
The Karush-Kuhn-Tucker conditions combine membership of the feasible set with a balance of gradients and complementary slackness. For a minimization problem with differentiable functions on an open subset of , write
and use the optimization Lagrangian
A candidate satisfies the KKT conditions exactly when all four requirements hold:
The sign of each inequality Lagrange multiplier follows the chosen convention : on the feasible set, makes the optimization Lagrangian a lower bound on the objective function. An equality contributes zero on the feasible set for either sign of its Lagrange multiplier. Complementary slackness says an inequality with must have , while implies an active constraint. An active constraint can still have zero Lagrange multiplier; the quadratic minimization with a moving upper bound below gives an explicit example.
The name records William Karush's 1939 master's thesis and the 1951 work of Harold W. Kuhn and Albert W. Tucker.[ref]
The chosen quadratic objective function above gives more than an optimal allocation: its Lagrange multiplier predicts how much the best cost changes when the required total changes. For this example,
This is an explicit derivative of a constrained value function and an instance of the envelope theorem. At , one extra small unit of required output costs approximately units per unit of output, in the chosen normalized model. Increasing makes this equality-constrained minimization problem more expensive; it is not a gain from relaxing an upper resource limit. The sign and meaning depend on how the optimization constraint and optimization Lagrangian are written.[ref]
For an actual finite change , the cost difference is exactly
At , the linear approximation predicts , while the exact increase is . The extra comes from the squared term in this polynomial, rather than numerical error. A Lagrange multiplier gives a local sensitivity analysis; treating it as a constant price over a large change generally loses the change in the optimum itself.
Figure 1.
The multiplier is the slope of the optimal cost, with a computable finite-change correction
. Original calculations for . Left: the value function and its tangent at . Right: exact and first-order cost increases for nonnegative changes ; their gap is . The marked is a chosen example, not an observed price or a measured response. Details.
For a smooth optimizer of an equality problem , the short chain rule calculation explains the result: and imply . The differentiability and stationarity assumptions matter: an optimizer can fail to be unique or vary smoothly. The envelope theorem records when this interpretation is justified.
Lagrangian duality Created 2026-10-06 Updated 2026-10-18
A feasible point gives an upper bound on a minimization problem's best value; a suitable Lagrange multiplier gives a lower bound. Lagrangian duality searches for the strongest bound obtainable this way. Matching bounds certify a global minimum.
Let be a nonempty decision domain on which the objective function and the constraint functions are finite. Write the primal problem and its optimization Lagrangian as
The inequality Lagrange multipliers obey ; the equality Lagrange multipliers are unrestricted real numbers. Define the Lagrange dual function and dual optimal value by
The inner infimum keeps , but releases the displayed optimization constraints. It can be , giving an uninformative lower bound. A different domain changes the bound.[ref]
Here is the entire weak duality argument. For any feasible point and allowable Lagrange multipliers,
The first inequality is the definition of an infimum; the second uses and . Taking the infimum over feasible , then the supremum over allowable Lagrange multipliers, gives . No convexity is used.
The Lagrange dual function is a concave function, since each fixed decision makes an affine function of the Lagrange multipliers.[ref] Explicitly, write and choose two points where is finite. For and every ,
Taking the infimum over proves the defining concavity inequality. Thus even a difficult primal problem supplies a dual with useful geometry, although evaluating can itself be difficult.
For finite optimal values, strong duality means , or zero duality gap. It need not imply dual attainment. For convex optimization, Slater's condition is a sufficient constraint qualification for both when is finite.[ref] The Strong Lagrangian property requires an actual finite Lagrange multiplier achieving equality. Convex perturbation duality interprets such a bound as a supporting slope of the perturbed value function.
Choose the one-variable quadratic program
Without the optimization constraint, the global minimum is at . On the feasible set , write with : then . Hence is the unique primal optimizer and .
For any , completing the square in the optimization Lagrangian gives
The inner minimization problem is over all real numbers, so its unique optimizer is . Therefore
The best lower bound is , attained at . At , the inner optimizer is , which is infeasible for the primal problem; nevertheless is a valid lower bound. At , the inner optimizer is , which is feasible, but is weaker than . Feasibility of an inner optimizer alone does not make the bound exact.
Figure 1.
Lagrangian duality finds the quadratic's exact lower bound at multiplier 6
. Left: the objective function, three optimization Lagrangians, and the shaded feasible set . Dots mark the global minima of the optimization Lagrangians over all real numbers; each yields a horizontal lower bound. Right: the concave Lagrange dual function reaches the primal value . All parameters are chosen for this worked example. Details.
At , the Karush-Kuhn-Tucker conditions reduce to
The last equality is complementary slackness. The strongest certificate is visible without solving another optimization problem: , so every feasible point satisfies
The same Lagrange multiplier simultaneously makes the inner optimizer feasible and removes the slack between and . This is a convex KKT optimality certificate; also verifies Slater's condition.
The domain in the inner infimum is essential. If one mistakenly keeps when computing , the restricted minimum becomes , whereas the actual Lagrange dual function has value . Constraints deliberately retained in are allowed in a Lagrangian relaxation, but that is a different choice of which restrictions to dualize.
Mathematical optimization Created 2026-09-24 Updated 2026-10-13
Mathematical optimization turns a preference into a precise question: among the allowed decisions, which gives the best outcome? A model separates the objective function, which measures quality, from the optimization constraints, which determine the feasible set. This language unifies finding a cheap plan for a transportation problem, efficient scheduling, or an accurate model in linear regression. The separation is useful because changing a preference and changing what is possible are different modeling decisions. See Boyd and Vandenberghe, introductory optimization models.
For an objective function , a maximization problem asks for a feasible point satisfying for every ; a minimization problem reverses the inequality. This is a global extremum. A local maximum or local minimum compares only nearby feasible points, so finding one does not settle the global question.
Consider allocating ten units between two complementary inputs:
The budget constraint forces a tradeoff: an extra unit of costs a unit of . The best allocation is , with objective function value . Without the budget constraint, gives : there is no global maximum. Constrained optimization can therefore have a finite answer even when the corresponding problem with fewer optimization constraints does not. Its beauty is that geometry, calculus, and an arithmetic-geometric mean inequality can certify the same answer.
Maximization problem 2026-10-06
A maximization problem seeks a feasible point with largest objective value. Its supremum can fail to be attained or be infinite. Negating the objective gives a minimization problem. A global extremum of an optimization Lagrangian can certify a feasible optimum by the Lagrangian sufficiency theorem.
Objective function 2026-10-13
An objective function is a real-valued function assigning a score to each decision under consideration. An optimization problem seeks a feasible solution maximizing or minimizing this score. The optimizing decision and its score are different objects: in the budget constraint example, the decision is and the optimal value is .
Choosing an objective function expresses what matters. With and , maximizing makes every feasible point equally good; maximizing selects ; maximizing rewards balance. If are side lengths, is a rectangle's area, and the budget constraint fixes its perimeter at . The same mathematics then says that a square encloses the largest area among these rectangles.
For the product objective function, the positive level sets are hyperbolas. Each collects decisions with identical scores. The highest attainable level set touches the feasible set at ; higher ones miss it entirely.
Figure 1.
Product contours meet the feasible budget segment, with a unique maximum of 25 at (5,5)
. Details.
The product is neither a convex function nor a concave function on the positive quadrant: along it is , while along it is . Yet its restriction to this feasible set is a strictly concave function. Thus the geometry of the allowed decisions can make an otherwise nonconcave maximization problem tractable. Replacing by always converts a maximization problem into an equivalent minimization problem.
Optimization Lagrangian Created 2026-10-06 Updated 2026-10-14
For a minimization problem with and , the optimization Lagrangian is with and unrestricted equality Lagrange multipliers. Its infimum over the original variable domain gives a dual lower bound. For a maximization problem, use to obtain upper bounds. The Lagrangian sufficiency theorem combines a global extremum of this function with feasibility and complementary slackness. This is distinct from a Lagrangian density in variational physics.
Take . The Galerkin method asks for such that
Since a finite-dimensional subspace is closed, is itself a Hilbert space. The bounded bilinear form and coercive bilinear form estimates in part (a) restrict to with the same constants. The Lax-Milgram theorem therefore gives exactly one for every .
Put . Subtracting the continuous and discrete weak formulations gives Galerkin orthogonality:
For any , the difference also belongs to , so
The last step uses the constant-one Cauchy-Schwarz inequality estimate from part (a). Bounding the four terms separately by a sum would obscure the precise constant requested here.
The two minimization problems over and are independent. Each has a best approximation because its vector subspace is finite-dimensional. Consequently, if
then the preceding inequality gives exactly
Both errors belong to the zero-boundary Sobolev space. Applying the Poincaré inequality componentwise now yields
When the desired estimate is automatic; otherwise divide by the nonzero norm. Thus
The constant is independent of . This is the Céa lemma estimate for this particular skew-coupled elliptic system.
The dual linear program is the minimization problem
Indeed, for the optimization Lagrangian bounds the primal objective above on its feasible points. Its supremum over is finite precisely when , and then equals . The two labelled parts below establish the relevant weak duality and strong duality conclusions.
For the subsequent infeasibility argument, introduce nonnegative slack variables and the convex cone
This is generated by the columns of and the coordinate vectors. Here is why this finitely generated cone is closed. Any representation with a minimal number of positive coefficients uses linearly independent generators: otherwise subtract a suitable multiple of a dependence until one positive coefficient vanishes, preserving nonnegativity. For each fixed independent selection of generators, its nonnegative combinations form a closed set, because the inverse coordinate map on its span is continuous. There are finitely many selections, so their union is closed. This is the closedness of finitely generated cones used in Farkas' lemma.
When the primal linear program is infeasible, . Let be the nearest point of to , and set . The minimizing property gives for every . Taking gives . Consequently
In particular and . Rescaling by the positive number produces the requested Farkas' lemma certificate:
Now a feasible point of the relaxed inequalities would satisfy
Since , the sum of the nonnegative is positive. Thus robust infeasibility under uniform constraint relaxation gives
The ellipsoid method makes progress by reducing the volume of a containing ellipsoid. A nonempty linear polyhedron may have empty interior, so small volume alone cannot certify that the original system is infeasible. Relaxing the inequalities remedies this difficulty, but must not make an infeasible system appear feasible. The displayed positive gap proves exactly that sufficiently small relaxations preserve infeasibility. For rational input, determinant bounds give a Farkas' lemma certificate of polynomial encoding length, so a sufficiently small rational relaxation can be chosen from the input encoding length. Together with a bounding box and bounds on the volume of a relaxed feasible system, this lets the ellipsoid method distinguish infeasibility from a feasible system of very small or zero original volume in polynomial time. The certificate argument alone does not assert a polynomial precision bound for arbitrary unencoded real coefficients.
For a maximization problem with and , use the optimization Lagrangian
The Lagrangian sufficiency theorem says: if is feasible, globally maximizes over its original domain, and complementary slackness holds, , then globally maximizes over the feasible set. Equality Lagrange multipliers have no sign restriction. For every feasible ,
which proves the theorem.
For a minimization problem, reverse the signs in the optimization Lagrangian: take , with . If a feasible globally minimizes this optimization Lagrangian and satisfies complementary slackness, then
The hypothesis is a global extremum of the Lagrangian. Merely solving its stationarity equations is insufficient; no convexity assumption is needed when the global extremum itself has been proved.
For minimization, the optimization Lagrangian is
Its coefficient of is , so its infimum over unrestricted is for every allowable Lagrange multiplier. There is no finite global minimizer of the optimization Lagrangian to which the Lagrangian sufficiency theorem could apply.
The primal minimization problem is also unbounded: set , and . These points are feasible, and . Hence
Expanding and taking partial derivatives gives the gradient and Hessian matrix
At , these are and
Thus the Newton step solves
The second equation gives ; substituting into the first gives . Hence
At , however,
The eigenvalues of this Hessian matrix are in direction and in direction . It is invertible but indefinite. Thus the Newton step is zero, and
This illustrates that stationary points are fixed points of Newton's method. Here the fixed point is a saddle point of a scalar function, not a local minimum. Indeed, direct substitution along the two eigenvector directions gives
For sufficiently small nonzero , one direction decreases and the other increases it. The global minimum is instead zero: the sum of squares vanishes at and . These are the only real zeros, since and imply . Thus a zero gradient is an insufficient stopping certificate for minimization problem without classifying the stationary point.