# Moore–Penrose inverse

In mathematics, and in particular linear algebra, the Moore–Penrose inverse ${\displaystyle A^{+}}$ of a matrix ${\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 ${\displaystyle A}$ is a normal matrix (for example, a Hermitian matrix), the pseudoinverse ${\displaystyle A^{+}}$ annihilates the kernel of ${\displaystyle A}$ and acts as a traditional inverse of ${\displaystyle A}$ on the subspace orthogonal to the kernel.

## Notation

In the following discussion, the following conventions are adopted.

• ${\displaystyle \mathbb {K} }$ will denote one of the fields of real or complex numbers, denoted ${\displaystyle \mathbb {R} }$, ${\displaystyle \mathbb {C} }$, respectively. The vector space of ${\displaystyle m\times n}$ matrices over ${\displaystyle \mathbb {K} }$ is denoted by ${\displaystyle \mathbb {K} ^{m\times n}}$.
• For ${\displaystyle A\in \mathbb {K} ^{m\times n}}$, the transpose is denoted ${\displaystyle A^{\operatorname {T} }}$ and the Hermitian transpose (also called conjugate transpose) is denoted ${\displaystyle A^{*}}$. If ${\displaystyle \mathbb {K} =\mathbb {R} }$, then ${\displaystyle A^{*}=A^{\operatorname {T} }}$.
• For ${\displaystyle A\in \mathbb {K} ^{m\times n}}$, ${\displaystyle \operatorname {ran} (A)}$ (standing for "range") denotes the column space (image) of ${\displaystyle A}$ (the space spanned by the column vectors of ${\displaystyle A}$) and ${\displaystyle \ker(A)}$ denotes the kernel (null space) of ${\displaystyle A}$.
• For any positive integer ${\displaystyle n}$, the ${\displaystyle n\times n}$ identity matrix is denoted ${\displaystyle I_{n}\in \mathbb {K} ^{n\times n}}$.

## Definition

For ${\displaystyle A\in \mathbb {K} ^{m\times n}}$, a pseudoinverse of A is defined as a matrix ${\displaystyle A^{+}\in \mathbb {K} ^{n\times m}}$ satisfying all of the following four criteria, known as the Moore–Penrose conditions:[4][5]

1. ${\displaystyle AA^{+}}$ need not be the general identity matrix, but it maps all column vectors of A to themselves: ${\displaystyle AA^{+}A=\;A.}$
2. ${\displaystyle A^{+}}$ acts like a weak inverse: ${\displaystyle A^{+}AA^{+}=\;A^{+}.}$
3. ${\displaystyle AA^{+}}$ is Hermitian: ${\displaystyle \left(AA^{+}\right)^{*}=\;AA^{+}.}$
4. ${\displaystyle A^{+}A}$ is also Hermitian: ${\displaystyle \left(A^{+}A\right)^{*}=\;A^{+}A.}$

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

The pseudoinverse ${\displaystyle A^{+}}$ exists for any matrix ${\displaystyle A\in \mathbb {K} ^{m\times n}}$. If furthermore ${\displaystyle A}$ is full rank, that is, its rank is ${\displaystyle \min\{m,n\}}$, then ${\displaystyle A^{+}}$ can be given a particularly simple algebraic expression. In particular:

• When ${\displaystyle A}$ has linearly independent columns (equivalently, ${\displaystyle A}$ is injective, and thus ${\displaystyle A^{*}A}$ is invertible), ${\displaystyle A^{+}}$ can be computed as${\displaystyle A^{+}=\left(A^{*}A\right)^{-1}A^{*}.}$This particular pseudoinverse is a left inverse, that is, ${\displaystyle A^{+}A=I}$.
• If, on the other hand, ${\displaystyle A}$ has linearly independent rows (equivalently, ${\displaystyle A}$ is surjective, and thus ${\displaystyle AA^{*}}$ is invertible), ${\displaystyle A^{+}}$ can be computed as${\displaystyle A^{+}=A^{*}\left(AA^{*}\right)^{-1}.}$This is a right inverse, as ${\displaystyle AA^{+}=I}$.

In the more general case, the pseudoinverse can be expressed leveraging the singular value decomposition. Any matrix can be decomposed as ${\displaystyle A=UDV^{*}}$ for some isometries ${\displaystyle U,V}$ and diagonal nonnegative real matrix ${\displaystyle D}$. The pseudoinverse can then be written as ${\displaystyle A^{+}=VD^{+}U^{*}}$, where ${\displaystyle D^{+}}$ is the pseudoinverse of ${\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 ${\displaystyle AA^{+}=UU^{*}}$ and ${\displaystyle A^{+}A=VV^{*}}$, which are the projections onto image and support of ${\displaystyle A}$, respectively.

## Properties

### Existence and uniqueness

As discussed above, for any matrix ${\displaystyle A}$ there is one and only one pseudoinverse ${\displaystyle A^{+}}$.[5]

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

### Basic properties

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

• If ${\displaystyle A}$ has real entries, then so does ${\displaystyle A^{+}}$.
• If ${\displaystyle A}$ is invertible, its pseudoinverse is its inverse. That is, ${\displaystyle A^{+}=A^{-1}}$.[7]: 243
• The pseudoinverse of the pseudoinverse is the original matrix: ${\displaystyle \left(A^{+}\right)^{+}=A}$.[7]: 245
• Pseudoinversion commutes with transposition, complex conjugation, and taking the conjugate transpose:[7]: 245  ${\displaystyle \left(A^{\operatorname {T} }\right)^{+}=\left(A^{+}\right)^{\operatorname {T} },\quad \left({\overline {A}}\right)^{+}={\overline {A^{+}}},\quad \left(A^{*}\right)^{+}=\left(A^{+}\right)^{*}.}$
• The pseudoinverse of a scalar multiple of ${\displaystyle A}$ is the reciprocal multiple of ${\displaystyle A^{+}}$:${\displaystyle \left(\alpha A\right)^{+}=\alpha ^{-1}A^{+}}$ for ${\displaystyle \alpha \neq 0}$.
• The kernel and image of the pseudoinverse coincide with those of the conjugate transpose: ${\displaystyle \ker \left(A^{+}\right)=\ker \left(A^{*}\right)}$ and ${\displaystyle \operatorname {ran} \left(A^{+}\right)=\operatorname {ran} \left(A^{*}\right)}$.

#### Identities

The following identity formula can be used to cancel or expand certain subexpressions involving pseudoinverses: ${\displaystyle A={}A{}A^{*}{}A^{+*}{}={}A^{+*}{}A^{*}{}A.}$ Equivalently, substituting ${\displaystyle A^{+}}$ for ${\displaystyle A}$ gives ${\displaystyle A^{+}={}A^{+}{}A^{+*}{}A^{*}{}={}A^{*}{}A^{+*}{}A^{+},}$ while substituting ${\displaystyle A^{*}}$ for ${\displaystyle A}$ gives ${\displaystyle A^{*}={}A^{*}{}A{}A^{+}{}={}A^{+}{}A{}A^{*}.}$

### Reduction to Hermitian case

The computation of the pseudoinverse is reducible to its construction in the Hermitian case. This is possible through the equivalences: ${\displaystyle A^{+}=\left(A^{*}A\right)^{+}A^{*},}$ ${\displaystyle A^{+}=A^{*}\left(AA^{*}\right)^{+},}$

as ${\displaystyle A^{*}A}$ and ${\displaystyle AA^{*}}$ are Hermitian.

### Pseudoinverse of products

The equality ${\displaystyle (AB)^{+}=B^{+}A^{+}}$ does not hold in general. Rather, suppose ${\displaystyle A\in \mathbb {K} ^{m\times n},\ B\in \mathbb {K} ^{n\times p}}$. Then the following are equivalent:[8]

1. ${\displaystyle (AB)^{+}=B^{+}A^{+}}$
2. {\displaystyle {\begin{aligned}A^{+}ABB^{*}A^{*}&=BB^{*}A^{*},\\BB^{+}A^{*}AB&=A^{*}AB.\end{aligned}}}
3. {\displaystyle {\begin{aligned}\left(A^{+}ABB^{*}\right)^{*}&=A^{+}ABB^{*},\\\left(A^{*}ABB^{+}\right)^{*}&=A^{*}ABB^{+}.\end{aligned}}}
4. ${\displaystyle A^{+}ABB^{*}A^{*}ABB^{+}=BB^{*}A^{*}A}$
5. {\displaystyle {\begin{aligned}A^{+}AB&=B(AB)^{+}AB,\\BB^{+}A^{*}&=A^{*}AB(AB)^{+}.\end{aligned}}}

The following are sufficient conditions for ${\displaystyle (AB)^{+}=B^{+}A^{+}}$:

1. ${\displaystyle A}$ has orthonormal columns (then ${\displaystyle A^{*}A=A^{+}A=I_{n}}$),   or
2. ${\displaystyle B}$ has orthonormal rows (then ${\displaystyle BB^{*}=BB^{+}=I_{n}}$),   or
3. ${\displaystyle A}$ has linearly independent columns (then ${\displaystyle A^{+}A=I}$ ) and ${\displaystyle B}$ has linearly independent rows (then ${\displaystyle BB^{+}=I}$),   or
4. ${\displaystyle B=A^{*}}$, or
5. ${\displaystyle B=A^{+}}$.

The following is a necessary condition for ${\displaystyle (AB)^{+}=B^{+}A^{+}}$:

1. ${\displaystyle (A^{+}A)(BB^{+})=(BB^{+})(A^{+}A)}$

The fourth sufficient condition yields the equalities {\displaystyle {\begin{aligned}\left(AA^{*}\right)^{+}&=A^{+*}A^{+},\\\left(A^{*}A\right)^{+}&=A^{+}A^{+*}.\end{aligned}}}

Here is a counterexample where ${\displaystyle (AB)^{+}\neq B^{+}A^{+}}$:

${\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}}^{+}}$

