Take an orthonormal design (X⊤X=I) with noise variance σ2. For one coefficient with true value β, find the mean squared error of the ridge estimate β^/(1+λ) as a function of λ. Show that some λ>0 always beats OLS, find the best λ, and evaluate it for σ2=1, β=2. Why is this not a free lunch?

Supervised learning, Ridge regression
Level L3 Intermediate. Length Long. Nature Mat Mathematical.

What's being asked

The classic result that a biased estimator can have lower MSE: the derivative of the MSE at λ=0 is negative.

Key idea

The MSE is bias2+variance=λ2β2+σ2(1+λ)2. At λ=0 its slope is −2σ2<0, so a little shrinkage always helps. The best λ is σ2/β2.

Steps

  1. With X⊤X=I, OLS is β^=X⊤y with β^j∼N(βj,σ2), and ridge is β^j/(1+λ).
  2. Bias: E[β^/(1+λ)]−β=−λβ/(1+λ). Variance: σ2/(1+λ)2.
  3. MSE(λ)=λ2β2+σ2(1+λ)2. At λ=0 it is σ2 (OLS).
  4. Differentiate: the numerator of the derivative is 2λβ2(1+λ)−2(λ2β2+σ2)=2(λβ2−σ2), divided by (1+λ)3. At λ=0 it is −2σ2<0, so MSE falls for small λ>0. It is zero at λ∗=σ2/β2 and positive beyond it.
  5. Optimum: MSE∗=σ2β2β2+σ2, which is less than σ2. For σ2=1, β=2: λ∗=0.25 and MSE∗=4/5=0.8, against 1 for OLS.
  6. For a general design the same argument applies in the eigenbasis of X⊤X. Ridge improves total MSE for small λ whatever the true β (Hoerl–Kennard).
  7. Not a free lunch: λ∗ depends on the unknown β, so you must choose λ by cross-validation. The gain is largest when the signal is weak relative to the noise (β2≲σ2) and it vanishes as β2/σ2→∞.

Common mistakes

How long your answer should be

One page; 8–10 minutes.

Last checked on 4 December 2026.

Read this

Previous in Supervised learning: Show that ridge regression is the MAP (maximum a posteriori) estimate under a Gaussian prior, and lasso under a Laplace prior, when the noise is Gaussian. If the noise variance is σ2=2 and the prior is βj∼N(0,τ2) with τ2=0.5, what ridge λ does this give?
Next 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?