4.10.19 · D4Advanced Topics (Elite Level)

Exercises — KKT conditions for constrained optimization

2,510 words11 min readBack to topic

Before we start, one shared vocabulary reminder so no symbol appears unearned. Two of the symbols carry index letters: throughout this page == runs over the inequality constraints== (, the fences) and == runs over the equality constraints== (, the wires).

The recurring recipe, which you will apply again and again:

yes

no

Write Lagrangian L

Set grad L = 0 stationarity

Guess which fences are active

Solve for x and multipliers

Check lambda greater or equal 0

Check slackness done

Guess wrong flip a fence


Level 1 — Recognition

Exercise 1.1

State the four KKT conditions for the problem s.t. , . Name each.

Recall Solution 1.1
  1. Stationarity: .
  2. Primal feasibility: and .
  3. Dual feasibility: .
  4. Complementary slackness: for every .

Exercise 1.2

For each statement, say true or false and give the one-line reason. (a) Equality multipliers must be . (b) If a constraint is inactive at the optimum, its multiplier is . (c) For a convex problem, KKT are only necessary, never sufficient.

Recall Solution 1.2

(a) False. Only inequality multipliers ; equality are free in sign (a wire can push either way). (b) True. Inactive means ; complementary slackness then forces . (c) False. For a convex problem KKT are necessary AND sufficient for a global minimum.

Exercise 1.3

Convert to standard form and write the stationarity term for the constraint: .

Recall Solution 1.3

Move everything to one side so the constraint reads "something ": Its gradient is , so the stationarity contribution is with . If you had forgotten to flip, your would come out with the wrong sign.


Level 2 — Application

Exercise 2.1

Minimize subject to . Find , , and .

Recall Solution 2.1

Standard form: , so . . Stationarity: . The unconstrained min is , which violates — so the fence must be active: . Then ✓. Slackness ✓ (). Answer: , , .

Exercise 2.2

Minimize subject to . Find the point and .

Recall Solution 2.2

Standard form: , . . Stationarity: , . The origin is infeasible, so try active: . Then . Check ✓, slackness ✓. Answer: , , .

Reading the figure below. The violet line is the fence ; the shaded band above it is the feasible region (). The magenta arcs are level circles of (points of equal cost, growing outward from the origin). The optimum in magenta is where the smallest such circle first touches the feasible band — the closest point of the line to the origin. The orange arrow is (the downhill pull), and notice it points straight along the fence's normal: that is stationarity made visible — the pull is exactly cancelled by the fence's push.

Figure — KKT conditions for constrained optimization

Exercise 2.3

Minimize subject to (i.e. , ).

Recall Solution 2.3

. Stationarity: . Try both inactive (): . Check ✓, slackness ✓. Answer: , both , . The marble sits at the bottom, touching no wall.


Level 3 — Analysis

Exercise 3.1

Minimize subject to and (i.e. ). Find , , .

Recall Solution 3.1

, ; . . Stationarity: , . Try inactive (): , . With . Check ✓ (in fact exactly on the fence, still feasible), slackness ✓ (). Solve : . Answer: , , . Note is perfectly legal — equality multipliers have no sign restriction.

Exercise 3.2

Consider subject to . The only feasible point is . Show that LICQ fails here, and discuss whether KKT can be certified.

Recall Solution 3.2

Feasibility: forces (a single point). At the constraint is active (). LICQ check: the active gradient is at . A set containing the zero vector is linearly dependent, so LICQ fails. Stationarity attempt: for any . So no multiplier makes stationarity hold, even though is the (only, hence optimal) feasible point. This is exactly the situation the parent note warns about: without a constraint qualification, KKT need not hold at an optimum. Answer: LICQ fails; KKT stationarity is unsatisfiable here; the multiplier does not exist.

Exercise 3.3

Minimize subject to (a disk centred at of radius ). Find the optimum by geometry, then verify with KKT.

Recall Solution 3.3

