QR factorization & Regularized Least Squares

1.1k Views Asked by At

Given regularized-least squares

$$\min_x ||Ax - b||^2+ \lambda||x||^2 $$

How do you use QR decomposition to find a solution?

I understand that QR decomposition leads to $Rx = Q^Tb$, but how do you incorporate $\lambda||x||^2$?

Following the suggestions and solutions I have: $$ \begin{align} (Ax-b)^T(Ax-b) + \lambda x^Tx &= x^T(A^TA+\lambda I)x - 2b^TAx+b^Tb \\ (take \ derivative) &= 2(A^TA+\lambda I)x - 2A^Tb = 0 \\ &= (A^TA+\lambda I)x = A^Tb \\ &= ((QR)^TQR + \lambda I)x = (QR)^Tb \\ &= (R^TR + \lambda I)x = R^TQ^Tb\\ &= x = (R^TR+ \lambda I)^{-1} R^TQ^Tb \\ \end{align}$$

1

There are 1 best solutions below

6
On

Note that the objective is $(Ax-b)^T(Ax-b)+ \lambda x^T x = x^T (A^T A +\lambda I) x - 2 b^T Ax + b^Tb$. Taking the derivative yields $2(A^TA+\lambda I)x - 2 A^Tb = 0$, or $(A^TA+\lambda I)x = A^Tb$. Hence $x=(A^TA+\lambda I)^{-1}A^Tb$. The trick is now to take a QR decomposition of $A^TA+\lambda I$ (instead of just $A^TA$), so you can write $x=R^{-1}Q^TA^Tb$.