Skip to content
AI360XpertBeta

KKT Optimality Conditions

Constrained optima balance the objective pull against active constraint pushes. KKT writes that balance as four checkable equations.

Minimizing x minus 3 squared left of x equals 1 balances the objective pull against the bound price of 4
Minimizing x minus 3 squared left of x equals 1 balances the objective pull against the bound price of 4

Why Does This Exist?

Unconstrained optima set the gradient to zero. Constrained optima usually sit on the boundary where the gradient is not zero: the objective pulls outward while the wall pushes back. Declaring "gradient nonzero so not optimal" misses every boundary solution, which is most of them.

Karush-Kuhn-Tucker writes the standoff as four conditions on (x⋆,λ⋆,ν⋆)(x^{\star}, \lambda^{\star}, \nu^{\star}): stationarity, primal feasibility, dual feasibility, complementary slackness. Under convexity plus constraint qualification they certify global optimality.

This page is the certificate checker: given a candidate point, run the four checks with its own fixture. The inequality story with the support vector payoff lives in KKT conditions, which uses a different fixture. The equality machinery lives in Lagrange multipliers and duality, and the algorithms that consume the certificate live in convex optimization.

The one idea you need first

A constraint g(x)≤0g(x) \leq 0 is active when g(x⋆)=0g(x^{\star}) = 0 (on the wall) and inactive when strictly inside. Only active walls push, priced by multipliers λ≥0\lambda \geq 0. Inactive walls price zero.

Think of It Like This

A dog on a leash at the fence

A dog runs toward a squirrel (objective pull) until the leash snaps taut at the fence (active constraint). At rest, pull plus leash tension balance: stationarity. The leash only pulls when taut (slackness), never pushes the dog outward (dual feasibility λ≥0\lambda \geq 0), and the dog stays inside the yard (primal feasibility).

A loose leash prices zero. Where it stops: leashes are single and smooth, while real problems stack many walls with kinks needing constraint qualifications.

How It Actually Works

For minimize f0f_0 subject to fi≤0f_i \leq 0, hj=0h_j = 0 with differentiable functions: stationarity ∇f0+∑λi∇fi+∑νj∇hj=0\nabla f_0 + \sum \lambda_i \nabla f_i + \sum \nu_j \nabla h_j = 0; primal fi≤0,hj=0f_i \leq 0, h_j = 0; dual λi≥0\lambda_i \geq 0; slackness λifi=0\lambda_i f_i = 0. Here f0f_0 is the objective, each fif_i is an inequality wall priced by λi\lambda_i, and each hjh_j is an equality wall priced by νj\nu_j. SVMs read off support vectors as active constraints with λi>0\lambda_i > 0. Constraint qualifications (Slater, LICQ) rule out degenerate wall tangles where multipliers misbehave.

Worked example

Minimize (x−3)2(x-3)^2 subject to x≤1x \leq 1 (write g(x)=x−1≤0g(x) = x - 1 \leq 0). Lagrangian L=(x−3)2+λ(x−1)L = (x-3)^2 + \lambda(x-1). Stationarity: 2(x−3)+λ=02(x-3) + \lambda = 0. Guess active: x⋆=1x^{\star} = 1, then 2(−2)+λ=02(-2) + \lambda = 0 gives λ⋆=4≥0\lambda^{\star} = 4 \geq 0. Checks: primal 1−1=01 - 1 = 0 feasible, slackness 4×0=04 \times 0 = 0, dual 4≥04 \geq 0. Certified constrained optimum with value (1−3)2=4(1-3)^2 = 4 and wall price 4. Inactive guess λ=0\lambda = 0 would give x=3x = 3, violating x≤1x \leq 1: correctly rejected.

Code

x: float = 1.0lam: float = 4.0stat = 2 * (x - 3) + lam  # stationarity residualprint(round(stat, 6))  # -> 0.0print(x <= 1, lam >= 0, round(lam * (x - 1), 6))  # -> True True 0.0

Residual zero with feasibility, sign, and slackness all passing. Four numbers certify the point.

Watch Out For

Trusting KKT without constraint qualification

Degenerate constraints (duplicated walls, cusps) admit KKT points that are not optimal, or optima with no multipliers. Solvers return "KKT satisfied" on such models and teams stop.

Verify Slater (strictly feasible point for convex) or LICQ (independent active gradients). If walls are redundant or kinky, reformulate before certifying.

Reading inactive multipliers as influence

λi=0\lambda_i = 0 means the wall did not push: removing it changes nothing locally. Teams regularize or price constraints by λ\lambda and chase zeros.

Rank active constraints by λi>0\lambda_i > 0 only. Sensitivity dp⋆/dbi=−λidp^{\star}/db_i = -\lambda_i holds at active walls under regularity, nowhere else.

The Quick Version

  • KKT balances objective pull against active wall pushes with four checks.
  • Example (x−3)2(x-3)^2 left of 1 certifies x⋆=1x^{\star} = 1, λ⋆=4\lambda^{\star} = 4, value 4.
  • Slackness pairs prices with walls: positive price means on the wall.
  • Convex plus qualified makes KKT sufficient for global optimality.
  • SVM support vectors are exactly the active set with positive multipliers.
  • Without qualification, KKT neither certifies nor prices reliably.