What is the closed-form solution of ridge regression?

Last updated 3 November 2026

  • Setting the gradient to zero gives ŵ = (XᵀX + λI)⁻¹Xᵀy. The Hessian is positive definite, so this is the unique global minimum for λ > 0.

  • In SVD terms each direction is shrunk by dᵢ²/(dᵢ² + λ) relative to OLS, so low-variance directions shrink most.

  • Center data to leave the intercept unpenalized, use a linear solve instead of an explicit inverse, and use the dual Xᵀ(XXᵀ + λI)⁻¹y when p ≫ n.

  • https://medium.com/@amitmaurya5033/ridge-lasso-regression-30-interview-questions-with-follow-ups-8a13d23e0ce2
  • https://www.geeksforgeeks.org/machine-learning/what-is-ridge-regression/
  • https://www.geeksforgeeks.org/python/stochastic-gradient-descent-classifier/
All Regularization interview questions