In mathematics, and in particular linear algebra, the Moore–Penrose inverse A + {\displaystyle A^{+}} of a matrix A {\displaystyle A} , often called the pseudoinverse, is the most widely known generalization of the inverse matrix.[1] It was independently described by E. H. Moore in 1920,[2] Arne Bjerhammar in 1951,[3] and Roger Penrose in 1955.[4] Earlier, Erik Ivar Fredholm had introduced the concept of a pseudoinverse of integral operators in 1903. The terms pseudoinverse and generalized inverse are sometimes used as synonyms for the Moore–Penrose inverse of a matrix, but sometimes applied to other elements of algebraic structures which share some but not all properties expected for an inverse element.
A common use of the pseudoinverse is to compute a "best fit" (least squares) approximate solution to a system of linear equations that lacks an exact solution (see below under § Applications). Another use is to find the minimum (Euclidean) norm solution to a system of linear equations with multiple solutions. The pseudoinverse facilitates the statement and proof of results in linear algebra.
The pseudoinverse is defined and unique for all matrices whose entries are real or complex numbers. It can be computed using the singular value decomposition. In the special case where A {\displaystyle A} is a normal matrix (for example, a Hermitian matrix), the pseudoinverse A + {\displaystyle A^{+}} annihilates the kernel of A {\displaystyle A} and acts as a traditional inverse of A {\displaystyle A} on the subspace orthogonal to the kernel.
In the following discussion, the following conventions are adopted.
For A ∈ ∈ --> K m × × --> n {\displaystyle A\in \mathbb {K} ^{m\times n}} , a pseudoinverse of A is defined as a matrix A + ∈ ∈ --> K n × × --> m {\displaystyle A^{+}\in \mathbb {K} ^{n\times m}} satisfying all of the following four criteria, known as the Moore–Penrose conditions:[4][5]
Note that A + A {\displaystyle A^{+}A} and A A + {\displaystyle AA^{+}} are idempotent operators, as follows from ( A A + ) 2 = A A + {\displaystyle (AA^{+})^{2}=AA^{+}} and ( A + A ) 2 = A + A {\displaystyle (A^{+}A)^{2}=A^{+}A} . More specifically, A + A {\displaystyle A^{+}A} projects onto the image of A T {\displaystyle A^{T}} (equivalently, the span of the rows of A {\displaystyle A} ), and A A + {\displaystyle AA^{+}} projects onto the image of A {\displaystyle A} (equivalently, the span of the columns of A {\displaystyle A} ). In fact, the above four conditions are fully equivalent to A + A {\displaystyle A^{+}A} and A A + {\displaystyle AA^{+}} being such orthogonal projections: A A + {\displaystyle AA^{+}} projecting onto the image of A {\displaystyle A} implies ( A A + ) A = A {\displaystyle (AA^{+})A=A} , and A + A {\displaystyle A^{+}A} projecting onto the image of A T {\displaystyle A^{T}} implies ( A + A ) A + = A + {\displaystyle (A^{+}A)A^{+}=A^{+}} .
The pseudoinverse A + {\displaystyle A^{+}} exists for any matrix A ∈ ∈ --> K m × × --> n {\displaystyle A\in \mathbb {K} ^{m\times n}} . If furthermore A {\displaystyle A} is full rank, that is, its rank is min { m , n } {\displaystyle \min\{m,n\}} , then A + {\displaystyle A^{+}} can be given a particularly simple algebraic expression. In particular:
In the more general case, the pseudoinverse can be expressed leveraging the singular value decomposition. Any matrix can be decomposed as A = U D V ∗ ∗ --> {\displaystyle A=UDV^{*}} for some isometries U , V {\displaystyle U,V} and diagonal nonnegative real matrix D {\displaystyle D} . The pseudoinverse can then be written as A + = V D + U ∗ ∗ --> {\displaystyle A^{+}=VD^{+}U^{*}} , where D + {\displaystyle D^{+}} is the pseudoinverse of D {\displaystyle D} and can be obtained by transposing the matrix and replacing the nonzero values with their multiplicative inverses.[6] That this matrix satisfies the above requirement is directly verified observing that A A + = U U ∗ ∗ --> {\displaystyle AA^{+}=UU^{*}} and A + A = V V ∗ ∗ --> {\displaystyle A^{+}A=VV^{*}} , which are the projections onto image and support of A {\displaystyle A} , respectively.
As discussed above, for any matrix A {\displaystyle A} there is one and only one pseudoinverse A + {\displaystyle A^{+}} .[5]
A matrix satisfying only the first of the conditions given above, namely A A + A = A {\textstyle AA^{+}A=A} , is known as a generalized inverse. If the matrix also satisfies the second condition, namely A + A A + = A + {\textstyle A^{+}AA^{+}=A^{+}} , it is called a generalized reflexive inverse. Generalized inverses always exist but are not in general unique. Uniqueness is a consequence of the last two conditions.
Proofs for the properties below can be found at b:Topics in Abstract Algebra/Linear algebra.
The following identity formula can be used to cancel or expand certain subexpressions involving pseudoinverses: A = A A ∗ ∗ --> A + ∗ ∗ --> = A + ∗ ∗ --> A ∗ ∗ --> A . {\displaystyle A={}A{}A^{*}{}A^{+*}{}={}A^{+*}{}A^{*}{}A.} Equivalently, substituting A + {\displaystyle A^{+}} for A {\displaystyle A} gives A + = A + A + ∗ ∗ --> A ∗ ∗ --> = A ∗ ∗ --> A + ∗ ∗ --> A + , {\displaystyle A^{+}={}A^{+}{}A^{+*}{}A^{*}{}={}A^{*}{}A^{+*}{}A^{+},} while substituting A ∗ ∗ --> {\displaystyle A^{*}} for A {\displaystyle A} gives A ∗ ∗ --> = A ∗ ∗ --> A A + = A + A A ∗ ∗ --> . {\displaystyle A^{*}={}A^{*}{}A{}A^{+}{}={}A^{+}{}A{}A^{*}.}
The computation of the pseudoinverse is reducible to its construction in the Hermitian case. This is possible through the equivalences: A + = ( A ∗ ∗ --> A ) + A ∗ ∗ --> , {\displaystyle A^{+}=\left(A^{*}A\right)^{+}A^{*},} A + = A ∗ ∗ --> ( A A ∗ ∗ --> ) + , {\displaystyle A^{+}=A^{*}\left(AA^{*}\right)^{+},}
as A ∗ ∗ --> A {\displaystyle A^{*}A} and A A ∗ ∗ --> {\displaystyle AA^{*}} are Hermitian.
The equality ( A B ) + = B + A + {\displaystyle (AB)^{+}=B^{+}A^{+}} does not hold in general. Rather, suppose A ∈ ∈ --> K m × × --> n , B ∈ ∈ --> K n × × --> p {\displaystyle A\in \mathbb {K} ^{m\times n},\ B\in \mathbb {K} ^{n\times p}} . Then the following are equivalent:[8]
The following are sufficient conditions for ( A B ) + = B + A + {\displaystyle (AB)^{+}=B^{+}A^{+}} :
The following is a necessary condition for ( A B ) + = B + A + {\displaystyle (AB)^{+}=B^{+}A^{+}} :
The fourth sufficient condition yields the equalities ( A A ∗ ∗ --> ) + = A + ∗ ∗ --> A + , ( A ∗ ∗ --> A ) + = A + A + ∗ ∗ --> . {\displaystyle {\begin{aligned}\left(AA^{*}\right)^{+}&=A^{+*}A^{+},\\\left(A^{*}A\right)^{+}&=A^{+}A^{+*}.\end{aligned}}}
Here is a counterexample where ( A B ) + ≠ ≠ --> B + A + {\displaystyle (AB)^{+}\neq B^{+}A^{+}} :
( ( 1 1 0 0 ) ( 0 0 1 1 ) ) + = ( 1 1 0 0 ) + = ( 1 2 0 1 2 0 ) ≠ ≠ --> ( 1 4 0 1 4 0 ) = ( 0 1 2 0 1 2 ) ( 1 2 0 1 2 0 ) = ( 0 0 1 1 ) + ( 1 1 0 0 ) + {\displaystyle {\Biggl (}{\begin{pmatrix}1&1\\0&0\end{pmatrix}}{\begin{pmatrix}0&0\\1&1\end{pmatrix}}{\Biggr )}^{+}={\begin{pmatrix}1&1\\0&0\end{pmatrix}}^{+}={\begin{pmatrix}{\tfrac {1}{2}}&0\\{\tfrac {1}{2}}&0\end{pmatrix}}\quad \neq \quad {\begin{pmatrix}{\tfrac {1}{4}}&0\\{\tfrac {1}{4}}&0\end{pmatrix}}={\begin{pmatrix}0&{\tfrac {1}{2}}\\0&{\tfrac {1}{2}}\end{pmatrix}}{\begin{pmatrix}{\tfrac {1}{2}}&0\\{\tfrac {1}{2}}&0\end{pmatrix}}={\begin{pmatrix}0&0\\1&1\end{pmatrix}}^{+}{\begin{pmatrix}1&1\\0&0\end{pmatrix}}^{+}}
P = A A + {\displaystyle P=AA^{+}} and Q = A + A {\displaystyle Q=A^{+}A} are orthogonal projection operators, that is, they are Hermitian ( P = P ∗ ∗ --> {\displaystyle P=P^{*}} , Q = Q ∗ ∗ --> {\displaystyle Q=Q^{*}} ) and idempotent ( P 2 = P {\displaystyle P^{2}=P} and Q 2 = Q {\displaystyle Q^{2}=Q} ). The following hold:
The last two properties imply the following identities:
Another property is the following: if A ∈ ∈ --> K n × × --> n {\displaystyle A\in \mathbb {K} ^{n\times n}} is Hermitian and idempotent (true if and only if it represents an orthogonal projection), then, for any matrix B ∈ ∈ --> K m × × --> n {\displaystyle B\in \mathbb {K} ^{m\times n}} the following equation holds:[9] A ( B A ) + = ( B A ) + {\displaystyle A(BA)^{+}=(BA)^{+}}
This can be proven by defining matrices C = B A {\displaystyle C=BA} , D = A ( B A ) + {\displaystyle D=A(BA)^{+}} , and checking that D {\displaystyle D} is indeed a pseudoinverse for C {\displaystyle C} by verifying that the defining properties of the pseudoinverse hold, when A {\displaystyle A} is Hermitian and idempotent.
From the last property it follows that, if A ∈ ∈ --> K n × × --> n {\displaystyle A\in \mathbb {K} ^{n\times n}} is Hermitian and idempotent, for any matrix B ∈ ∈ --> K n × × --> m {\displaystyle B\in \mathbb {K} ^{n\times m}} ( A B ) + A = ( A B ) + {\displaystyle (AB)^{+}A=(AB)^{+}}
Finally, if A {\displaystyle A} is an orthogonal projection matrix, then its pseudoinverse trivially coincides with the matrix itself, that is, A + = A {\displaystyle A^{+}=A} .
If we view the matrix as a linear map A : K n → → --> K m {\displaystyle A:\mathbb {K} ^{n}\to \mathbb {K} ^{m}} over the field K {\displaystyle \mathbb {K} } then A + : K m → → --> K n {\displaystyle A^{+}:\mathbb {K} ^{m}\to \mathbb {K} ^{n}} can be decomposed as follows. We write ⊕ ⊕ --> {\displaystyle \oplus } for the direct sum, ⊥ ⊥ --> {\displaystyle \perp } for the orthogonal complement, ker {\displaystyle \ker } for the kernel of a map, and ran {\displaystyle \operatorname {ran} } for the image of a map. Notice that K n = ( ker --> A ) ⊥ ⊥ --> ⊕ ⊕ --> ker --> A {\displaystyle \mathbb {K} ^{n}=\left(\ker A\right)^{\perp }\oplus \ker A} and K m = ran --> A ⊕ ⊕ --> ( ran --> A ) ⊥ ⊥ --> {\displaystyle \mathbb {K} ^{m}=\operatorname {ran} A\oplus \left(\operatorname {ran} A\right)^{\perp }} . The restriction A : ( ker --> A ) ⊥ ⊥ --> → → --> ran --> A {\displaystyle A:\left(\ker A\right)^{\perp }\to \operatorname {ran} A} is then an isomorphism. This implies that A + {\displaystyle A^{+}} on ran --> A {\displaystyle \operatorname {ran} A} is the inverse of this isomorphism, and is zero on ( ran --> A ) ⊥ ⊥ --> . {\displaystyle \left(\operatorname {ran} A\right)^{\perp }.}
In other words: To find A + b {\displaystyle A^{+}b} for given b {\displaystyle b} in K m {\displaystyle \mathbb {K} ^{m}} , first project b {\displaystyle b} orthogonally onto the range of A {\displaystyle A} , finding a point p ( b ) {\displaystyle p(b)} in the range. Then form A − − --> 1 ( { p ( b ) } ) {\displaystyle A^{-1}(\{p(b)\})} , that is, find those vectors in K n {\displaystyle \mathbb {K} ^{n}} that A {\displaystyle A} sends to p ( b ) {\displaystyle p(b)} . This will be an affine subspace of K n {\displaystyle \mathbb {K} ^{n}} parallel to the kernel of A {\displaystyle A} . The element of this subspace that has the smallest length (that is, is closest to the origin) is the answer A + b {\displaystyle A^{+}b} we are looking for. It can be found by taking an arbitrary member of A − − --> 1 ( { p ( b ) } ) {\displaystyle A^{-1}(\{p(b)\})} and projecting it orthogonally onto the orthogonal complement of the kernel of A {\displaystyle A} .
This description is closely related to the minimum-norm solution to a linear system.
The pseudoinverse are limits: A + = lim δ δ --> ↘ ↘ --> 0 ( A ∗ ∗ --> A + δ δ --> I ) − − --> 1 A ∗ ∗ --> = lim δ δ --> ↘ ↘ --> 0 A ∗ ∗ --> ( A A ∗ ∗ --> + δ δ --> I ) − − --> 1 {\displaystyle A^{+}=\lim _{\delta \searrow 0}\left(A^{*}A+\delta I\right)^{-1}A^{*}=\lim _{\delta \searrow 0}A^{*}\left(AA^{*}+\delta I\right)^{-1}} (see Tikhonov regularization). These limits exist even if ( A A ∗ ∗ --> ) − − --> 1 {\displaystyle \left(AA^{*}\right)^{-1}} or ( A ∗ ∗ --> A ) − − --> 1 {\displaystyle \left(A^{*}A\right)^{-1}} do not exist.[5]: 263
In contrast to ordinary matrix inversion, the process of taking pseudoinverses is not continuous: if the sequence ( A n ) {\displaystyle \left(A_{n}\right)} converges to the matrix A {\displaystyle A} (in the maximum norm or Frobenius norm, say), then ( A n ) + {\displaystyle (A_{n})^{+}} need not converge to A + {\displaystyle A^{+}} . However, if all the matrices A n {\displaystyle A_{n}} have the same rank as A {\displaystyle A} , ( A n ) + {\displaystyle (A_{n})^{+}} will converge to A + {\displaystyle A^{+}} .[10]
Let x ↦ ↦ --> A ( x ) {\displaystyle x\mapsto A(x)} be a real-valued differentiable matrix function with constant rank at a point x 0 {\displaystyle x_{0}} . The derivative of x ↦ ↦ --> A + ( x ) {\displaystyle x\mapsto A^{+}(x)} at x 0 {\displaystyle x_{0}} may be calculated in terms of the derivative of A {\displaystyle A} at x 0 {\displaystyle x_{0}} :[11] d d x | x = x 0 A + = − − --> A + ( d A d x ) A + + A + A + ⊤ ⊤ --> ( d A ⊤ ⊤ --> d x ) ( I − − --> A A + ) + ( I − − --> A + A ) ( d A ⊤ ⊤ --> d x ) A + ⊤ ⊤ --> A + , {\displaystyle \left.{\frac {\mathrm {d} }{\mathrm {d} x}}\right|_{x=x_{0}\!\!\!\!\!\!\!}A^{+}=-A^{+}\left({\frac {\mathrm {d} A}{\mathrm {d} x}}\right)A^{+}~+~A^{+}A^{+\top }\left({\frac {\mathrm {d} A^{\top }}{\mathrm {d} x}}\right)\left(I-AA^{+}\right)~+~\left(I-A^{+}A\right)\left({\frac {\mathrm {d} A^{\top }}{\mathrm {d} x}}\right)A^{+\top }A^{+},} where the functions A {\displaystyle A} , A + {\displaystyle A^{+}} and derivatives on the right side are evaluated at x 0 {\displaystyle x_{0}} (that is, A := A ( x 0 ) {\displaystyle A:=A(x_{0})} , A + := A + ( x 0 ) {\displaystyle A^{+}:=A^{+}(x_{0})} , etc.). For a complex matrix, the transpose is replaced with the conjugate transpose.[12] For a real-valued symmetric matrix, the Magnus-Neudecker derivative is established.[13]
Since for invertible matrices the pseudoinverse equals the usual inverse, only examples of non-invertible matrices are considered below.
It is also possible to define a pseudoinverse for scalars and vectors. This amounts to treating these as matrices. The pseudoinverse of a scalar x {\displaystyle x} is zero if x {\displaystyle x} is zero and the reciprocal of x {\displaystyle x} otherwise: x + = { 0 , if x = 0 ; x − − --> 1 , otherwise . {\displaystyle x^{+}={\begin{cases}0,&{\mbox{if }}x=0;\\x^{-1},&{\mbox{otherwise}}.\end{cases}}}
The pseudoinverse of the null (all zero) vector is the transposed null vector. The pseudoinverse of a non-null vector is the conjugate transposed vector divided by its squared magnitude:
x → → --> + = { 0 → → --> T , if x → → --> = 0 → → --> ; x → → --> ∗ ∗ --> / ( x → → --> ∗ ∗ --> x → → --> ) , otherwise . {\displaystyle {\vec {x}}^{+}={\begin{cases}{\vec {0}}^{\operatorname {T} },&{\text{if }}{\vec {x}}={\vec {0}};\\{\vec {x}}^{*}/({\vec {x}}^{*}{\vec {x}}),&{\text{otherwise}}.\end{cases}}}
The pseudoinverse of a squared diagonal matrix is obtained by taking the reciprocal of the nonzero diagonal elements. Formally, if D {\displaystyle D} is a squared diagonal matrix with D = D ~ ~ --> ⊕ ⊕ --> 0 k × × --> k {\displaystyle D={\tilde {D}}\oplus \mathbf {0} _{k\times k}} and D ~ ~ --> > 0 {\displaystyle {\tilde {D}}>0} , then D + = D ~ ~ --> − − --> 1 ⊕ ⊕ --> 0 k × × --> k {\displaystyle D^{+}={\tilde {D}}^{-1}\oplus \mathbf {0} _{k\times k}} . More generally, if A {\displaystyle A} is any m × × --> n {\displaystyle m\times n} rectangular matrix whose only nonzero elements are on the diagonal, meaning A i j = δ δ --> i j a i {\displaystyle A_{ij}=\delta _{ij}a_{i}} , a i ∈ ∈ --> K {\displaystyle a_{i}\in \mathbb {K} } , then A + {\displaystyle A^{+}} is a n × × --> m {\displaystyle n\times m} rectangular matrix whose diagonal elements are the reciprocal of the original ones, that is, A i i ≠ ≠ --> 0 ⟹ ⟹ --> A i i + = 1 / A i i {\displaystyle A_{ii}\neq 0\implies A_{ii}^{+}=1/A_{ii}} .
If the rank of A {\displaystyle A} is identical to its column rank, n {\displaystyle n} , (for n ≤ ≤ --> m {\displaystyle n\leq m} ,) there are n {\displaystyle n} linearly independent columns, and A ∗ ∗ --> A {\displaystyle A^{*}A} is invertible. In this case, an explicit formula is:[14] A + = ( A ∗ ∗ --> A ) − − --> 1 A ∗ ∗ --> . {\displaystyle A^{+}=\left(A^{*}A\right)^{-1}A^{*}.}
It follows that A + {\displaystyle A^{+}} is then a left inverse of A {\displaystyle A} : A + A = I n {\displaystyle A^{+}A=I_{n}} .
If the rank of A {\displaystyle A} is identical to its row rank, m {\displaystyle m} , (for m ≤ ≤ --> n {\displaystyle m\leq n} ,) there are m {\displaystyle m} linearly independent rows, and A A ∗ ∗ --> {\displaystyle AA^{*}} is invertible. In this case, an explicit formula is: A + = A ∗ ∗ --> ( A A ∗ ∗ --> ) − − --> 1 . {\displaystyle A^{+}=A^{*}\left(AA^{*}\right)^{-1}.}
It follows that A + {\displaystyle A^{+}} is a right inverse of A {\displaystyle A} : A A + = I m {\displaystyle AA^{+}=I_{m}} .
This is a special case of either full column rank or full row rank (treated above). If A {\displaystyle A} has orthonormal columns ( A ∗ ∗ --> A = I n {\displaystyle A^{*}A=I_{n}} ) or orthonormal rows ( A A ∗ ∗ --> = I m {\displaystyle AA^{*}=I_{m}} ), then: A + = A ∗ ∗ --> . {\displaystyle A^{+}=A^{*}.}
If A {\displaystyle A} is normal, that is, it commutes with its conjugate transpose, then its pseudoinverse can be computed by diagonalizing it, mapping all nonzero eigenvalues to their inverses, and mapping zero eigenvalues to zero. A corollary is that A {\displaystyle A} commuting with its transpose implies that it commutes with its pseudoinverse.
A (square) matrix A {\displaystyle A} is said to be an EP matrix if it commutes with its pseudoinverse. In such cases (and only in such cases), it is possible to obtain the pseudoinverse as a polynomial in A {\displaystyle A} . A polynomial p ( t ) {\displaystyle p(t)} such that A + = p ( A ) {\displaystyle A^{+}=p(A)} can be easily obtained from the characteristic polynomial of A {\displaystyle A} or, more generally, from any annihilating polynomial of A {\displaystyle A} .[15]
This is a special case of a normal matrix with eigenvalues 0 and 1. If A {\displaystyle A} is an orthogonal projection matrix, that is, A = A ∗ ∗ --> {\displaystyle A=A^{*}} and A 2 = A {\displaystyle A^{2}=A} , then the pseudoinverse trivially coincides with the matrix itself: A + = A . {\displaystyle A^{+}=A.}
For a circulant matrix C {\displaystyle C} , the singular value decomposition is given by the Fourier transform, that is, the singular values are the Fourier coefficients. Let F {\displaystyle {\mathcal {F}}} be the Discrete Fourier Transform (DFT) matrix; then[16] C = F ⋅ ⋅ --> Σ Σ --> ⋅ ⋅ --> F ∗ ∗ --> , C + = F ⋅ ⋅ --> Σ Σ --> + ⋅ ⋅ --> F ∗ ∗ --> . {\displaystyle {\begin{aligned}C&={\mathcal {F}}\cdot \Sigma \cdot {\mathcal {F}}^{*},\\C^{+}&={\mathcal {F}}\cdot \Sigma ^{+}\cdot {\mathcal {F}}^{*}.\end{aligned}}}
Let r ≤ ≤ --> min ( m , n ) {\displaystyle r\leq \min(m,n)} denote the rank of A ∈ ∈ --> K m × × --> n {\displaystyle A\in \mathbb {K} ^{m\times n}} . Then A {\displaystyle A} can be (rank) decomposed as A = B C {\displaystyle A=BC} where B ∈ ∈ --> K m × × --> r {\displaystyle B\in \mathbb {K} ^{m\times r}} and C ∈ ∈ --> K r × × --> n {\displaystyle C\in \mathbb {K} ^{r\times n}} are of rank r {\displaystyle r} . Then A + = C + B + = C ∗ ∗ --> ( C C ∗ ∗ --> ) − − --> 1 ( B ∗ ∗ --> B ) − − --> 1 B ∗ ∗ --> {\displaystyle A^{+}=C^{+}B^{+}=C^{*}\left(CC^{*}\right)^{-1}\left(B^{*}B\right)^{-1}B^{*}} .
For K ∈ ∈ --> { R , C } {\displaystyle \mathbb {K} \in \{\mathbb {R} ,\mathbb {C} \}} computing the product A A ∗ ∗ --> {\displaystyle AA^{*}} or A ∗ ∗ --> A {\displaystyle A^{*}A} and their inverses explicitly is often a source of numerical rounding errors and computational cost in practice. An alternative approach using the QR decomposition of A {\displaystyle A} may be used instead.
Consider the case when A {\displaystyle A} is of full column rank, so that A + = ( A ∗ ∗ --> A ) − − --> 1 A ∗ ∗ --> {\displaystyle A^{+}=\left(A^{*}A\right)^{-1}A^{*}} . Then the Cholesky decomposition A ∗ ∗ --> A = R ∗ ∗ --> R {\displaystyle A^{*}A=R^{*}R} , where R {\displaystyle R} is an upper triangular matrix, may be used. Multiplication by the inverse is then done easily by solving a system with multiple right-hand sides, A + = ( A ∗ ∗ --> A ) − − --> 1 A ∗ ∗ --> ⇔ ⇔ --> ( A ∗ ∗ --> A ) A + = A ∗ ∗ --> ⇔ ⇔ --> R ∗ ∗ --> R A + = A ∗ ∗ --> {\displaystyle A^{+}=\left(A^{*}A\right)^{-1}A^{*}\quad \Leftrightarrow \quad \left(A^{*}A\right)A^{+}=A^{*}\quad \Leftrightarrow \quad R^{*}RA^{+}=A^{*}}
which may be solved by forward substitution followed by back substitution.
The Cholesky decomposition may be computed without forming A ∗ ∗ --> A {\displaystyle A^{*}A} explicitly, by alternatively using the QR decomposition of A = Q R {\displaystyle A=QR} , where Q {\displaystyle Q} has orthonormal columns, Q ∗ ∗ --> Q = I {\displaystyle Q^{*}Q=I} , and R {\displaystyle R} is upper triangular. Then A ∗ ∗ --> A = ( Q R ) ∗ ∗ --> ( Q R ) = R ∗ ∗ --> Q ∗ ∗ --> Q R = R ∗ ∗ --> R , {\displaystyle A^{*}A\,=\,(QR)^{*}(QR)\,=\,R^{*}Q^{*}QR\,=\,R^{*}R,}
so R {\displaystyle R} is the Cholesky factor of A ∗ ∗ --> A {\displaystyle A^{*}A} .
The case of full row rank is treated similarly by using the formula A + = A ∗ ∗ --> ( A A ∗ ∗ --> ) − − --> 1 {\displaystyle A^{+}=A^{*}\left(AA^{*}\right)^{-1}} and using a similar argument, swapping the roles of A {\displaystyle A} and A ∗ ∗ --> {\displaystyle A^{*}} .
For an arbitrary A ∈ ∈ --> K m × × --> n {\displaystyle A\in \mathbb {K} ^{m\times n}} , one has that A ∗ ∗ --> A {\displaystyle A^{*}A} is normal and, as a consequence, an EP matrix. One can then find a polynomial p ( t ) {\displaystyle p(t)} such that ( A ∗ ∗ --> A ) + = p ( A ∗ ∗ --> A ) {\displaystyle (A^{*}A)^{+}=p(A^{*}A)} . In this case one has that the pseudoinverse of A {\displaystyle A} is given by[15] A + = p ( A ∗ ∗ --> A ) A ∗ ∗ --> = A ∗ ∗ --> p ( A A ∗ ∗ --> ) . {\displaystyle A^{+}=p(A^{*}A)A^{*}=A^{*}p(AA^{*}).}
A computationally simple and accurate way to compute the pseudoinverse is by using the singular value decomposition.[14][5][17] If A = U Σ Σ --> V ∗ ∗ --> {\displaystyle A=U\Sigma V^{*}} is the singular value decomposition of A {\displaystyle A} , then A + = V Σ Σ --> + U ∗ ∗ --> {\displaystyle A^{+}=V\Sigma ^{+}U^{*}} . For a rectangular diagonal matrix such as Σ Σ --> {\displaystyle \Sigma } , we get the pseudoinverse by taking the reciprocal of each non-zero element on the diagonal, leaving the zeros in place, and then transposing the matrix. In numerical computation, only elements larger than some small tolerance are taken to be nonzero, and the others are replaced by zeros. For example, in the MATLAB or GNU Octave function pinv, the tolerance is taken to be t = ε⋅max(m, n)⋅max(Σ), where ε is the machine epsilon.
The computational cost of this method is dominated by the cost of computing the SVD, which is several times higher than matrix–matrix multiplication, even if a state-of-the art implementation (such as that of LAPACK) is used.
The above procedure shows why taking the pseudoinverse is not a continuous operation: if the original matrix A {\displaystyle A} has a singular value 0 (a diagonal entry of the matrix Σ Σ --> {\displaystyle \Sigma } above), then modifying A {\displaystyle A} slightly may turn this zero into a tiny positive number, thereby affecting the pseudoinverse dramatically as we now have to take the reciprocal of a tiny number.
Optimized approaches exist for calculating the pseudoinverse of block-structured matrices.
Another method for computing the pseudoinverse (cf. Drazin inverse) uses the recursion A i + 1 = 2 A i − − --> A i A A i , {\displaystyle A_{i+1}=2A_{i}-A_{i}AA_{i},}
which is sometimes referred to as hyper-power sequence. This recursion produces a sequence converging quadratically to the pseudoinverse of A {\displaystyle A} if it is started with an appropriate A 0 {\displaystyle A_{0}} satisfying A 0 A = ( A 0 A ) ∗ ∗ --> {\displaystyle A_{0}A=\left(A_{0}A\right)^{*}} . The choice A 0 = α α --> A ∗ ∗ --> {\displaystyle A_{0}=\alpha A^{*}} (where 0 < α α --> < 2 / σ σ --> 1 2 ( A ) {\displaystyle 0<\alpha <2/\sigma _{1}^{2}(A)} , with σ σ --> 1 ( A ) {\displaystyle \sigma _{1}(A)} denoting the largest singular value of A {\displaystyle A} )[18] has been argued not to be competitive to the method using the SVD mentioned above, because even for moderately ill-conditioned matrices it takes a long time before A i {\displaystyle A_{i}} enters the region of quadratic convergence.[19] However, if started with A 0 {\displaystyle A_{0}} already close to the Moore–Penrose inverse and A 0 A = ( A 0 A ) ∗ ∗ --> {\displaystyle A_{0}A=\left(A_{0}A\right)^{*}} , for example A 0 := ( A ∗ ∗ --> A + δ δ --> I ) − − --> 1 A ∗ ∗ --> {\displaystyle A_{0}:=\left(A^{*}A+\delta I\right)^{-1}A^{*}} , convergence is fast (quadratic).
For the cases where A {\displaystyle A} has full row or column rank, and the inverse of the correlation matrix ( A A ∗ ∗ --> {\displaystyle AA^{*}} for A {\displaystyle A} with full row rank or A ∗ ∗ --> A {\displaystyle A^{*}A} for full column rank) is already known, the pseudoinverse for matrices related to A {\displaystyle A} can be computed by applying the Sherman–Morrison–Woodbury formula to update the inverse of the correlation matrix, which may need less work. In particular, if the related matrix differs from the original one by only a changed, added or deleted row or column, incremental algorithms exist that exploit the relationship.[20][21]
Similarly, it is possible to update the Cholesky factor when a row or column is added, without creating the inverse of the correlation matrix explicitly. However, updating the pseudoinverse in the general rank-deficient case is much more complicated.[22][23]
High-quality implementations of SVD, QR, and back substitution are available in standard libraries, such as LAPACK. Writing one's own implementation of SVD is a major programming project that requires a significant numerical expertise. In special circumstances, such as parallel computing or embedded computing, however, alternative implementations by QR or even the use of an explicit inverse might be preferable, and custom implementations may be unavoidable.
The Python package NumPy provides a pseudoinverse calculation through its functions matrix.I and linalg.pinv; its pinv uses the SVD-based algorithm. SciPy adds a function scipy.linalg.pinv that uses a least-squares solver.
matrix.I
linalg.pinv
pinv
scipy.linalg.pinv
The MASS package for R provides a calculation of the Moore–Penrose inverse through the ginv function.[24] The ginv function calculates a pseudoinverse using the singular value decomposition provided by the svd function in the base R package. An alternative is to employ the pinv function available in the pracma package.
ginv
svd
The Octave programming language provides a pseudoinverse through the standard package function pinv and the pseudo_inverse() method.
pseudo_inverse()
In Julia (programming language), the LinearAlgebra package of the standard library provides an implementation of the Moore–Penrose inverse pinv() implemented via singular-value decomposition.[25]
pinv()
The pseudoinverse provides a least squares solution to a system of linear equations.[26] For A ∈ ∈ --> K m × × --> n {\displaystyle A\in \mathbb {K} ^{m\times n}} , given a system of linear equations A x = b , {\displaystyle Ax=b,}
in general, a vector x {\displaystyle x} that solves the system may not exist, or if one does exist, it may not be unique. More specifically, a solution exists if and only if b {\displaystyle b} is in the image of A {\displaystyle A} , and is unique if and only if A {\displaystyle A} is injective. The pseudoinverse solves the "least-squares" problem as follows:
This result is easily extended to systems with multiple right-hand sides, when the Euclidean norm is replaced by the Frobenius norm. Let B ∈ ∈ --> K m × × --> p {\displaystyle B\in \mathbb {K} ^{m\times p}} .
If the linear system
A x = b {\displaystyle Ax=b}
has any solutions, they are all given by[28]
x = A + b + [ I − − --> A + A ] w {\displaystyle x=A^{+}b+\left[I-A^{+}A\right]w}
for arbitrary vector w {\displaystyle w} . Solution(s) exist if and only if A A + b = b {\displaystyle AA^{+}b=b} .[28] If the latter holds, then the solution is unique if and only if A {\displaystyle A} has full column rank, in which case I − − --> A + A {\displaystyle I-A^{+}A} is a zero matrix. If solutions exist but A {\displaystyle A} does not have full column rank, then we have an indeterminate system, all of whose infinitude of solutions are given by this last equation.
For linear systems A x = b , {\displaystyle Ax=b,} with non-unique solutions (such as under-determined systems), the pseudoinverse may be used to construct the solution of minimum Euclidean norm ‖ ‖ --> x ‖ ‖ --> 2 {\displaystyle \|x\|_{2}} among all solutions.
Using the pseudoinverse and a matrix norm, one can define a condition number for any matrix: cond ( A ) = ‖ ‖ --> A ‖ ‖ --> ‖ A + ‖ . {\displaystyle {\mbox{cond}}(A)=\|A\|\left\|A^{+}\right\|.}
A large condition number implies that the problem of finding least-squares solutions to the corresponding system of linear equations is ill-conditioned in the sense that small errors in the entries of A {\displaystyle A} can lead to huge errors in the entries of the solution.[29]
In order to solve more general least-squares problems, one can define Moore–Penrose inverses for all continuous linear operators A : H 1 → → --> H 2 {\displaystyle A:H_{1}\rightarrow H_{2}} between two Hilbert spaces H 1 {\displaystyle H_{1}} and H 2 {\displaystyle H_{2}} , using the same four conditions as in our definition above. It turns out that not every continuous linear operator has a continuous linear pseudoinverse in this sense.[29] Those that do are precisely the ones whose range is closed in H 2 {\displaystyle H_{2}} .
A notion of pseudoinverse exists for matrices over an arbitrary field equipped with an arbitrary involutive automorphism. In this more general setting, a given matrix doesn't always have a pseudoinverse. The necessary and sufficient condition for a pseudoinverse to exist is that rank --> ( A ) = rank --> ( A ∗ ∗ --> A ) = rank --> ( A A ∗ ∗ --> ) {\displaystyle \operatorname {rank} (A)=\operatorname {rank} \left(A^{*}A\right)=\operatorname {rank} \left(AA^{*}\right)} , where A ∗ ∗ --> {\displaystyle A^{*}} denotes the result of applying the involution operation to the transpose of A {\displaystyle A} . When it does exist, it is unique.[30] Example: Consider the field of complex numbers equipped with the identity involution (as opposed to the involution considered elsewhere in the article); do there exist matrices that fail to have pseudoinverses in this sense? Consider the matrix A = [ 1 i ] T {\displaystyle A={\begin{bmatrix}1&i\end{bmatrix}}^{\operatorname {T} }} . Observe that rank --> ( A A T ) = 1 {\displaystyle \operatorname {rank} \left(AA^{\operatorname {T} }\right)=1} while rank --> ( A T A ) = 0 {\displaystyle \operatorname {rank} \left(A^{\operatorname {T} }A\right)=0} . So this matrix doesn't have a pseudoinverse in this sense.
In abstract algebra, a Moore–Penrose inverse may be defined on a *-regular semigroup. This abstract definition coincides with the one in linear algebra.
Lokasi Pengunjung: 18.217.243.182