4.10.19 · D3Advanced Topics (Elite Level)

Worked examples — KKT conditions for constrained optimization

2,901 words13 min readBack to topic

Before anything, let us re-anchor the vocabulary so nothing is used unexplained.

Recall the working recipe (we use it in every example):

  1. Write (put every in form first!).
  2. Set (stationarity).
  3. Guess which inequalities are active. Inactive ⇒ its ; active ⇒ its .
  4. Solve. Then verify: primal feasibility, , slackness. If any , the guess was wrong — try another active-set.

The scenario matrix

# Cell (what makes it different) Example
A All inequalities inactive (interior min) Ex 1
B One inequality active, positive Ex 2
C Equality + inequality together, (sign-free) Ex 3
D Wrong active-set guess → flag, then repair Ex 4
E Two inequalities active at once (a cone / corner) Ex 5
F Degenerate LICQ failure — multipliers don't exist Ex 6
G Limiting case: constraint budget moves the answer smoothly Ex 7
H Word problem (real units) with an active budget Ex 8
I Exam twist: non-convex, KKT catches a maximum too Ex 9

The rows cover: every activity combination (inactive / one active / two active), both multiplier signs, the failure of the qualification, a limit, a real-world model, and a non-convex trap.


Example A — everything inactive (interior minimum)

  1. Lagrangian. . Why this step? Both fences are already in form, so we just append them.
  2. Guess both inactive. Why this step? The cheapest possible outcome is the unconstrained minimum; test it first.
  3. Stationarity. ; . Why this step? is where the ground is flat — no fence needed.
  4. Check feasibility. ✓, ✓. Slackness ✓.

Example B — one fence active (positive )

Figure — KKT conditions for constrained optimization
  1. Lagrangian. . Why this step? Standard build; the fence is already .
  2. Stationarity. . Why this step? At rest, must be cancelled by the fence's push .
  3. Guess active. Why this step? Origin is infeasible, so the answer must sit on the boundary.
  4. Multiplier. . Check ✓ (dual feasibility).

Example C — equality + inequality, negative

  1. Lagrangian. . Why this step? Equality gets a free-sign ; inequality gets .
  2. Guess inactive. Why this step? The wire alone might already hold the ball where .
  3. Stationarity. . With : . Why this step? On the wire, both partials give the same , forcing symmetry.
  4. Multiplier & checks. . Check ✓ (fence untouched). Slackness ✓. Why this step? We assumed inactive in step 2; that assumption is only legitimate if the solved point actually satisfies — so we must plug back and confirm, and confirm slackness holds automatically since .

Example D — wrong guess flags itself (), then repair

  1. Wrong guess: active, . Why this step? To demonstrate the self-correcting flag the parent note warns about.
  2. Stationarity. , so . At : . Why this step? Solving the assumed system gives the multiplier.
  3. Read the flag. violates dual feasibility — this active-set is impossible. Discard it. Why this step? A negative inequality multiplier is the mathematical scream "this fence would have to pull, but fences only push."
  4. Correct guess: both inactive. . Feasibility ✓, slackness ✓. Why this step? Having ruled out active, the only remaining candidate active-set that respects is "no fence active"; we test it and it passes all four KKT conditions, so it is the genuine optimum.

Example E — two fences active at once (a corner / cone)

Figure — KKT conditions for constrained optimization
  1. Lagrangian. . Why this step? Two inequalities, both in form.
  2. Guess both active. Why this step? Both fences point toward the origin from the target; a corner is the natural rest.
  3. Stationarity. ; . Why this step? Each active fence supplies its own push to cancel that component of .
  4. Checks. , ✓. Both so slackness ✓. Why this step? The "both active" guess is only valid if both multipliers come out non-negative (dual feasibility); we must confirm each , otherwise a negative one would flag the corner as the wrong active-set.

Example F — degenerate: LICQ fails, no multipliers

  1. Active gradients at . Both constraints are active there (). and . Why this step? KKT stationarity needs to be a non-negative combination of these.
  2. Stationarity attempt. . We need . Why this step? Write out the required cancellation componentwise.
  3. Contradiction. The -component reads impossible. No exist. Why this step? Both active gradients are vertical ; they are linearly dependent and span no horizontal direction, so they can never cancel 's horizontal .
  4. Diagnosis. LICQ fails: are not linearly independent (each is a scalar multiple of the other). Hence KKT are not necessary here even though is the true optimum.

Example G — limiting behaviour: shifting the budget

  1. General solve (active). As in Example B: , . Why this step? The geometry is identical; only the boundary line moved.
  2. Multiplier meaning. : here , so . Why this step? The multiplier is the sensitivity — the marginal cost of tightening the budget by one unit (the bridge to Duality and the Dual Problem).
  3. Limit . , : the fence becomes tangent to the free minimum and its push vanishes smoothly — a graceful hand-off from active to inactive. Why this step? This is exactly complementary slackness in a limit: from both factors shrinking.
  4. Case . Now the origin already satisfies ; the constraint is inactive, , answer , . Why this step? Negative budget is a fence behind the ball — irrelevant.

Example H — word problem (real units)

  1. Model. Minimize s.t. . (Ignore for now; we'll check.) Why this step? Translate "at least 6 tonnes" into form.
  2. Lagrangian & stationarity. . , . Why this step? Balance marginal cost of each product against the same contract push .
  3. Guess active (). From . Then . Why this step? The contract is demanding; the cheapest feasible plan sits on the boundary.
  4. Multiplier & checks. ✓. ✓. Slackness ✓. Why this step? The whole "active" guess only stands if the multiplier is non-negative and the produced amounts are physically valid (no negative tonnage); we plug the solved values back to confirm feasibility, dual feasibility, and slackness before trusting the plan.

Example I — exam twist: non-convex, KKT catches a maximum

  1. Interior stationary point. . Guessing both inactive (): . Feasibility ✓, slackness ✓ — so passes all four KKT conditions. Why this step? To show that KKT can hold at a point that is not a minimum.
  2. Identify . , but nearby : so is a local maximum of , yet it passed KKT. Why this step? Because the problem is non-convex, KKT are only necessary, not sufficient — they cannot tell min from max (the parent-note mistake made concrete).
  3. Boundary case (fence active). Set , . Stationarity ✓. Slackness ✓ (since ). Why this step? Test the right-hand corner as its own active-set; it must satisfy dual feasibility to count as a KKT point.
  4. Boundary case (fence active). Set , . Stationarity ✓. Slackness ✓. Why this step? By symmetry the left corner is the mirror case; confirm it too is a valid KKT point.
  5. Decide by comparing values. KKT-satisfying points are with . Pick the smallest: , . Why this step? When KKT are not sufficient, they only list candidates — you must evaluate at every KKT point and choose the smallest to find the true minimum.

Wrap-up

Recall Which cells did we cover?

A interior-inactive · B one-active () · C equality with · D wrong-guess flag · E two-active corner · F LICQ failure · G limiting budget · H word problem · I non-convex catches a max. Every combination of activity, both signs, degeneracy, a limit, real units, and the convex-vs-non-convex distinction.

Recall Where does the multiplier "sensitivity" idea lead next?

is the seed of Duality and the Dual Problem and underlies why Support Vector Machines read their support vectors off active KKT constraints. Optimization method: Gradient Descent and Projected Gradient.

Back to the parent topic.