Write the optimality (KKT) conditions for the lasso min⁡β12∥y−Xβ∥2+λ∥β∥1. Using them, what is the smallest λ at which β^=0, and how do you verify that β^=(1.5,0) is the solution for X=I2, y=(3,1), λ=1.5?

Supervised learning, Lasso
Level L5 Expert. Length Long. Nature Mat Mathematical.

What's being asked

Subgradient optimality for a convex but non-smooth objective, and its use to read off the entry point and active set.

Key idea

The condition is xj⊤(y−Xβ^)=λsign⁡(β^j) if β^j≠0, and ∣xj⊤(y−Xβ^)∣≤λ if β^j=0. So β^=0 iff λ≥∥X⊤y∥∞.

Steps

  1. The objective is convex, so β^ is optimal iff 0 is in the subdifferential: −X⊤(y−Xβ^)+λs=0, where sj=sign⁡(β^j) if β^j≠0 and sj∈[−1,1] if β^j=0. (The subdifferential of ∣βj∣ at 0 is the interval [−1,1].)
  2. Rewrite with the residual r=y−Xβ^: xj⊤r=λsj. Active variables have correlation exactly ±λ with the residual and inactive variables have correlation at most λ in absolute value.
  3. Entry point: at β^=0, r=y and the condition becomes ∣xj⊤y∣≤λ for all j. So λmax⁡=max⁡j∣xj⊤y∣=∥X⊤y∥∞. For y=(3,1) and X=I, λmax⁡=3.
  4. Verify the example: β^=(1.5,0) gives r=(3−1.5,1)=(1.5,1). For j=1: x1⊤r=1.5=λ⋅sign⁡(1.5). Good. For j=2: ∣x2⊤r∣=1≤1.5. Good. So both conditions hold and, by convexity, it is the global minimiser.
  5. Cross-check with soft-thresholding: sign⁡(3)(3−1.5)+=1.5 and (1−1.5)+=0.
  6. Consequence: the active set has at most min⁡(n,p) variables in general, and the path is piecewise linear in λ, which is what LARS exploits. If the columns are in general position, the lasso solution is unique.

Common mistakes

How long your answer should be

One page; 8 minutes.

Last checked on 4 December 2026.

Read this

Previous in Supervised learning: For two classes, how do you derive the asymptotic error of the 3-nearest-neighbour rule as a function of the posterior η(x), and how do you show that it is never worse than the 1-NN rule at every x? What are the errors of both rules when the local Bayes error is r=0.1?
Next in Supervised learning: Prove the Gauss–Markov theorem: under y=Xβ+ε with E[ε]=0, Cov⁡(ε)=σ2I and X of full column rank, the OLS estimator has the smallest covariance matrix among all linear unbiased estimators. Why does this not rule out ridge regression doing better in MSE?