### Projectors

${\displaystyle P=AA^{+}}$ and ${\displaystyle Q=A^{+}A}$ are orthogonal projection operators, that is, they are Hermitian (${\displaystyle P=P^{*}}$, ${\displaystyle Q=Q^{*}}$) and idempotent (${\displaystyle P^{2}=P}$ and ${\displaystyle Q^{2}=Q}$). The following hold:

• ${\displaystyle PA=AQ=A}$ and ${\displaystyle A^{+}P=QA^{+}=A^{+}}$
• ${\displaystyle P}$ is the orthogonal projector onto the range of ${\displaystyle A}$ (which equals the orthogonal complement of the kernel of ${\displaystyle A^{*}}$).
• ${\displaystyle Q}$ is the orthogonal projector onto the range of ${\displaystyle A^{*}}$ (which equals the orthogonal complement of the kernel of ${\displaystyle A}$).
• ${\displaystyle I-Q=I-A^{+}A}$ is the orthogonal projector onto the kernel of ${\displaystyle A}$.
• ${\displaystyle I-P=I-AA^{+}}$ is the orthogonal projector onto the kernel of ${\displaystyle A^{*}}$.[5]

The last two properties imply the following identities:

• ${\displaystyle A\,\ \left(I-A^{+}A\right)=\left(I-AA^{+}\right)A\ \ =0}$
• ${\displaystyle A^{*}\left(I-AA^{+}\right)=\left(I-A^{+}A\right)A^{*}=0}$

