PseudoInverse

PseudoInverse[m]

finds the pseudoinverse of a rectangular matrix.

Details and Options

  • PseudoInverse works on both symbolic and numerical matrices.
  • For a square matrix, PseudoInverse gives the MoorePenrose inverse.
  • For numerical matrices, PseudoInverse is based on SingularValueDecomposition.
  • PseudoInverse[m,Tolerance->t] specifies that singular values smaller than t times the maximum singular value should be dropped.
  • With the default setting Tolerance->Automatic, singular values are dropped when they are less than 100 times 10-p, where p is Precision[m].
  • For nonsingular square matrices M, the pseudoinverse M(-1) is equivalent to the standard inverse.

Examples

open allclose all

Basic Examples  (5)

Find the pseudoinverse of an invertible matrix:

The pseudoinverse is merely the inverse:

Find the pseudoinverse of a singular matrix:

The determinant of is zero, so it does not have a true inverse:

For a pseudoinverse, both and :

However, in this particular case neither nor is an identity matrix:

Find the pseudoinverse of a rectangular matrix:

In this particular case, is an identity matrix:

However, is not:

Find the pseudoinverse of a row matrix:

Find the pseudoinverse of a zero matrix:

Scope  (10)

Basic Uses  (6)

Find the pseudoinverse of a machine-precision matrix:

Pseudoinverse of a complex matrix:

Pseudoinverse of an exact matrix:

Pseudoinverse of an arbitrary-precision matrix:

Compute a symbolic pseudoinverse:

The inversion of large machine-precision matrices is efficient:

Special Matrices  (4)

The pseudoinverse of a sparse matrix is returned as a normal matrix:

Format the result:

When possible, the pseudoinverse of a structured matrix is returned as another structured matrix:

This is not always possible:

IdentityMatrix[n] is its own pseudoinverse:

The pseudoinverse of IdentityMatrix[{m,n}] is a transposition:

Compute the pseudoinverse for HilbertMatrix:

Options  (1)

Tolerance  (1)

m is a 16×16 Hilbert matrix:

Some singular values are below the default tolerance for machine precision:

Compute the pseudoinverse with the default tolerance:

It is not a true inverse since some singular values were considered to be effectively zero:

Compute the pseudoinverse with no tolerance:

Even though no singular values were considered zero, it is worse due to numerical error:

Applications  (8)

Equation Solving  (4)

Solve the following system of equations using PseudoInverse:

Rewrite the system in matrix form:

The general solution is given by for an arbitrary vector :

Since the TemplateBox[{i}, CTraditional] dropped out, the solution is unique, as can be verified using SolveValues:

Find all solutions of the following system of equations:

First, write the coefficient matrix , vector variable and constant vector :

Verify the rewrite:

The general solution is given by for an arbitrary vector :

Verify the solution:

Although there are three parameters, this solution represents a line:

This is because the null space of is one-dimensional:

Hence it is possible to reparameterize to eliminate two of the parameters:

This parameterization gives the answer in the same form as SolveValues:

Find the minimum Frobenius-norm solution to , with and as follows:

The minimum norm solution is :

Compute the Frobenius norm of :

As in the vector case, the general solution is given by , with now an arbitrary matrix:

The minimum occurs when all the TemplateBox[{TemplateBox[{i, j}, RowDefault]}, CTraditional] are zero, confirming that is the minimum-norm solution:

In this case there is no solution to :

An approximate solution that minimizes the norm of is given by :

Compare to general minimization:

A more general solution is given by :

All these vectors minimize TemplateBox[{{{m, ., x}, -, b}}, Norm]:

Although there are three parameters in , it represents a line:

This is because the null space of is one-dimensional:

Least Squares and Curve Fitting  (4)

For the matrix and vector that follow, find a vector that minimizes TemplateBox[{{{m, ., x}, -, b}}, Norm]:

One solution, in this case unique, is given by :

This result could also have been obtained using LeastSquares[m,b]:

Confirm the answer using Minimize:

For the matrices and that follow, find a matrix that minimizes TemplateBox[{{{m, ., x}, -, b}}, Norm]_F:

One solution, in this case unique, is given by :

This result could also have been obtained using LeastSquares[m,b]:

Confirm the answer using Minimize:

PseudoInverse can be used to find a best-fit curve to data. Consider the following data:

