38.3: Pseudoinverso
- Page ID
- 115576
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)En esta clase solemos hablar de resolver problemas de la forma:
\[Ax = b \nonumber \]
Actualmente hemos determinado que este problema se vuelve muy agradable cuando la\(n \times n\) matriz\(A\) tiene una inversa. Podemos multiplicar fácilmente cada lado por el inverso:
\[A^{-1}Ax = A^{-1}b \nonumber \]
Dado que\(A^{-1}A = I\) la solución para\(x\) es simplemente:
\[x = A^{-1}b \nonumber \]
Ahora bien, consideremos un problema más general donde la\(m \times n\) matriz no\(A\) es cuadrada, es decir,\(m \neq n\) y su rango\(r\) tal vez menor que\(m\) y/o\(n\). En este caso queremos encontrar un Pseudoinverso (que denotamos como\(A^+\)) que actúa como un inverso para una matriz no cuadrada. En otras palabras queremos encontrar un\(A^+\) para\(A\) tal que:
\[A^+A \approx I \nonumber \]
Suponiendo que podamos encontrar la\(n \times m\) matriz\(A^+\), entonces deberíamos poder resolver de la\(x\) siguiente manera:
\[Ax = b \nonumber \]
\[A^+Ax = A^+b \nonumber \]
\[x \approx A^+b \nonumber \]
¿Cómo sabemos que hay un Pseudoinverso
Asumiendo el caso general de una\(m \times n\) matriz\(A\) donde su rango\(r\) tal vez sea menor que\(m\) y/o\(n\) (\(r\leq m\)y\(r\leq n\)). Podemos concluir lo siguiente sobre los espacios fundamentales de\(A\):
- El espacio de filas de\(A\) está adentro\(R^n\) con dimensión\(r\)
- El columnespacio de\(A\) está adentro\(R^m\) también con dimensión\(r\).
- El espacio nulo de\(A\) está en\(R^n\) con dimensión\(n−r\)
- El espacio nulo de\(A^{\top}\) está adentro\(R^m\) con dimensión\(m−r\).
Debido a que el espacio de filas\(A\) y el espacio de columna\(A\) tienen la misma dimensión, entonces\(A\) es un mapeo uno a uno del espacio de filas al espacio de columnas. En otras palabras:
- Para cualquiera\(x\) en el espacio de filas, tenemos que\(Ax\) es un punto en el espacio de columnas. Si\(x'\) es otro punto en el espacio de fila diferente de\(x\), tenemos\(Ax\neq Ax'\) (El mapeo es uno a uno).
- Para cualquiera\(y\) en el columnspace, podemos encontrar\(x\) en el espacio de filas tal que\(Ax=y\) (El mapeo está en).
Lo anterior no es realmente una prueba pero ojalá haya suficiente información para convencerse de que esto es cierto.
Cómo calcular pseudoinverso
Queremos encontrar la\(n \times m\) matriz que mapea del espacio de columnas al espacio de filas de\(A\), y\(x=A^+Ax\), si\(x\) está en el espacio de filas.
- Apliquemos SVD en\(A\):\(A= U\Sigma V^\top\), donde\(U\) es una\(m \times m\) matriz,\(V^{\top}\) es una\(n \times n\) matriz, y\(\Sigma\) es una\(m \times n\) matriz diagonal. Podemos descomponer las matrices como\(A = \begin{bmatrix}\vdots & \vdots \\ U_1 & U_2 \\ \vdots &\vdots\end{bmatrix} \begin{bmatrix}\Sigma_1 & 0 \\ 0 & 0\end{bmatrix} \begin{bmatrix}\cdots & V_1^\top & \cdots \\ \cdots & V_2^\top &\cdots \end{bmatrix}\). Aquí\(U_1\) es de\(m \times r\),\(U_2\) es de\(m \times (m-r)\),\(\Sigma_1\) es de\(r \times r\),\(V_1^{\top}\) es de\(r \times n\), y\(V_2^{\top}\) es de\((n-r) \times n\).
- El columnspace de\(U_1\) es el columnspace de\(A\), y columnspace de\(U_2\) es el espacio nullspace de\(A^{\top}\).
- El espacio de filas de\(V_1\) es el espacio de filas de\(A\), y el espacio de filas de\(V_2\) es el espacio nulo de\(A\).
- Si\(x\) está en el espacio de filas de\(A\), tenemos eso\(V_2^{\top}x = 0\). Tenemos\(Ax = U_1 \Sigma_1 V_1^{\top}x\).
- Si definimos una matriz\(B=V_1\Sigma_1^{-1}U_1^\top\), la tenemos\(BAx=V_1\Sigma_1^{-1}U_1^\top U_1\Sigma_1 V_1^\top x=V_1V_1^\top x\). Eso es\(BAx=x\)\(x\) está en el espacio de filas de\(A\).
- La matriz\(B\) es la pseudoinversa de la matriz\(A\). \(A^+ = V_1\Sigma_1^{-1}U_1^\top\)\(A^+ = \begin{bmatrix}\vdots & \vdots \\ V_1 & V_2 \\ \vdots &\vdots\end{bmatrix} \begin{bmatrix}\Sigma_1^{-1} & 0 \\ 0 & 0\end{bmatrix} \begin{bmatrix}\cdots & U_1^\top & \cdots \\ \cdots & U_2^\top &\cdots \end{bmatrix}\).
Vamos\(A=[1,2]\), sabemos que\(r=m=1\) y\(n=2\).
Calcular la pseudoinversa\(A^+\) de\(A\) usar la función numpy.linalg
pinv
:
Computación\(AA^{+}\) y\(A^{+}A\)
Si\(x\) está en el espacio nulo de\(A\) ¿cuál es el efecto\(A^{+}Ax\)?
Si\(x\) está en el espacio de filas de\(A\) ¿cuál es el efecto\(A^{+}Ax\)?
La inversa izquierda es pseudoinversa
Podemos calcular el inverso izquierdo de\(A\) if\(r = n \leq m\). En este caso, podemos tener más filas que columnas, y la matriz\(A\) tiene rango de columna completo.
En este caso, la SVD de\(A\) es\(A = U \Sigma V^{\top}\). Aquí\(U\) es de\(m \times n\),\(\Sigma\) es de\(n \times n\) y no singular,\(V^{\top}\) es de\(n \times n\). El pseudoinverso de\(A\) es\(A^+ = V\Sigma^{-1}U^\top\).
El inverso izquierdo de\(A\) es\((A^\top A)^{-1}A^\top= (V\Sigma U^\top U\Sigma V^\top )^{-1} V\Sigma U^\top = V(\Sigma \Sigma )^{-1} V^\top V\Sigma U^\top = V\Sigma ^{-1} U^\top =A^+\).
Vamos\(A=\begin{bmatrix}1\\2\end{bmatrix}\), sabemos que\(r=n=1\) y\(m=2\). Entonces tenemos el inverso izquierdo.
Calcular la pseudoinversa\(A^{\top}\) de\(A\).
Calcular el inverso izquierdo de\(A\), y verificar que es lo mismo que\(A^{\top}\).