Moore–Penrose inverse

From testwiki
Revision as of 20:15, 26 February 2025 by imported>Jacobolus (Partially undid revision 1277764430 by TheMathCat (talk) – the name of the journal changed in 1975)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Template:Short description In mathematics, and in particular linear algebra, the Moore–Penrose inverse Template:Tmath of a matrix Template:Tmath, 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 for all rectangular matrices whose entries are real or complex numbers. Given a rectangular matrix with real or complex entries, its pseudoinverse is unique. It can be computed using the singular value decomposition. In the special case where Template:Tmath is a normal matrix (for example, a Hermitian matrix), the pseudoinverse Template:Tmath annihilates the kernel of Template:Tmath and acts as a traditional inverse of Template:Tmath on the subspace orthogonal to the kernel.

Notation

In the following discussion, the following conventions are adopted.

Definition

For A𝕂m×n, a pseudoinverse of Template:Mvar is defined as a matrix Template:Tmath satisfying all of the following four criteria, known as the Moore–Penrose conditions:[4][5]

  1. Template:Tmath need not be the general identity matrix, but it maps all column vectors of Template:Mvar to themselves: AA+A=A.
  2. Template:Tmath acts like a weak inverse: A+AA+=A+.
  3. Template:Tmath is Hermitian: (AA+)*=AA+.
  4. Template:Tmath is also Hermitian: (A+A)*=A+A.

Note that A+A and AA+ are idempotent operators, as follows from (AA+)2=AA+ and (A+A)2=A+A. More specifically, A+A projects onto the image of AT (equivalently, the span of the rows of A), and AA+ projects onto the image of A (equivalently, the span of the columns of A). In fact, the above four conditions are fully equivalent to A+A and AA+ being such orthogonal projections: AA+ projecting onto the image of A implies (AA+)A=A, and A+A projecting onto the image of AT implies (A+A)AT=AT.

The pseudoinverse A+ exists for any matrix A𝕂m×n. If furthermore A is full rank, that is, its rank is Template:Tmath, then Template:Tmath can be given a particularly simple algebraic expression. In particular:

  • When Template:Tmath has linearly independent columns (equivalently, Template:Tmath is injective, and thus Template:Tmath is invertible), Template:Tmath can be computed asA+=(A*A)1A*.This particular pseudoinverse is a left inverse, that is, A+A=I.
  • If, on the other hand, A has linearly independent rows (equivalently, A is surjective, and thus Template:Tmath is invertible), Template:Tmath can be computed asA+=A*(AA*)1.This is a right inverse, as AA+=I.

In the more general case, the pseudoinverse can be expressed leveraging the singular value decomposition. Any matrix can be decomposed as A=UDV* for some isometries U,V and diagonal nonnegative real matrix D. The pseudoinverse can then be written as A+=VD+U*, where D+ is the pseudoinverse of D and can be obtained by transposing the matrix and replacing the nonzero values with their multiplicative inverses.Template:Sfn That this matrix satisfies the above requirement is directly verified observing that AA+=UU* and A+A=VV*, which are the projections onto image and support of A, respectively.

Properties

Existence and uniqueness

As discussed above, for any matrix Template:Tmath there is one and only one pseudoinverse Template:Tmath.[5]

A matrix satisfying only the first of the conditions given above, namely AA+A=A, is known as a generalized inverse. If the matrix also satisfies the second condition, namely 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.

Basic properties

Proofs for the properties below can be found at b:Topics in Abstract Algebra/Linear algebra.

  • If Template:Tmath has real entries, then so does Template:Tmath.
  • If Template:Tmath is invertible, its pseudoinverse is its inverse. That is, A+=A1.[6]Template:Rp
  • The pseudoinverse of the pseudoinverse is the original matrix: (A+)+=A.[6]Template:Rp
  • Pseudoinversion commutes with transposition, complex conjugation, and taking the conjugate transpose:[6]Template:Rp (A𝖳)+=(A+)𝖳,(A)+=A+,(A*)+=(A+)*.
  • The pseudoinverse of a scalar multiple of Template:Tmath is the reciprocal multiple of Template:Tmath:(αA)+=α1A+ for Template:Tmath; otherwise, (0A)+=0A+=0A𝖳, or 0+=0𝖳.
  • The kernel and image of the pseudoinverse coincide with those of the conjugate transpose: ker(A+)=ker(A*) and ran(A+)=ran(A*).

