Salta al contenuto
Note per Studenti Pseudoinverse and SVD for Rank-Deficient Least Squares Report

Pseudoinverse and SVD for Rank-Deficient Least Squares

In questa pagina 3

The problem

In linear least squares (Least Squares Estimation - Linear and Weighted Least SquaresThe least squares estimator minimises the sum of squared deviations between observed and predicted outputs; for models linear in the parameters it has a closed form given by the normal equation, extended to weighted least squares and illustrated on a straight-line fit and on a DC motor.Least Squares Estimation - Linear and Weighted Least Squares →) the normal equation is ΦTΦθ=ΦTy\Phi^T\Phi\theta=\Phi^Ty. It has the form Ax=b,x∈Rm, A∈Rn×m,Ax=b,\qquad x\in\mathbb R^m,\ A\in\mathbb R^{n\times m}, with A=ΦTΦA=\Phi^T\Phi, x=θx=\theta, b=ΦTyb=\Phi^Ty. What to do if ΦTΦ\Phi^T\Phi is not invertible? If AA is not invertible we can use the following procedure to "solve it": min⁡x∥Ax−b∥2.\min_x\lVert Ax-b\rVert^2.

Overview of the SVD (singular value decomposition)

For every A∈Rm×nA\in\mathbb R^{m\times n} there exist unique matrices U,Σ,VU,\Sigma,V (up to a permutation of columns) such that U,VU,V are orthogonal, Σ∈Rm×n\Sigma\in\mathbb R^{m\times n} is "diagonal" (a diagonal block plus zero blocks), and A=UΣVT.A=U\Sigma V^T. (Reminder: orthogonal means UT=U−1U^T=U^{-1}.)

  • The nonzero (diagonal) elements of Σ\Sigma are called singular values and usually they are arranged in decreasing order.
  • Let r=rank⁡(A)≤min⁡(n,m)r=\operatorname{rank}(A)\le\min(n,m). Define U1,Σ1,V1U_1,\Sigma_1,V_1 as the first rr columns of U,Σ,VU,\Sigma,V (Σ1\Sigma_1 is the r×rr\times r block with the nonzero singular values). They keep all the information about AA: A=U1Σ1V1T.A=U_1\Sigma_1V_1^T.

Pseudoinverse. The pseudoinverse of AA is A+=V1Σ1−1U1T.A^+=V_1\Sigma_1^{-1}U_1^T.

  • The board writes AA+=ImAA^+=I_m and A+A=InA^+A=I_n (these hold in the full-rank situations; they cannot both hold for a rank-deficient matrix).
  • If A−1A^{-1} exists, then A+=A−1A^+=A^{-1}.
  • If (ATA)−1(A^TA)^{-1} exists, then (ATA)−1AT=A+(A^TA)^{-1}A^T=A^+.

Least squares with the pseudoinverse

θ^LS(y)=arg⁡min⁡θ∥y−Φθ∥2\hat\theta^{LS}(y)=\arg\min_\theta\lVert y-\Phi\theta\rVert^2 Claim: the solution given by θ^LS(y)=Φ+y\hat\theta^{LS}(y)=\Phi^+y is the minimal-norm solution.

If ΦTΦ\Phi^T\Phi is not invertible, all solutions are in the set Θ={θ: ΦTΦθ=ΦTy},\Theta=\{\theta:\ \Phi^T\Phi\theta=\Phi^Ty\}, and we focus on arg⁡min⁡θ∈Θ∥θ∥2\arg\min_{\theta\in\Theta}\lVert\theta\rVert^2.

Step 1: rewrite the cost with the SVD. Φ=U1Σ1V1T=UΣVT\Phi=U_1\Sigma_1V_1^T=U\Sigma V^T and U=[ U1  U2 ]U=[\,U_1\ \ U_2\,] with U1U_1 having rr columns. If a matrix AA is orthogonal, ∥Ax∥2=∥x∥2\lVert Ax\rVert^2=\lVert x\rVert^2, so multiplying by UTU^T does not change the norm: ∥y−Φθ∥2=∥y−U1Σ1V1Tθ∥2=∥UT(y−U1Σ1V1Tθ)∥2=∥(U1TU2T)(y−U1Σ1V1Tθ)∥2\lVert y-\Phi\theta\rVert^2=\lVert y-U_1\Sigma_1V_1^T\theta\rVert^2=\big\lVert U^T\big(y-U_1\Sigma_1V_1^T\theta\big)\big\rVert^2=\left\lVert\begin{pmatrix}U_1^T\\U_2^T\end{pmatrix}\big(y-U_1\Sigma_1V_1^T\theta\big)\right\rVert^2 =∥(U1Ty−U1TU1Σ1V1TθU2Ty−U2TU1Σ1V1Tθ)∥2.=\left\lVert\begin{pmatrix}U_1^Ty-U_1^TU_1\Sigma_1V_1^T\theta\\U_2^Ty-U_2^TU_1\Sigma_1V_1^T\theta\end{pmatrix}\right\rVert^2. Because UTU=IU^TU=I we have U1TU1=IU_1^TU_1=I and U2TU1=0U_2^TU_1=0, so =∥(U1Ty−Σ1V1TθU2Ty)∥2=∥U1Ty−Σ1V1Tθ∥2+∥U2Ty∥2.=\left\lVert\begin{pmatrix}U_1^Ty-\Sigma_1V_1^T\theta\\U_2^Ty\end{pmatrix}\right\rVert^2=\lVert U_1^Ty-\Sigma_1V_1^T\theta\rVert^2+\lVert U_2^Ty\rVert^2. The second term does not depend on θ\theta ("who cares"). The first term can be minimised by carefully choosing θ\theta: it is zero if U1Ty=Σ1V1Tθ.U_1^Ty=\Sigma_1V_1^T\theta.