Extract the and coordinates from the data:

Construct a design matrix, whose columns are and , for fitting to a line :

Get the coefficients and for a linear leastsquares fit:

Verify the coefficients using Fit:

Plot the best-fit curve along with the data:

Find the best-fit parabola to the following data:

Extract the and coordinates from the data:

Construct a design matrix, whose columns are , and , for fitting to a line :

Get the coefficients , and for a leastsquares fit:

Verify the coefficients using Fit:

Plot the best-fit curve along with the data:

Properties & Relations  (14)

For a nonsingular matrix, the pseudoinverse is the same as the inverse:

PseudoInverse is involutive, :

PseudoInverse commutes with Transpose, i.e (TemplateBox[{m}, Transpose])^((-1))=TemplateBox[{{(, {m, ^, {(, {(, {-, 1}, )}, )}}, )}}, Transpose]:

It also commutes with Conjugate, (TemplateBox[{m}, Conjugate])^((-1))=TemplateBox[{{(, {m, ^, {(, {(, {-, 1}, )}, )}}, )}}, Conjugate]:

Hence it commutes with ConjugateTranspose, (TemplateBox[{m}, ConjugateTranspose])^((-1))=TemplateBox[{{(, {m, ^, {(, {(, {-, 1}, )}, )}}, )}}, ConjugateTranspose]:

PseudoInverse satisfies the MoorePenrose equations [more info]:

If MatrixRank[m] equals the number of columns of , then m^((-1))=TemplateBox[{{(, {TemplateBox[{m}, ConjugateTranspose, SyntaxForm -> SuperscriptBox], ., m}, )}}, Inverse].TemplateBox[{m}, ConjugateTranspose]:

In particular, PseudoInverse[m] is a left-inverse of m:

If MatrixRank[m] equals the number of rows of , then m^((-1))=TemplateBox[{m}, ConjugateTranspose].TemplateBox[{{(, {m, ., TemplateBox[{m}, ConjugateTranspose]}, )}}, Inverse]:

In particular, PseudoInverse[m] is a right-inverse of m:

For a diagonal matrix d, PseudoInverse[d] is the transpose with nonzero elements inverted:

If has the singular value decomposition m=u.sigma.TemplateBox[{v}, ConjugateTranspose], then m^((-1))=v.sigma^((-1)).TemplateBox[{u}, ConjugateTranspose]:

If a is an matrix and MatrixRank[a]==m, QRDecomposition will give the pseudoinverse:

In particular a^((-1))=TemplateBox[{r}, Inverse].q:

A normal matrix commutes with its pseudoinverse:

PseudoInverse[m] can be computed as TemplateBox[{{{TemplateBox[{{(, m}}, ConjugateTranspose], ., m}, )}, D}, Superscript].TemplateBox[{m}, ConjugateTranspose], where denotes DrazinInverse:

LeastSquares and PseudoInverse can both be used to solve the least-squares problem:

gives the minimum norm that minimizes the residual :

Verify that minimizes the residual:

Adding any vector in the NullSpace of to will leave the residual unchanged:

The minimum norm TemplateBox[{y}, Norm] occurs at , i.e when :

For a vector and a matrix with empty nullspace, equals ArgMin[Norm[m.x-b],x]:

Wolfram Research (1988), PseudoInverse, Wolfram Language function, https://reference.wolfram.com/language/ref/PseudoInverse.html (updated 2003).

Text

Wolfram Research (1988), PseudoInverse, Wolfram Language function, https://reference.wolfram.com/language/ref/PseudoInverse.html (updated 2003).

CMS

Wolfram Language. 1988. "PseudoInverse." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2003. https://reference.wolfram.com/language/ref/PseudoInverse.html.

APA

Wolfram Language. (1988). PseudoInverse. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PseudoInverse.html

BibTeX

@misc{reference.wolfram_2024_pseudoinverse, author="Wolfram Research", title="{PseudoInverse}", year="2003", howpublished="\url{https://reference.wolfram.com/language/ref/PseudoInverse.html}", note=[Accessed: 26-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_pseudoinverse, organization={Wolfram Research}, title={PseudoInverse}, year={2003}, url={https://reference.wolfram.com/language/ref/PseudoInverse.html}, note=[Accessed: 26-December-2024 ]}