Geometry: we want the point of the disk closest to the origin. The disk's nearest point to lies on the line from origin to centre , at distance (centre distance) (radius) . So . KKT check: , . Try active: . Stationarity: and . Second equation: . Since , , so . With , active: or . First equation: .

  • : ✓ → valid KKT point, .
  • : ✗ dual feasibility fails (this is the farthest point, a maximum). Answer: , , .

Reading the figure below. The violet circle is the fence boundary ; the shaded disk is the feasible region. The two magenta arcs are cost circles of . The dashed navy line through the origin and the centre pierces the disk at two points: the near point in magenta (the minimum, ) and the far point in orange (a maximum, whose fails dual feasibility and is rejected). Both solve stationarity — only the sign of tells them apart.

Figure — KKT conditions for constrained optimization

Level 4 — Synthesis

Exercise 4.1

Minimize subject to , , . Find the optimum with full case analysis.

Recall Solution 4.1

Constraints: , , . Unconstrained min is , but → infeasible, so is active. Assume only active (): . Stationarity: , . Active: . Then ✓. Check other fences: ✓, ✓ (both inactive, consistent). Slackness ✓. Answer: , , . The target is pulled back to the closest point on the diagonal fence ; the corner fences never come into play.

Exercise 4.2

Projection onto the probability simplex (1-D warm-up for SVM-style problems). Minimize for , given data , subject to and . Find the projection.

Recall Solution 4.2

; , . . Try both inactive: stationarity , . So , . Sum : . Then , . But violates ! So must be active. Now active (), inactive (): From : . Stationarity in : . Stationarity in : . Then ✓. Check ✓. Answer: , , , . The projection snaps the negative coordinate to the boundary.


Level 5 — Mastery

Exercise 5.1

Derive the hard-margin SVM dual, KKT-style. For a linearly separable dataset, the SVM primal is Write the constraints in standard form, form the Lagrangian, apply stationarity, and state what complementary slackness says about support vectors.

Recall Solution 5.1

Standard form: , multipliers . Stationarity in : . Stationarity in : . Complementary slackness: .

  • If a point is strictly on the correct side (), then , forcing — it does not appear in .
  • Only points on the margin () may have . These are the support vectors — the only data that define the boundary. This is the KKT interpretation of the whole SVM: the separating plane is a weighted sum of just its support vectors. (Substituting back into yields the classic dual in .)

Exercise 5.2

Why KKT ⇒ global optimum here. In Ex 5.1, argue that the KKT point is the global minimum, and name the constraint qualification that guarantees multipliers exist.

Recall Solution 5.2

The objective is convex (quadratic, positive semidefinite Hessian), and each constraint is affine in (hence convex). A problem with convex objective and affine constraints is a convex program. For convex programs, KKT are necessary AND sufficient for a global minimum — so any point satisfying the four conditions is the global optimum. Constraint qualification: Slater's condition asks for a strictly feasible point — some with every constraint holding strictly, i.e. for all . This is not the same as mere separability: separability only guarantees a point with (equality allowed on the margin), whereas Slater needs strict inequality everywhere. However, if the data is separable we can always scale up to open a strict gap (multiply by any factor once the margin is positive), producing a strictly feasible point — so separability implies Slater here, but only after this rescaling step, not by definition. (Additionally, because the constraints are affine, even weaker linear constraint qualifications apply.) Slater guarantees the dual multipliers exist and strong duality holds, which is exactly what lets us solve the dual instead of the primal.

Exercise 5.3

Connect to algorithms. Explain in two sentences how projected gradient descent enforces KKT at its fixed point, using Ex 4.2's projection as the mechanism.

Recall Solution 5.3

Projected gradient takes a downhill step and then projects back onto the feasible set — exactly the operation we solved by KKT in Ex 4.2 (project onto the simplex, snapping negatives to ). At a fixed point the gradient step is undone entirely by the projection, which is precisely the statement that lies in the normal cone of the feasible set — the geometric form of KKT stationarity plus complementary slackness.