Identities

The following identity formula can be used to cancel or expand certain subexpressions involving pseudoinverses: A=AA*A+*=A+*A*A. Equivalently, substituting A+ for A gives A+=A+A+*A*=A*A+*A+, while substituting A* for A gives A*=A*AA+=A+AA*.

Reduction to Hermitian case

The computation of the pseudoinverse is reducible to its construction in the Hermitian case. This is possible through the equivalences: A+=(A*A)+A*, A+=A*(AA*)+,

as Template:Tmath and Template:Tmath are Hermitian.

Pseudoinverse of products

The equality Template:Tmath does not hold in general. Rather, suppose Template:Tmath. Then the following are equivalent:[7]

  1. (AB)+=B+A+
  2. A+ABB*A*=BB*A* and BB+A*AB=A*AB
  3. (A+ABB*)*=A+ABB* and (A*ABB+)*=A*ABB+
  4. A+ABB*A*ABB+=BB*A*A
  5. A+AB=B(AB)+AB and BB+A*=A*AB(AB)+.

The following are sufficient conditions for Template:Tmath:

  1. Template:Tmath has orthonormal columns (then A*A=A+A=In), or
  2. Template:Tmath has orthonormal rows (then BB*=BB+=In), or
  3. Template:Tmath has linearly independent columns (then A+A=I ) and Template:Tmath has linearly independent rows (then BB+=I),   or
  4. B=A*, or
  5. B=A+.

The following is a necessary condition for Template:Tmath:

  1. (A+A)(BB+)=(BB+)(A+A)

The fourth sufficient condition yields the equalities (AA*)+=A+*A+,(A*A)+=A+A+*.

Here is a counterexample where Template:Tmath:

((1100)(0011))+=(1100)+=(120120)(140140)=(012012)(120120)=(0011)+(1100)+

Projectors

P=AA+ and Q=A+A are orthogonal projection operators, that is, they are Hermitian (P=P*, Q=Q*) and idempotent (P2=P and Q2=Q). The following hold:

The last two properties imply the following identities:

  • A (IA+A)=(IAA+)A  =0
  • A*(IAA+)=(IA+A)A*=0

Another property is the following: if Template:Tmath is Hermitian and idempotent (true if and only if it represents an orthogonal projection), then, for any matrix Template:Tmath the following equation holds:[8] A(BA)+=(BA)+

This can be proven by defining matrices C=BA, D=A(BA)+, and checking that Template:Tmath is indeed a pseudoinverse for Template:Tmath by verifying that the defining properties of the pseudoinverse hold, when Template:Tmath is Hermitian and idempotent.

From the last property it follows that, if Template:Tmath is Hermitian and idempotent, for any matrix Template:Tmath (AB)+A=(AB)+

Finally, if Template:Tmath is an orthogonal projection matrix, then its pseudoinverse trivially coincides with the matrix itself, that is, A+=A.

Geometric construction

If we view the matrix as a linear map Template:Tmath over the field Template:Tmath then Template:Tmath can be decomposed as follows. We write Template:Tmath for the direct sum, Template:Tmath for the orthogonal complement, Template:Tmath for the kernel of a map, and Template:Tmath for the image of a map. Notice that 𝕂n=(kerA)kerA and 𝕂m=ranA(ranA). The restriction A:(kerA)ranA is then an isomorphism. This implies that Template:Tmath on Template:Tmath is the inverse of this isomorphism, and is zero on (ranA).

