What is the closed-form solution of ridge regression, , and, using the singular value decomposition , which directions does ridge shrink the most?
Supervised learning, Regularisation
Level L3 Intermediate. Length Medium. Nature Mat Mathematical.
What's being asked
Whether you can derive the ridge solution and explain it as shrinking the least-squares fit most along the directions where the data varies least.
Key idea
. With the SVD, the fitted values are . Each direction is shrunk by the factor , which is smallest where the singular value is small.
Steps
- Set the gradient to zero: , so . Here is the penalty strength.
- Explain why the inverse always exists. In the SVD, and have orthonormal columns and is diagonal with singular values . The eigenvalues of are , so those of are . A matrix with no zero eigenvalue is invertible.
- Substitute the SVD: , so .
- Fitted values: . For plain least squares () every factor would be 1, so these factors are exactly the shrinkage.
- Interpret. A small means the inputs vary little along that direction, so least squares is unreliable there (high variance). Ridge shrinks exactly those directions most. The effective number of parameters is , which falls from towards 0 as grows.
Common mistakes
- Penalising the intercept. Centre and first, or leave out of the penalty.
- Forgetting to standardise the features. The penalty treats all weights alike, so it depends on the units of each feature.
- Saying ridge sets coefficients exactly to zero. It shrinks them but does not remove features.
How long your answer should be
Half a page; about 5 minutes.
Last checked on 4 December 2026.
Read this
- The Elements of Statistical Learning (ESL): Free PDF. Section 3.4.1 (Ridge Regression), pp. 61-68: closed form (3.44), the SVD view X*beta_ridge = sum_j u_j d_j^2/(d_j^2+lambda) u_j^T y in eq. (3.47), shrinkage of low-variance principal directions, and effective degrees of freedom (3.50).
- Murphy, Probabilistic Machine Learning: An Introduction: Free PDF. Section 11.3.2 (Connection between ridge regression and PCA), p. 383: the same SVD shrinkage argument in Murphy's notation, with a figure.
- NPTEL: Introduction to Machine Learning (IIT Madras, Prof. Balaraman Ravindran): Week 2, Shrinkage Methods, which covers ridge regression and how it shrinks coefficients.
Previous in Supervised learning: How do you derive the normal equations for least-squares linear regression? When is singular, what do you do then, and what is a concrete example of a singular design?
Next in Supervised learning: Why does the lasso give coefficients that are exactly zero while ridge does not? When the design is orthonormal (), what is the lasso solution and how does it compare with ridge?