Regularization is equivalent to adding a penalty or constraining the solution:
minwL(w) s.t.
∥w∥p≤t. L2 (ridge): penalty
2λ∥w∥22, the constraint set is a ball; the loss contours (data-determined ellipses) touch the sphere at a point where all coordinates are uniformly shrunk but generally nonzero. Closed form:
w∗=(XTX+λI)−1XTy; via SVD
X=UΣVT this becomes
w∗=V(ΣTΣ+λI)−1ΣTUTy, i.e. each eigen-direction is scaled by
σi2+λσi2 — directions with small singular values are shrunk most, and
XTX+λI is always invertible. L1 (lasso): the constraint set
∥w∥1≤t is a diamond (hypercube in higher dims) whose vertices lie exactly on the coordinate axes; the loss ellipse often touches the diamond at a vertex or edge → some coordinates are exactly zero → sparse solutions.