Another property is the following: if ${\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 ${\displaystyle B\in \mathbb {K} ^{m\times n}}$ the following equation holds:[9] ${\displaystyle A(BA)^{+}=(BA)^{+}}$

This can be proven by defining matrices ${\displaystyle C=BA}$, ${\displaystyle D=A(BA)^{+}}$, and checking that ${\displaystyle D}$ is indeed a pseudoinverse for ${\displaystyle C}$ by verifying that the defining properties of the pseudoinverse hold, when ${\displaystyle A}$ is Hermitian and idempotent.

From the last property it follows that, if ${\displaystyle A\in \mathbb {K} ^{n\times n}}$ is Hermitian and idempotent, for any matrix ${\displaystyle B\in \mathbb {K} ^{n\times m}}$ ${\displaystyle (AB)^{+}A=(AB)^{+}}$

Finally, if ${\displaystyle A}$ is an orthogonal projection matrix, then its pseudoinverse trivially coincides with the matrix itself, that is, ${\displaystyle A^{+}=A}$.

### Geometric construction

If we view the matrix as a linear map ${\displaystyle A:\mathbb {K} ^{n}\to \mathbb {K} ^{m}}$ over the field ${\displaystyle \mathbb {K} }$ then ${\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, ${\displaystyle \ker }$ for the kernel of a map, and ${\displaystyle \operatorname {ran} }$ for the image of a map. Notice that ${\displaystyle \mathbb {K} ^{n}=\left(\ker A\right)^{\perp }\oplus \ker A}$ and ${\displaystyle \mathbb {K} ^{m}=\operatorname {ran} A\oplus \left(\operatorname {ran} A\right)^{\perp }}$. The restriction ${\displaystyle A:\left(\ker A\right)^{\perp }\to \operatorname {ran} A}$ is then an isomorphism. This implies that ${\displaystyle A^{+}}$ on ${\displaystyle \operatorname {ran} A}$ is the inverse of this isomorphism, and is zero on ${\displaystyle \left(\operatorname {ran} A\right)^{\perp }.}$

In other words: To find ${\displaystyle A^{+}b}$ for given ${\displaystyle b}$ in ${\displaystyle \mathbb {K} ^{m}}$, first project ${\displaystyle b}$ orthogonally onto the range of ${\displaystyle A}$, finding a point ${\displaystyle p(b)}$ in the range. Then form ${\displaystyle A^{-1}(\{p(b)\})}$, that is, find those vectors in ${\displaystyle \mathbb {K} ^{n}}$ that ${\displaystyle A}$ sends to ${\displaystyle p(b)}$. This will be an affine subspace of ${\displaystyle \mathbb {K} ^{n}}$ parallel to the kernel of ${\displaystyle A}$. The element of this subspace that has the smallest length (that is, is closest to the origin) is the answer ${\displaystyle A^{+}b}$ we are looking for. It can be found by taking an arbitrary member of ${\displaystyle A^{-1}(\{p(b)\})}$ and projecting it orthogonally onto the orthogonal complement of the kernel of ${\displaystyle A}$.

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

### Limit relations

The pseudoinverse are limits: ${\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 ${\displaystyle \left(AA^{*}\right)^{-1}}$ or ${\displaystyle \left(A^{*}A\right)^{-1}}$ do not exist.[5]: 263

### Continuity

In contrast to ordinary matrix inversion, the process of taking pseudoinverses is not continuous: if the sequence ${\displaystyle \left(A_{n}\right)}$ converges to the matrix ${\displaystyle A}$ (in the maximum norm or Frobenius norm, say), then ${\displaystyle (A_{n})^{+}}$ need not converge to ${\displaystyle A^{+}}$. However, if all the matrices ${\displaystyle A_{n}}$ have the same rank as ${\displaystyle A}$, ${\displaystyle (A_{n})^{+}}$ will converge to ${\displaystyle A^{+}}$.[10]

### Derivative

Let ${\displaystyle x\mapsto A(x)}$ be a real-valued differentiable matrix function with constant rank at a point ${\displaystyle x_{0}}$. The derivative of ${\displaystyle x\mapsto A^{+}(x)}$ at ${\displaystyle x_{0}}$ may be calculated in terms of the derivative of ${\displaystyle A}$ at ${\displaystyle x_{0}}$:[11] ${\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 ${\displaystyle A}$, ${\displaystyle A^{+}}$ and derivatives on the right side are evaluated at ${\displaystyle x_{0}}$ (that is, ${\displaystyle 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]

## Examples

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

• For ${\displaystyle A={\begin{pmatrix}0&0\\0&0\end{pmatrix}},}$ the pseudoinverse is ${\displaystyle A^{+}={\begin{pmatrix}0&0\\0&0\end{pmatrix}}.}$ The uniqueness of this pseudoinverse can be seen from the requirement ${\displaystyle A^{+}=A^{+}AA^{+}}$, since multiplication by a zero matrix would always produce a zero matrix.
• For ${\displaystyle A={\begin{pmatrix}1&0\\1&0\end{pmatrix}},}$ the pseudoinverse is ${\displaystyle A^{+}={\begin{pmatrix}{\frac {1}{2}}&{\frac {1}{2}}\\0&0\end{pmatrix}}}$.
Indeed, ${\displaystyle A\,A^{+}={\begin{pmatrix}{\frac {1}{2}}&{\frac {1}{2}}\\{\frac {1}{2}}&{\frac {1}{2}}\end{pmatrix}}}$, and thus ${\displaystyle A\,A^{+}A={\begin{pmatrix}1&0\\1&0\end{pmatrix}}=A}$. Similarly, ${\displaystyle A^{+}A={\begin{pmatrix}1&0\\0&0\end{pmatrix}}}$, and thus ${\displaystyle A^{+}A\,A^{+}={\begin{pmatrix}{\frac {1}{2}}&{\frac {1}{2}}\\0&0\end{pmatrix}}=A^{+}}$.
Note that ${\displaystyle A}$ is neither injective nor surjective, and thus the pseudoinverse cannot be computed via ${\displaystyle A^{+}=\left(A^{*}A\right)^{-1}A^{*}}$ nor ${\displaystyle A^{+}=A^{*}\left(AA^{*}\right)^{-1}}$, as ${\displaystyle A^{*}A}$ and ${\displaystyle AA^{*}}$ are both singular, and furthermore ${\displaystyle A^{+}}$ is neither a left nor a right inverse.
Nonetheless, the pseudoinverse can be computed via SVD observing that ${\displaystyle A={\sqrt {2}}\left({\frac {\mathbf {e} _{1}+\mathbf {e} _{2}}{\sqrt {2}}}\right)\mathbf {e} _{1}^{*}}$, and thus ${\displaystyle A^{+}={\frac {1}{\sqrt {2}}}\,\mathbf {e} _{1}\left({\frac {\mathbf {e} _{1}+\mathbf {e} _{2}}{\sqrt {2}}}\right)^{*}}$.
• For ${\displaystyle A={\begin{pmatrix}1&0\\-1&0\end{pmatrix}},}$ ${\displaystyle A^{+}={\begin{pmatrix}{\frac {1}{2}}&-{\frac {1}{2}}\\0&0\end{pmatrix}}.}$
• For ${\displaystyle A={\begin{pmatrix}1&0\\2&0\end{pmatrix}},}$ ${\displaystyle A^{+}={\begin{pmatrix}{\frac {1}{5}}&{\frac {2}{5}}\\0&0\end{pmatrix}}}$. The denominators are here ${\displaystyle 5=1^{2}+2^{2}}$.
• For ${\displaystyle A={\begin{pmatrix}1&1\\1&1\end{pmatrix}},}$ ${\displaystyle A^{+}={\begin{pmatrix}{\frac {1}{4}}&{\frac {1}{4}}\\{\frac {1}{4}}&{\frac {1}{4}}\end{pmatrix}}.}$
• For ${\displaystyle A={\begin{pmatrix}1&0\\0&1\\0&1\end{pmatrix}},}$ the pseudoinverse is ${\displaystyle A^{+}={\begin{pmatrix}1&0&0\\0&{\frac {1}{2}}&{\frac {1}{2}}\end{pmatrix}}}$.
For this matrix, the left inverse exists and thus equals ${\displaystyle A^{+}}$, indeed, ${\displaystyle A^{+}A={\begin{pmatrix}1&0\\0&1\end{pmatrix}}.}$

## 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 ${\displaystyle x}$ is zero if ${\displaystyle x}$ is zero and the reciprocal of ${\displaystyle x}$ otherwise: ${\displaystyle x^{+}={\begin{cases}0,&{\mbox{if }}x=0;\\x^{-1},&{\mbox{otherwise}}.\end{cases}}}$

### 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:

${\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}}}$

### Diagonal matrices

The pseudoinverse of a squared diagonal matrix is obtained by taking the reciprocal of the nonzero diagonal elements. Formally, if ${\displaystyle D}$ is a squared diagonal matrix with ${\displaystyle D={\tilde {D}}\oplus \mathbf {0} _{k\times k}}$ and ${\displaystyle {\tilde {D}}>0}$, then ${\displaystyle D^{+}={\tilde {D}}^{-1}\oplus \mathbf {0} _{k\times k}}$. More generally, if ${\displaystyle A}$ is any ${\displaystyle m\times n}$ rectangular matrix whose only nonzero elements are on the diagonal, meaning ${\displaystyle A_{ij}=\delta _{ij}a_{i}}$, ${\displaystyle a_{i}\in \mathbb {K} }$, then ${\displaystyle A^{+}}$ is a ${\displaystyle n\times m}$ rectangular matrix whose diagonal elements are the reciprocal of the original ones, that is, ${\displaystyle A_{ii}\neq 0\implies A_{ii}^{+}=1/A_{ii}}$.

### Linearly independent columns

If the rank of ${\displaystyle A}$ is identical to its column rank, ${\displaystyle n}$, (for ${\displaystyle n\leq m}$,) there are ${\displaystyle n}$ linearly independent columns, and ${\displaystyle A^{*}A}$ is invertible. In this case, an explicit formula is:[14] ${\displaystyle A^{+}=\left(A^{*}A\right)^{-1}A^{*}.}$

It follows that ${\displaystyle A^{+}}$ is then a left inverse of ${\displaystyle A}$:   ${\displaystyle A^{+}A=I_{n}}$.

### Linearly independent rows

If the rank of ${\displaystyle A}$ is identical to its row rank, ${\displaystyle m}$, (for ${\displaystyle m\leq n}$,) there are ${\displaystyle m}$ linearly independent rows, and ${\displaystyle AA^{*}}$ is invertible. In this case, an explicit formula is: ${\displaystyle A^{+}=A^{*}\left(AA^{*}\right)^{-1}.}$

It follows that ${\displaystyle A^{+}}$ is a right inverse of ${\displaystyle A}$:   ${\displaystyle AA^{+}=I_{m}}$.

### Orthonormal columns or rows

This is a special case of either full column rank or full row rank (treated above). If ${\displaystyle A}$ has orthonormal columns (${\displaystyle A^{*}A=I_{n}}$) or orthonormal rows (${\displaystyle AA^{*}=I_{m}}$), then: ${\displaystyle A^{+}=A^{*}.}$

### Normal matrices

If ${\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 ${\displaystyle A}$ commuting with its transpose implies that it commutes with its pseudoinverse.

### EP matrices

A (square) matrix ${\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 ${\displaystyle A}$. A polynomial ${\displaystyle p(t)}$ such that ${\displaystyle A^{+}=p(A)}$ can be easily obtained from the characteristic polynomial of ${\displaystyle A}$ or, more generally, from any annihilating polynomial of ${\displaystyle A}$.[15]

### Orthogonal projection matrices

This is a special case of a normal matrix with eigenvalues 0 and 1. If ${\displaystyle A}$ is an orthogonal projection matrix, that is, ${\displaystyle A=A^{*}}$ and ${\displaystyle A^{2}=A}$, then the pseudoinverse trivially coincides with the matrix itself: ${\displaystyle A^{+}=A.}$

### Circulant matrices

For a circulant matrix ${\displaystyle C}$, the singular value decomposition is given by the Fourier transform, that is, the singular values are the Fourier coefficients. Let ${\displaystyle {\mathcal {F}}}$ be the Discrete Fourier Transform (DFT) matrix; then[16] {\displaystyle {\begin{aligned}C&={\mathcal {F}}\cdot \Sigma \cdot {\mathcal {F}}^{*},\\C^{+}&={\mathcal {F}}\cdot \Sigma ^{+}\cdot {\mathcal {F}}^{*}.\end{aligned}}}

## Construction

### Rank decomposition

Let ${\displaystyle r\leq \min(m,n)}$ denote the rank of ${\displaystyle A\in \mathbb {K} ^{m\times n}}$. Then ${\displaystyle A}$ can be (rank) decomposed as ${\displaystyle A=BC}$ where ${\displaystyle B\in \mathbb {K} ^{m\times r}}$ and ${\displaystyle C\in \mathbb {K} ^{r\times n}}$ are of rank ${\displaystyle r}$. Then ${\displaystyle A^{+}=C^{+}B^{+}=C^{*}\left(CC^{*}\right)^{-1}\left(B^{*}B\right)^{-1}B^{*}}$.

### The QR method

For ${\displaystyle \mathbb {K} \in \{\mathbb {R} ,\mathbb {C} \}}$ computing the product ${\displaystyle AA^{*}}$ or ${\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 ${\displaystyle A}$ may be used instead.

Consider the case when ${\displaystyle A}$ is of full column rank, so that ${\displaystyle A^{+}=\left(A^{*}A\right)^{-1}A^{*}}$. Then the Cholesky decomposition ${\displaystyle A^{*}A=R^{*}R}$, where ${\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, ${\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 ${\displaystyle A^{*}A}$ explicitly, by alternatively using the QR decomposition of ${\displaystyle A=QR}$, where ${\displaystyle Q}$ has orthonormal columns, ${\displaystyle Q^{*}Q=I}$, and ${\displaystyle R}$ is upper triangular. Then ${\displaystyle A^{*}A\,=\,(QR)^{*}(QR)\,=\,R^{*}Q^{*}QR\,=\,R^{*}R,}$

so ${\displaystyle R}$ is the Cholesky factor of ${\displaystyle A^{*}A}$.

The case of full row rank is treated similarly by using the formula ${\displaystyle A^{+}=A^{*}\left(AA^{*}\right)^{-1}}$ and using a similar argument, swapping the roles of ${\displaystyle A}$ and ${\displaystyle A^{*}}$.

### Using polynomials in matrices

For an arbitrary ${\displaystyle A\in \mathbb {K} ^{m\times n}}$, one has that ${\displaystyle A^{*}A}$ is normal and, as a consequence, an EP matrix. One can then find a polynomial ${\displaystyle p(t)}$ such that ${\displaystyle (A^{*}A)^{+}=p(A^{*}A)}$. In this case one has that the pseudoinverse of ${\displaystyle A}$ is given by[15] ${\displaystyle 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.[14][5][17] If ${\displaystyle A=U\Sigma V^{*}}$ is the singular value decomposition of ${\displaystyle A}$, then ${\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 ${\displaystyle A}$ has a singular value 0 (a diagonal entry of the matrix ${\displaystyle \Sigma }$ above), then modifying ${\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.

### 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 ${\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 ${\displaystyle A}$ if it is started with an appropriate ${\displaystyle A_{0}}$ satisfying ${\displaystyle A_{0}A=\left(A_{0}A\right)^{*}}$. The choice ${\displaystyle A_{0}=\alpha A^{*}}$ (where ${\displaystyle 0<\alpha <2/\sigma _{1}^{2}(A)}$, with ${\displaystyle \sigma _{1}(A)}$ denoting the largest singular value of ${\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 ${\displaystyle A_{i}}$ enters the region of quadratic convergence.[19] However, if started with ${\displaystyle A_{0}}$ already close to the Moore–Penrose inverse and ${\displaystyle A_{0}A=\left(A_{0}A\right)^{*}}$, for example ${\displaystyle A_{0}:=\left(A^{*}A+\delta I\right)^{-1}A^{*}}$, convergence is fast (quadratic).

### Updating the pseudoinverse

For the cases where ${\displaystyle A}$ has full row or column rank, and the inverse of the correlation matrix (${\displaystyle AA^{*}}$ for ${\displaystyle A}$ with full row rank or ${\displaystyle A^{*}A}$ for full column rank) is already known, the pseudoinverse for matrices related to ${\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]

### 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.[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.

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

## Applications

### Linear least-squares

The pseudoinverse provides a least squares solution to a system of linear equations.[26] For ${\displaystyle A\in \mathbb {K} ^{m\times n}}$, given a system of linear equations ${\displaystyle Ax=b,}$

in general, a vector ${\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 ${\displaystyle b}$ is in the image of ${\displaystyle A}$, and is unique if and only if ${\displaystyle A}$ is injective. The pseudoinverse solves the "least-squares" problem as follows:

• ${\displaystyle \forall x\in \mathbb {K} ^{n}}$, we have ${\displaystyle \left\|Ax-b\right\|_{2}\geq \left\|Az-b\right\|_{2}}$ where ${\displaystyle z=A^{+}b}$ and ${\displaystyle \|\cdot \|_{2}}$ denotes the Euclidean norm. This weak inequality holds with equality if and only if ${\displaystyle x=A^{+}b+\left(I-A^{+}A\right)w}$ for any vector ${\displaystyle w}$; this provides an infinitude of minimizing solutions unless ${\displaystyle A}$ has full column rank, in which case ${\displaystyle \left(I-A^{+}A\right)}$ is a zero matrix.[27] The solution with minimum Euclidean norm is ${\displaystyle z.}$[27]

This result is easily extended to systems with multiple right-hand sides, when the Euclidean norm is replaced by the Frobenius norm. Let ${\displaystyle B\in \mathbb {K} ^{m\times p}}$.

• ${\displaystyle \forall X\in \mathbb {K} ^{n\times p}}$, we have ${\displaystyle \|AX-B\|_{\mathrm {F} }\geq \|AZ-B\|_{\mathrm {F} }}$ where ${\displaystyle Z=A^{+}B}$ and ${\displaystyle \|\cdot \|_{\mathrm {F} }}$ denotes the Frobenius norm.

### Obtaining all solutions of a linear system

If the linear system

${\displaystyle Ax=b}$

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

${\displaystyle x=A^{+}b+\left[I-A^{+}A\right]w}$

for arbitrary vector ${\displaystyle w}$. Solution(s) exist if and only if ${\displaystyle AA^{+}b=b}$.[28] If the latter holds, then the solution is unique if and only if ${\displaystyle A}$ has full column rank, in which case ${\displaystyle I-A^{+}A}$ is a zero matrix. If solutions exist but ${\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.

### Minimum norm solution to a linear system

For linear systems ${\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 ${\displaystyle \|x\|_{2}}$ among all solutions.

• If ${\displaystyle Ax=b}$ is satisfiable, the vector ${\displaystyle z=A^{+}b}$ is a solution, and satisfies ${\displaystyle \|z\|_{2}\leq \|x\|_{2}}$ 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 ${\displaystyle B\in \mathbb {K} ^{m\times p}}$.

• If ${\displaystyle AX=B}$ is satisfiable, the matrix ${\displaystyle Z=A^{+}B}$ is a solution, and satisfies ${\displaystyle \|Z\|_{\mathrm {F} }\leq \|X\|_{\mathrm {F} }}$ for all solutions.

### Condition number

Using the pseudoinverse and a matrix norm, one can define a condition number for any matrix: ${\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 ${\displaystyle A}$ can lead to huge errors in the entries of the solution.[29]

## Generalizations

In order to solve more general least-squares problems, one can define Moore–Penrose inverses for all continuous linear operators ${\displaystyle A:H_{1}\rightarrow H_{2}}$ between two Hilbert spaces ${\displaystyle H_{1}}$ and ${\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 ${\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 ${\displaystyle \operatorname {rank} (A)=\operatorname {rank} \left(A^{*}A\right)=\operatorname {rank} \left(AA^{*}\right)}$, where ${\displaystyle A^{*}}$ denotes the result of applying the involution operation to the transpose of ${\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 ${\displaystyle A={\begin{bmatrix}1&i\end{bmatrix}}^{\operatorname {T} }}$. Observe that ${\displaystyle \operatorname {rank} \left(AA^{\operatorname {T} }\right)=1}$ while ${\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.

## Notes

1. ^
2. ^ Moore, E. H. (1920). "On the reciprocal of the general algebraic matrix". Bulletin of the American Mathematical Society. 26 (9): 394–95. doi:10.1090/S0002-9904-1920-03322-7.
3. ^ Bjerhammar, Arne (1951). "Application of calculus of matrices to method of least squares; with special references to geodetic calculations". Trans. Roy. Inst. Tech. Stockholm. 49.
4. ^ a b
5. Golub, Gene H.; Charles F. Van Loan (1996). Matrix computations (3rd ed.). Baltimore: Johns Hopkins. pp. 257–258. ISBN 978-0-8018-5414-9.
6. ^
7. ^ a b c Stoer, Josef; Bulirsch, Roland (2002). Introduction to Numerical Analysis (3rd ed.). Berlin, New York: Springer-Verlag. ISBN 978-0-387-95452-3..
8. ^ Greville, T. N. E. (1966-10-01). "Note on the Generalized Inverse of a Matrix Product". SIAM Review. 8 (4): 518–521. Bibcode:1966SIAMR...8..518G. doi:10.1137/1008107. ISSN 0036-1445.
9. ^ Maciejewski, Anthony A.; Klein, Charles A. (1985). "Obstacle Avoidance for Kinematically Redundant Manipulators in Dynamically Varying Environments". International Journal of Robotics Research. 4 (3): 109–117. doi:10.1177/027836498500400308. hdl:10217/536. S2CID 17660144.
10. ^ Rakočević, Vladimir (1997). "On continuity of the Moore–Penrose and Drazin inverses" (PDF). Matematički Vesnik. 49: 163–72.
11. ^ Golub, G. H.; Pereyra, V. (April 1973). "The Differentiation of Pseudo-Inverses and Nonlinear Least Squares Problems Whose Variables Separate". SIAM Journal on Numerical Analysis. 10 (2): 413–32. Bibcode:1973SJNA...10..413G. doi:10.1137/0710036. JSTOR 2156365.
12. ^ Hjørungnes, Are (2011). Complex-valued matrix derivatives: with applications in signal processing and communications. New York: Cambridge university press. p. 52. ISBN 9780521192644.
13. ^ Liu, Shuangzhe; Trenkler, Götz; Kollo, Tõnu; von Rosen, Dietrich; Baksalary, Oskar Maria (2023). "Professor Heinz Neudecker and matrix differential calculus". Statistical Papers. doi:10.1007/s00362-023-01499-w.
14. ^ a b
15. ^ a b Bajo, I. (2021). "Computing Moore–Penrose Inverses with Polynomials in Matrices". American Mathematical Monthly. 128 (5): 446–456. doi:10.1080/00029890.2021.1886840. hdl:11093/6146.
16. ^ Stallings, W. T.; Boullion, T. L. (1972). "The Pseudoinverse of an r-Circulant Matrix". Proceedings of the American Mathematical Society. 34 (2): 385–88. doi:10.2307/2038377. JSTOR 2038377.
17. ^ Linear Systems & Pseudo-Inverse
18. ^ Ben-Israel, Adi; Cohen, Dan (1966). "On Iterative Computation of Generalized Inverses and Associated Projections". SIAM Journal on Numerical Analysis. 3 (3): 410–19. Bibcode:1966SJNA....3..410B. doi:10.1137/0703035. JSTOR 2949637.pdf
19. ^ Söderström, Torsten; Stewart, G. W. (1974). "On the Numerical Properties of an Iterative Method for Computing the Moore–Penrose Generalized Inverse". SIAM Journal on Numerical Analysis. 11 (1): 61–74. Bibcode:1974SJNA...11...61S. doi:10.1137/0711008. JSTOR 2156431.
20. ^ Gramß, Tino (1992). Worterkennung mit einem künstlichen neuronalen Netzwerk (PhD dissertation). Georg-August-Universität zu Göttingen. OCLC 841706164.
21. ^ Emtiyaz, Mohammad (February 27, 2008). "Updating Inverse of a Matrix When a Column is Added/Removed" (PDF).
22. ^ Meyer, Carl D. Jr. (1973). "Generalized inverses and ranks of block matrices". SIAM J. Appl. Math. 25 (4): 597–602. doi:10.1137/0125057.
23. ^ Meyer, Carl D. Jr. (1973). "Generalized inversion of modified matrices". SIAM J. Appl. Math. 24 (3): 315–23. doi:10.1137/0124033.
24. ^
25. ^
26. ^ Penrose, Roger (1956). "On best approximate solution of linear matrix equations". Proceedings of the Cambridge Philosophical Society. 52 (1): 17–19. Bibcode:1956PCPS...52...17P. doi:10.1017/S0305004100030929. S2CID 122260851.
27. ^ a b Planitz, M. (October 1979). "Inconsistent systems of linear equations". Mathematical Gazette. 63 (425): 181–85. doi:10.2307/3617890. JSTOR 3617890. S2CID 125601192.
28. ^ a b James, M. (June 1978). "The generalised inverse". Mathematical Gazette. 62 (420): 109–14. doi:10.1017/S0025557200086460. S2CID 126385532.
29. ^ a b Hagen, Roland; Roch, Steffen; Silbermann, Bernd (2001). "Section 2.1.2". C*-algebras and Numerical Analysis. CRC Press.
30. ^ Pearl, Martin H. (1968-10-01). "Generalized inverses of matrices with entries taken from an arbitrary field". Linear Algebra and Its Applications. 1 (4): 571–587. doi:10.1016/0024-3795(68)90028-1. ISSN 0024-3795.