Step 2: all the solutions of this equation are θ=V1Σ1−1U1Ty+z,z∈Ker⁡(V1T).\theta=V_1\Sigma_1^{-1}U_1^Ty+z,\qquad z\in\operatorname{Ker}(V_1^T). Check: U1Ty=Σ1V1T(V1Σ1−1U1Ty+z)=Σ1V1TV1Σ1−1U1Ty+Σ1V1Tz=U1TyU_1^Ty=\Sigma_1V_1^T\big(V_1\Sigma_1^{-1}U_1^Ty+z\big)=\Sigma_1V_1^TV_1\Sigma_1^{-1}U_1^Ty+\Sigma_1V_1^Tz=U_1^Ty, using V1TV1=IV_1^TV_1=I and V1Tz=0V_1^Tz=0.

Step 3: the norm. Since Ker⁡(V1T)=Im⁡V2\operatorname{Ker}(V_1^T)=\operatorname{Im}V_2, write z=V2z~z=V_2\tilde z. Then ∥θ∥2=∥V1Σ1−1U1Ty+z∥2=∥V1Σ1−1U1Ty+V2z~∥2=∥V1Σ1−1U1Ty∥2+∥V2z~∥2,\lVert\theta\rVert^2=\lVert V_1\Sigma_1^{-1}U_1^Ty+z\rVert^2=\lVert V_1\Sigma_1^{-1}U_1^Ty+V_2\tilde z\rVert^2=\lVert V_1\Sigma_1^{-1}U_1^Ty\rVert^2+\lVert V_2\tilde z\rVert^2, because V1⊥V2V_1\perp V_2.

Conclusion. If we choose z~=0\tilde z=0, corresponding to z=0z=0, we obtain θ=V1Σ1−1U1Ty=Φ+y,\theta=V_1\Sigma_1^{-1}U_1^Ty=\Phi^+y, and the squared norm of θ\theta is the smallest among all the least squares solutions.

Versione ripasso

  • If ΦTΦ\Phi^T\Phi is not invertible, the normal equation Ax=bAx=b (A=ΦTΦA=\Phi^T\Phi, x=θx=\theta, b=ΦTyb=\Phi^Ty) is attacked with min⁡x∥Ax−b∥2\min_x\lVert Ax-b\rVert^2.
  • SVD: A=UΣVTA=U\Sigma V^T, U,VU,V orthogonal (UT=U−1U^T=U^{-1}), Σ\Sigma "diagonal" with the singular values in decreasing order. With r=rank⁡Ar=\operatorname{rank}A: A=U1Σ1V1TA=U_1\Sigma_1V_1^T (first rr columns). Pseudoinverse A+=V1Σ1−1U1TA^+=V_1\Sigma_1^{-1}U_1^T; A+=A−1A^+=A^{-1} if the inverse exists; (ATA)−1AT=A+(A^TA)^{-1}A^T=A^+ if ATAA^TA is invertible.
  • Result: θ^LS=Φ+y\hat\theta^{LS}=\Phi^+y is the minimal-norm least squares solution.
  • Derivation: orthogonal UU preserves norms, so ∥y−Φθ∥2=∥U1Ty−Σ1V1Tθ∥2+∥U2Ty∥2\lVert y-\Phi\theta\rVert^2=\lVert U_1^Ty-\Sigma_1V_1^T\theta\rVert^2+\lVert U_2^Ty\rVert^2 (second term constant). Zeroing the first: θ=V1Σ1−1U1Ty+z\theta=V_1\Sigma_1^{-1}U_1^Ty+z, z∈Ker⁡V1T=Im⁡V2z\in\operatorname{Ker}V_1^T=\operatorname{Im}V_2. Since V1⊥V2V_1\perp V_2, ∥θ∥2=∥V1Σ1−1U1Ty∥2+∥V2z~∥2\lVert\theta\rVert^2=\lVert V_1\Sigma_1^{-1}U_1^Ty\rVert^2+\lVert V_2\tilde z\rVert^2, minimal at z=0z=0.

Teoria collegata