Why Derive Ridge With the SVD?
When the number of predictors exceeds the number of observations, or when predictors are linearly dependent, the design matrix does not have full column rank. In that situation, ordinary least squares cannot uniquely determine every coefficient: multiple coefficient vectors can give the same fitted values. Ridge regression adds a positive penalty to the least-squares objective. The singular value decomposition (SVD) makes explicit how this changes the coefficient calculation and why the resulting estimate is unique.
The derivation below concerns the coefficient vector for a fixed positive penalty parameter. It does not choose that parameter. As in the earlier material on Predictor Scaling Before Penalization, the predictor scale matters: the penalty acts on the coefficients as represented in the design matrix. For clarity, treat any intercept separately and do not penalize it; equivalently, the response and predictors can first be adjusted for the intercept. The matrix \(X\) below is the design matrix for the coefficients being penalized.
The assumptions needed for the algebra are modest: \(X\) and \(y\) are finite real-valued matrices/vectors of compatible dimensions, and \(\lambda\) is strictly positive. No full-rank assumption on \(X\) is required. A statistical model such as \(y=X\beta+\varepsilon\) can be used to motivate the fit, but the existence and uniqueness result below follows directly from the objective and does not require normally distributed errors.
From the Penalized Normal Equations to the SVD
Differentiate \(Q(\beta)\) with respect to \(\beta\). Setting its gradient to zero gives the penalized normal equations:
For ordinary least squares, \(X^\mathsf{T}X\) is singular when \(X\) is rank deficient, so it cannot be inverted to obtain a unique coefficient vector. Ridge adds \(\lambda I_p\). For any nonzero \(z\in\mathbb{R}^p\),
The inequality holds because \(\|Xz\|_2^2\geq 0\), \(\|z\|_2^2>0\), and \(\lambda>0\). Thus \(X^\mathsf{T}X+\lambda I_p\) is positive definite and invertible. The objective is strictly convex, so its minimizer is unique, regardless of the rank of \(X\).
To write that minimizer in SVD form, let \(r=\operatorname{rank}(X)\) and use the compact SVD \(X=U_rD_rV_r^\mathsf{T}\). The columns of \(U_r\in\mathbb{R}^{n\times r}\) and \(V_r\in\mathbb{R}^{p\times r}\) are orthonormal, and \(D_r=\operatorname{diag}(d_1,\ldots,d_r)\), where every singular value \(d_j\) is positive. Substitution into the penalized normal equations gives the expression below.
One way to verify the last line is to substitute it into the normal equations. Multiplication by \(X^\mathsf{T}X+\lambda I_p\) applies \(d_j^2+\lambda\) to the coefficient along each column of \(V_r\), canceling its denominator and leaving \(V_rD_rU_r^\mathsf{T}y=X^\mathsf{T}y\). Components in the null space of \(X\), which are orthogonal to the columns of \(V_r\), are zero in this solution. The positive penalty makes any nonzero such component increase the objective without changing the fitted values.
Worked SVD Calculations
Worked Example: A Rank-Deficient Design With a Coefficient of 0.8
Consider the hypothetical design and response \(X=\begin{bmatrix}2&0&0\\0&1&0\end{bmatrix}\) and \(y=(2,1)^\mathsf{T}\), with \(\lambda=1\). The third column is zero, so \(X\) has rank 2 although it has 3 columns. Its compact SVD has \(U_r=I_2\), \(D_r=\operatorname{diag}(2,1)\), and \(V_r\) consisting of the first two coordinate vectors in \(\mathbb{R}^3\).
The SVD formula gives the first coefficient as \(2/(2^2+1)\times 2=4/5=0.8\), and the second as \(1/(1^2+1)\times 1=1/2=0.5\). The third coefficient is zero because its direction is in the null space of \(X\). Thus \(\hat{\beta}_{\mathrm{ridge}}=(0.8,0.5,0)^\mathsf{T}\).
The fitted response is \(X\hat{\beta}_{\mathrm{ridge}}=(1.6,0.5)^\mathsf{T}\), so the residual is \((0.4,0.5)^\mathsf{T}\). The residual sum of squares is \(0.4^2+0.5^2=0.41\), and the penalty contribution before multiplying by \(\lambda/2\) is \(0.8^2+0.5^2+0^2=0.89\). Therefore \(Q(\hat{\beta}_{\mathrm{ridge}})=0.41/2+0.89/2=0.65\). The estimate is unique even though the unpenalized least-squares coefficient for the zero column could be arbitrary.
Worked Example: Two Identical Predictors
Suppose the hypothetical design has two identical columns, \(X=\begin{bmatrix}1&1\\2&2\end{bmatrix}\), with \(y=(1,0)^\mathsf{T}\) and \(\lambda=2\). This matrix has rank 1. Its nonzero singular value is \(\sqrt{10}\), with left singular vector \(u=(1,2)^\mathsf{T}/\sqrt{5}\) and right singular vector \(v=(1,1)^\mathsf{T}/\sqrt{2}\).
First, \(u^\mathsf{T}y=1/\sqrt{5}\). The SVD coefficient vector is therefore \(v\{\sqrt{10}/(10+2)\}(1/\sqrt{5})\). Since \(\sqrt{10}/\sqrt{5}=\sqrt{2}\), this equals \((1,1)^\mathsf{T}/12\). Each estimated coefficient is \(1/12\).
The fitted values are \((1/6,1/3)^\mathsf{T}\), and the residuals are \((5/6,-1/3)^\mathsf{T}\). Hence the residual sum of squares is \(25/36+1/9=29/36\), while \(\|\hat{\beta}_{\mathrm{ridge}}\|_2^2=2/144=1/72\). The objective value is \((29/36)/2+(2/2)(1/72)=29/72+1/72=5/12\). Without the penalty, the data identify the sum of the two coefficients but not their separate values. Ridge gives a unique pair because the penalty distinguishes coefficient vectors with different squared lengths.
Worked Example: A Response Component Outside the Column Space
Take the hypothetical matrix \(X=\operatorname{diag}(2,1,0)\), response \(y=(2,1,3)^\mathsf{T}\), and \(\lambda=1\). The rank is 2. The nonzero singular values are 2 and 1, with left and right singular vectors equal to the first two coordinate vectors. The third response component is orthogonal to the column space of \(X\).
The coefficient calculation is \(2(2)/(4+1)=0.8\) for the first coordinate and \(1(1)/(1+1)=0.5\) for the second. The third coefficient is zero, so \(\hat{\beta}_{\mathrm{ridge}}=(0.8,0.5,0)^\mathsf{T}\) and the fitted values are \((1.6,0.5,0)^\mathsf{T}\). The residual is \((0.4,0.5,3)^\mathsf{T}\); the component 3 cannot be fitted by any coefficient vector because the third row of \(X\) is zero.
The residual sum of squares is \(0.16+0.25+9=9.41\), and the squared coefficient length is \(0.64+0.25=0.89\). Thus \(Q=9.41/2+0.89/2=5.15\). The example separates two facts: ridge resolves coefficient nonuniqueness, but it cannot fit a response component outside the column space of the design.
Assumptions, Diagnostics, and Alternatives
The unique-solution result requires only \(\lambda>0\) and a finite design matrix. It does not assert that ridge coefficients are unbiased estimates of an underlying parameter, nor that the chosen penalty is suitable for prediction. Those are separate questions. The formula also depends on the stated objective: using a different scaling of the residual term changes the numerical meaning of \(\lambda\), unless the penalty is rescaled accordingly.
A practical calculation should check that the fit used the intended \(\lambda\), applied the penalty to the intended coefficients, and treated the intercept consistently. In numerical software, singular values very close to zero can be sensitive to floating-point precision; a reported numerical rank depends on the tolerance used. This does not invalidate the mathematical formula, but it can affect computed SVD components. Confirm that the singular values and design dimensions are plausible, and compare the SVD solution with a direct solve of \((X^\mathsf{T}X+\lambda I_p)\hat{\beta}=X^\mathsf{T}y\) on a small problem.
The ordinary least-squares solution is the main contrast. When \(X\) has full column rank, it is uniquely given by \((X^\mathsf{T}X)^{-1}X^\mathsf{T}y\); when \(X\) is rank deficient, least-squares fitted values remain defined but the coefficient vector is not unique. The Moore–Penrose pseudoinverse selects the least-squares coefficient vector of smallest Euclidean length. Ridge instead solves a penalized objective for a positive \(\lambda\), giving a unique coefficient vector. A truncated SVD is another possible approach: it discards selected small-singular-value components, whereas ridge retains the nonzero SVD components with modified factors. These approaches answer related but not identical estimation questions.
A frequent error is to say, “\(X^\mathsf{T}X\) is singular, so ridge cannot be computed.” That reasoning overlooks the penalty term. The matrix that must be inverted is \(X^\mathsf{T}X+\lambda I_p\), not \(X^\mathsf{T}X\) alone, and for every \(\lambda>0\) it is positive definite. A different error is to set \(\lambda=0\) while still claiming ridge has produced a unique solution. At \(\lambda=0\), the objective is ordinary least squares and rank deficiency again allows multiple coefficient vectors. As \(\lambda\) decreases toward zero, the ridge solution approaches the minimum-length least-squares solution, but that limiting statement does not make the \(\lambda=0\) coefficient unique in general.
Check Your Understanding
Answer each question, then compare with the solutions below.
- For \(X\in\mathbb{R}^{n\times p}\), what condition on \(\lambda\) ensures that \(X^\mathsf{T}X+\lambda I_p\) is positive definite, even if \(X\) is rank deficient?
- If the nonzero singular value is \(d=3\), the corresponding component of \(U_r^\mathsf{T}y\) is 2, and \(\lambda=3\), what is the corresponding SVD coefficient multiplier and coefficient component?
- Why does a zero column of \(X\) have a zero ridge coefficient when \(\lambda>0\)?
- Does a unique ridge coefficient vector imply that every response value can be fitted exactly? Explain.
Solutions. (1) Require \(\lambda>0\): for any nonzero \(z\), \(z^\mathsf{T}(X^\mathsf{T}X+\lambda I_p)z=\|Xz\|_2^2+\lambda\|z\|_2^2>0\). (2) The multiplier is \(d/(d^2+\lambda)=3/(9+3)=1/4\); multiplying by the response component 2 gives coefficient component \(1/2\). (3) A zero column contributes nothing to \(X\beta\), but a nonzero coefficient for it increases \(\lambda\|\beta\|_2^2/2\), so the unique minimizer sets it to zero. (4) No. Fitted values must belong to the column space of \(X\); a response component outside that space remains in the residual even though the penalized coefficient minimizer is unique.