In other words: To find Template:Tmath for given Template:Tmath in Template:Tmath, first project Template:Tmath orthogonally onto the range of Template:Tmath, finding a point Template:Tmath in the range. Then form Template:Tmath, that is, find those vectors in Template:Tmath that Template:Tmath sends to Template:Tmath. This will be an affine subspace of Template:Tmath parallel to the kernel of Template:Tmath. The element of this subspace that has the smallest length (that is, is closest to the origin) is the answer Template:Tmath we are looking for. It can be found by taking an arbitrary member of Template:Tmath and projecting it orthogonally onto the orthogonal complement of the kernel of Template:Tmath.

This description is closely related to the minimum-norm solution to a linear system.

Limit relations

The pseudoinverse are limits: A+=limδ0(A*A+δI)1A*=limδ0A*(AA*+δI)1 (see Tikhonov regularization). These limits exist even if Template:Tmath or Template:Tmath do not exist.[5]Template:Rp

Continuity

In contrast to ordinary matrix inversion, the process of taking pseudoinverses is not continuous: if the sequence Template:Tmath converges to the matrix Template:Tmath (in the maximum norm or Frobenius norm, say), then Template:Tmath need not converge to Template:Tmath. However, if all the matrices Template:Tmath have the same rank as Template:Tmath, Template:Tmath will converge to Template:Tmath.[9]

Derivative

Let xA(x) be a real-valued differentiable matrix function with constant rank at a point Template:Tmath. The derivative of xA+(x) at x0 may be calculated in terms of the derivative of A at x0:[10] ddx|x=x0A+=A+(dAdx)A++A+A+(dAdx)(IAA+)+(IA+A)(dAdx)A+A+, where the functions A, A+ and derivatives on the right side are evaluated at x0 (that is, A:=A(x0), A+:=A+(x0), etc.). For a complex matrix, the transpose is replaced with the conjugate transpose.[11] For a real-valued symmetric matrix, the Magnus-Neudecker derivative is established.[12]

Examples

Since for invertible matrices the pseudoinverse equals the usual inverse, only examples of non-invertible matrices are considered below.

  • For A=(0000), the pseudoinverse is A+=(0000). The uniqueness of this pseudoinverse can be seen from the requirement A+=A+AA+, since multiplication by a zero matrix would always produce a zero matrix.
  • For A=(1010), the pseudoinverse is A+=(121200).
Indeed, AA+=(12121212), and thus AA+A=(1010)=A. Similarly, A+A=(1000), and thus A+AA+=(121200)=A+.
Note that Template:Tmath is neither injective nor surjective, and thus the pseudoinverse cannot be computed via A+=(A*A)1A* nor A+=A*(AA*)1, as A*A and AA* are both singular, and furthermore A+ is neither a left nor a right inverse.
Nonetheless, the pseudoinverse can be computed via SVD observing that A=2(𝐞1+𝐞22)𝐞1*, and thus A+=12𝐞1(𝐞1+𝐞22)*.
  • For A=(1010), A+=(121200).
  • For A=(1020), A+=(152500). The denominators are here 5=12+22.
  • For A=(1111), A+=(14141414).
  • For A=(100101), the pseudoinverse is A+=(10001212).
For this matrix, the left inverse exists and thus equals A+, indeed, A+A=(1001).


Special cases

Scalars

