Karush–Kuhn–Tucker conditions
Read constrained optimality as feasibility, balanced forces, and complementary activity, with explicit qualification assumptions.
On this page
The question for today
What you’ll understand
- Write the four KKT conditions with consistent signs.
- Determine active constraints and verify a numerical certificate.
- Distinguish sufficient convex certificates from necessary conditions requiring qualifications.
At a wall, the direction of greatest unconstrained improvement may be unavailable. The gradient can therefore remain nonzero at the best feasible point. Karush–Kuhn–Tucker conditions express how objective and constraint gradients balance, while recording which constraints actually matter. Their usefulness depends on understanding the logical direction of the claim: in a convex problem they can certify an optimum, but in general they do not turn every stationary point into a solution.
Four conditions, four distinct jobs
Write inequalities as and equalities as . Primal feasibility says the candidate obeys these rules. Dual feasibility says inequality multipliers are nonnegative. Stationarity balances the objective gradient with a weighted combination of constraint gradients. Complementary slackness requires each inequality multiplier times its constraint value to vanish. Together these conditions connect a feasible decision to an admissible lower-bound construction.
An inequality is active when its value is exactly zero. Complementary slackness forces the multiplier of every strictly inactive inequality to be zero. The converse is false: an active inequality may have zero multiplier if it is locally irrelevant to the optimum's value or redundant with other constraints. Thus counting nonzero prices is not the same as listing every geometric boundary touching the answer. Equality multipliers remain unrestricted in sign.
When a certificate is sufficient
Suppose the objective and inequality functions are differentiable and convex, the equalities are affine, and the candidate lies in their common domain. Nonnegative multipliers make the Lagrangian convex in the primal variable. Stationarity then gives its global minimum. Feasibility and complementary slackness make that minimum equal the primal objective at the candidate, matching a dual lower bound. This proves global optimality of any KKT point in this setting.
A constraint qualification is not needed for that sufficiency argument once a valid KKT certificate has been supplied. It matters when asking whether an optimum must possess such multipliers. For convex problems, Slater's condition is a standard sufficient qualification. For general smooth constrained problems, conditions such as linear independence of active constraint gradients can provide necessity at a local optimum. Without qualification, an optimum can exist while no KKT multiplier vector exists.
Diagnose failure rather than memorize a checklist
Consider minimizing x subject to . The only feasible point is zero, so it is automatically optimal. Yet stationarity would require at zero, an impossibility. The constraint has zero gradient there and admits no strictly feasible point. This example shows why writing down KKT equations and finding no solution does not, by itself, prove that the original problem has no optimum.
Numerical solvers report residuals rather than exact symbolic equalities. Feasibility errors, stationarity errors, and complementarity errors need scaling-aware tolerances; a tiny product can hide a large multiplier paired with a slightly infeasible constraint. The lab has no constraints or multipliers. Use its gradient readout as the unconstrained special case, then compare that zero-gradient stopping rule with the nonzero constrained gradient in the worked example. It cannot test KKT conditions for a user-supplied problem.
Work it through
Find the active wall and its price
Minimize subject to and . Verify all KKT conditions at .
At x=2, the lower constraint is and the upper is . Primal feasibility holds. Complementary slackness requires the lower multiplier , while the upper multiplier may be nonzero.
The objective derivative is . Stationarity reads , so . Both inequality multipliers are nonnegative.
Complementarity gives and . The objective is convex and the inequalities are affine, so this feasible KKT point is globally optimal with value one. Strict convexity also makes its decision unique.
The upper wall has multiplier 2 and the inactive lower wall has multiplier 0. The objective gradient −2 is balanced by the active constraint gradient.
The living notebook
Explore the model
Interactive lab · optimization
The unconstrained special case
Set η=0.5 and a nonzero x₀, then Step toward zero on f(x)=x²/2. Predict how its gradient shrinks. This lab shows ordinary unconstrained stationarity only; it does not include walls, active sets, multipliers, or KKT residual calculations.
- Position x0
- 2
- Objective x²/2
- 2
- Iteration behavior
- Stable step
Gradient descent on f(x) = x²/2: xₙ = (1 − η)ⁿx₀. Playback advances two discrete iterations per second. Values outside |x| ≤ 4 are explicitly reported. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forA raw zero-gradient condition is appropriate for this unconstrained quadratic, while constrained optima may require nonzero balancing multipliers.
Pause & reason
Check your understanding
Your turn
Try it yourself
Minimize subject to . At the optimum, is the constraint active, and what multiplier satisfies KKT when it is written as ?
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
The objective gradient at zero already vanishes. Insert x=0 into the stationarity equation 2x−λ=0.
Compare with the solution
The optimum is zero and the constraint is active because . Stationarity gives , so . Primal feasibility, dual feasibility, and complementarity all hold. This is a concrete active inequality with zero multiplier, disproving the claim that every boundary touching the answer must have a positive price.
Keep the idea
Take it with you
- KKT combines primal feasibility, dual feasibility, stationarity, and complementary slackness.
- Convexity makes a valid KKT certificate sufficient; qualifications address its necessity.
- An active constraint can have zero multiplier, while an inactive one must.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.