How do you derive the dual of the soft-margin SVM min⁡w,b,ξ 12∥w∥2+C∑iξi subject to yi(w⊤xi+b)≥1−ξi and ξi≥0? How do you show the box constraint 0≤αi≤C, and what are the KKT conditions that classify each point?

Supervised learning, Soft-margin dual
Level L3 Intermediate. Length Long. Nature Mat Mathematical.

What's being asked

Whether you can form the Lagrangian, eliminate the primal variables and interpret the KKT conditions.

Key idea

Setting the derivatives of the Lagrangian to zero gives w=∑iαiyixi, ∑iαiyi=0 and C−αi−μi=0. Since μi≥0, the multiplier is boxed: 0≤αi≤C.

Steps

  1. Introduce multipliers αi≥0 for the margin constraints and μi≥0 for ξi≥0: L=12∥w∥2+C∑ξi−∑αi[yi(w⊤xi+b)−1+ξi]−∑μiξi.
  2. Set ∂L/∂w=0: w=∑iαiyixi. Set ∂L/∂b=0: ∑iαiyi=0.
  3. Set ∂L/∂ξi=0: C−αi−μi=0. Because μi≥0, we get αi≤C. The ξ terms vanish from L.
  4. Substitute back. The dual is max⁡α ∑iαi−12∑i,jαiαjyiyj xi⊤xj subject to 0≤αi≤C and ∑iαiyi=0. This is the hard-margin dual with an upper bound C. Data enter only through xi⊤xj, so we can replace it with a kernel k(xi,xj).
  5. Complementary slackness gives three cases. αi=0: yif(xi)≥1 (outside the margin, not a support vector). 0<αi<C: ξi=0 and yif(xi)=1 (on the margin). αi=C: μi=0, so ξi≥0 and yif(xi)≤1 (inside the margin or misclassified).
  6. Recover b from any margin support vector (0<αi<C): b=yi−∑jαjyjxj⊤xi. Averaging over all of them is more stable.

Common mistakes

How long your answer should be

One page; 7–8 minutes.

Last checked on 4 December 2026.

Read this

Previous in Supervised learning: A 1-D training set has x=1 with label −1, and x=3 and x=4 with label +1. What are the hard-margin SVM w, b and the dual variables αi, and which points are support vectors?
Next in Supervised learning: The SVM objective λ2∥w∥2+1n∑imax⁡(0,1−yiw⊤xi) is minimised by stochastic subgradient descent (Pegasos) with step ηt=1/(λt). With λ=0.5 and w0=0, what is the result of running three steps on the single points (x,y)=((1,2),+1), ((−1,0),−1) and ((0,−1),+1), in that order, and what is the update rule?