It is also possible to define a pseudoinverse for scalars and vectors. This amounts to treating these as matrices. The pseudoinverse of a scalar Template:Tmath is zero if Template:Tmath is zero and the reciprocal of Template:Tmath otherwise: x+={0,if x=0;x1,otherwise.

Vectors

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𝖳,if x=0;x*(x*x),otherwise.

Diagonal matrices

The pseudoinverse of a squared diagonal matrix is obtained by taking the reciprocal of the nonzero diagonal elements. Formally, if D is a squared diagonal matrix with D=D~𝟎k×k and D~>0, then D+=D~1𝟎k×k. More generally, if A is any m×n rectangular matrix whose only nonzero elements are on the diagonal, meaning Aij=δijai, ai𝕂, then A+ is a n×m rectangular matrix whose diagonal elements are the reciprocal of the original ones, that is, Aii0Aii+=1Aii.

Linearly independent columns

If the rank of Template:Tmath is identical to the number of columns, Template:Tmath, (for Template:Tmath,) there are Template:Tmath linearly independent columns, and Template:Tmath is invertible. In this case, an explicit formula is:Template:Sfn A+=(A*A)1A*.

It follows that Template:Tmath is then a left inverse of Template:Tmath:   A+A=In.

Linearly independent rows

If the rank of Template:Tmath is identical to the number of rows, Template:Tmath, (for Template:Tmath,) there are Template:Tmath linearly independent rows, and Template:Tmath is invertible. In this case, an explicit formula is: A+=A*(AA*)1.

It follows that Template:Tmath is a right inverse of Template:Tmath:   AA+=Im.

Orthonormal columns or rows

This is a special case of either full column rank or full row rank (treated above). If Template:Tmath has orthonormal columns (A*A=In) or orthonormal rows (AA*=Im), then: A+=A*.

Normal matrices

If Template:Tmath 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 Template:Tmath commuting with its transpose implies that it commutes with its pseudoinverse.

EP matrices

A (square) matrix Template:Tmath 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 Template:Tmath. A polynomial p(t) such that A+=p(A) can be easily obtained from the characteristic polynomial of Template:Tmath or, more generally, from any annihilating polynomial of Template:Tmath.[13]

Orthogonal projection matrices

This is a special case of a normal matrix with eigenvalues 0 and 1. If Template:Tmath is an orthogonal projection matrix, that is, A=A* and A2=A, then the pseudoinverse trivially coincides with the matrix itself: A+=A.

Circulant matrices

For a circulant matrix Template:Tmath, the singular value decomposition is given by the Fourier transform, that is, the singular values are the Fourier coefficients. Let Template:Tmath be the Discrete Fourier Transform (DFT) matrix; then[14] C=Σ*,C+=Σ+*.

Construction

Rank decomposition

Let Template:Tmath denote the rank of Template:Tmath. Then Template:Tmath can be (rank) decomposed as A=BC where Template:Tmath and Template:Tmath are of rank Template:Tmath. Then A+=C+B+=C*(CC*)1(B*B)1B*.

The QR method

For 𝕂{,} computing the product Template:Tmath or Template:Tmath 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 Template:Tmath may be used instead.

Consider the case when Template:Tmath is of full column rank, so that A+=(A*A)1A*. Then the Cholesky decomposition A*A=R*R, where Template:Tmath 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)1A*(A*A)A+=A*R*RA+=A*

which may be solved by forward substitution followed by back substitution.

The Cholesky decomposition may be computed without forming Template:Tmath explicitly, by alternatively using the QR decomposition of A=QR, where Q has orthonormal columns, Q*Q=I, and Template:Tmath is upper triangular. Then A*A=(QR)*(QR)=R*Q*QR=R*R,

so Template:Tmath is the Cholesky factor of Template:Tmath.

The case of full row rank is treated similarly by using the formula A+=A*(AA*)1 and using a similar argument, swapping the roles of Template:Tmath and Template:Tmath.

Using polynomials in matrices

For an arbitrary Template:Tmath, one has that A*A is normal and, as a consequence, an EP matrix. One can then find a polynomial p(t) such that (A*A)+=p(A*A). In this case one has that the pseudoinverse of Template:Tmath is given by[13] A+=p(A*A)A*=A*p(AA*).

Singular value decomposition (SVD)

A computationally simple and accurate way to compute the pseudoinverse is by using the singular value decomposition.Template:Sfn[5][15] If A=UΣV* is the singular value decomposition of Template:Tmath, then A+=VΣ+U*. For a rectangular diagonal matrix such as Template:Tmath, we get the pseudoinverse by taking the reciprocal of each non-zero element on the diagonal, leaving the zeros in place. 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 Template:Mono, the tolerance is taken to be Template:Math, 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 Template:Tmath has a singular value 0 (a diagonal entry of the matrix Template:Tmath above), then modifying Template:Tmath 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.

