How do you solve min⁡x,y (x−2)2+(y−2)2 subject to x+y≤2 using the KKT conditions, and what does each condition mean?

Linear algebra and optimisation, Constrained optimisation
Level L3 Intermediate. Length Medium. Nature Mat Mathematical.

What's being asked

Whether you can write the KKT conditions with the right signs, split into the active and inactive cases, and interpret the multiplier.

Key idea

Form the Lagrangian L=(x−2)2+(y−2)2+μ(x+y−2), where μ is the multiplier for the constraint. The KKT conditions are: stationarity (∇L=0), primal feasibility (x+y≤2), dual feasibility (μ≥0), and complementary slackness (μ(x+y−2)=0). The unconstrained minimum (2,2) breaks the constraint, so the constraint must be active and μ>0.

Steps

  1. Write the constraint as g(x,y)=x+y−2≤0, form the Lagrangian, and list the four conditions. Say what each means: stationarity is “no downhill direction that stays feasible”; complementary slackness is “either the constraint is tight or its multiplier is zero”.
  2. Stationarity: 2(x−2)+μ=0 and 2(y−2)+μ=0, so x=y=2−μ/2.
  3. Case μ=0 (constraint not active): x=y=2, but x+y=4>2, which is infeasible. So μ>0, and complementary slackness forces x+y=2. Then 4−μ=2, so μ=2 and x=y=1, with objective value 1+1=2.
  4. Check the remaining conditions: μ=2≥0 and (1,1) is feasible. The objective is convex and the constraint is linear, and some point satisfies the constraint strictly (e.g. (0,0), which is Slater's condition). So KKT is sufficient, and (1,1) is the global minimum. Geometrically, it is the closest point to (2,2) in the half-plane.
  5. Interpret μ as a price. With the constraint x+y≤c (for c≤4), the optimum is x=y=c/2 with value p∗(c)=(4−c)2/2. Its slope at c=2 is −(4−c)=−2, so μ=−dp∗/dc: loosening the constraint by a small δ lowers the cost by about μδ.
  6. Link to ML. In the SVM, complementary slackness αi(yi(w⊤xi+b)−1)=0 means only points exactly on the margin (the support vectors) can have αi>0.

Common mistakes

How long your answer should be

Half a page; about 5 minutes.

Last checked on 4 December 2026.

Read this

Previous in Linear algebra and optimisation: What is the Adam update, why does it need bias correction, and how large is its very first step?
Next in Linear algebra and optimisation: Using the Gram–Schmidt process, how do you turn the columns of A=(110101011) into an orthonormal basis, and how do you write the resulting QR factorisation?