Block matrices

Optimized approaches exist for calculating the pseudoinverse of block-structured matrices.

The iterative method of Ben-Israel and Cohen

Another method for computing the pseudoinverse (cf. Drazin inverse) uses the recursion Ai+1=2AiAiAAi,

which is sometimes referred to as hyper-power sequence. This recursion produces a sequence converging quadratically to the pseudoinverse of Template:Tmath if it is started with an appropriate Template:Tmath satisfying A0A=(A0A)*. The choice A0=αA* (where 0<α<2/σ12(A), with Template:Tmath denoting the largest singular value of Template:Tmath)[16] 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 Template:Tmath enters the region of quadratic convergence.[17] However, if started with Template:Tmath already close to the Moore–Penrose inverse and A0A=(A0A)*, for example A0:=(A*A+δI)1A*, convergence is fast (quadratic).

Updating the pseudoinverse

For the cases where Template:Tmath has full row or column rank, and the inverse of the correlation matrix (Template:Tmath for Template:Tmath with full row rank or Template:Tmath for full column rank) is already known, the pseudoinverse for matrices related to Template:Tmath 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.[18][19]

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.[20][21]

Software libraries

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.

The MASS package for R provides a calculation of the Moore–Penrose inverse through the ginv function.[22] 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.

The Octave programming language provides a pseudoinverse through the standard package function pinv and the pseudo_inverse() method.

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.[23]

Applications

Linear least-squares

Template:See also

The pseudoinverse provides a least squares solution to a system of linear equations.[24] For Template:Tmath, given a system of linear equations Ax=b,

in general, a vector Template:Tmath 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 is in the image of A, and is unique if and only if 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 Template:Tmath.

Obtaining all solutions of a linear system

If the linear system

Ax=b

has any solutions, they are all given by[26]

x=A+b+[IA+A]w

for arbitrary vector Template:Tmath. Solution(s) exist if and only if AA+b=b.[26] If the latter holds, then the solution is unique if and only if Template:Tmath has full column rank, in which case Template:Tmath is a zero matrix. If solutions exist but Template:Tmath does not have full column rank, then we have an indeterminate system, all of whose infinitude of solutions are given by this last equation.

Minimum norm solution to a linear system

For linear systems Ax=b, with non-unique solutions (such as under-determined systems), the pseudoinverse may be used to construct the solution of minimum Euclidean norm x2 among all solutions.

  • If Ax=b is satisfiable, the vector z=A+b is a solution, and satisfies z2x2 for all solutions.

This result is easily extended to systems with multiple right-hand sides, when the Euclidean norm is replaced by the Frobenius norm. Let Template:Tmath.

  • If AX=B is satisfiable, the matrix Z=A+B is a solution, and satisfies ZFXF for all solutions.

Condition number

Using the pseudoinverse and a matrix norm, one can define a condition number for any matrix: cond(A)=AA+.

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 Template:Tmath can lead to huge errors in the entries of the solution.[27]

Generalizations

The weighted pseudoinverse [28] generalizes the Moore-Penrose inverse between metric spaces with weight matrices in the domain and range. These weights are the identity for the standard Moore-Penrose inverse, which assumes an orthonormal basis in both spaces.

In order to solve more general least-squares problems, one can define Moore–Penrose inverses for all continuous linear operators Template:Tmath between two Hilbert spaces Template:Tmath and Template:Tmath, 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.[27] Those that do are precisely the ones whose range is closed in Template:Tmath.

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(AA*), where A* denotes the result of applying the involution operation to the transpose of A. When it does exist, it is unique.[29] 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=[1i]𝖳. Observe that rank(AA𝖳)=1 while rank(A𝖳A)=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.

See also

Notes

Template:Reflist

References

Template:Numerical linear algebra Template:Roger Penrose