Moore-Penrose Pseudoinverse Calculator
Calculate the Moore-Penrose pseudoinverse A+, a generalization of the ordinary matrix inverse. It is particularly useful for rectangular or singular matrices and for obtaining least-squares solutions to systems that may not have an exact solution.
A
Learn About Moore-Penrose Pseudoinverse
In linear algebra, the ordinary matrix inverse $\mathbf{A}^{-1}$ exists only for square ($n \times n$), non-singular ($\det(\mathbf{A}) \ne 0$) matrices. For rectangular matrices ($m \ne n$) and singular matrices, the Moore-Penrose pseudoinverse $\mathbf{A}^+ \in \mathbb{R}^{n \times m}$ provides a unique, universal generalization that preserves key invertibility properties.
The pseudoinverse plays a central role in linear regression, least-squares data fitting, filter design, robotics kinematics, and ill-posed inverse problems.
The Four Moore-Penrose Axioms
A matrix $\mathbf{A}^+ \in \mathbb{R}^{n \times m}$ is the unique Moore-Penrose pseudoinverse of $\mathbf{A} \in \mathbb{R}^{m \times n}$ if and only if it satisfies all four conditions:
- Generalized Inversion:
- Weak Inversion:
- Hermitian Column Projector:
The product $\mathbf{A}\mathbf{A}^+$ is the unique symmetric orthogonal projection operator from $\mathbb{R}^m$ onto the column space $\operatorname{Col}(\mathbf{A})$.
- Hermitian Row Projector:
The product $\mathbf{A}^+\mathbf{A}$ is the unique symmetric orthogonal projection operator from $\mathbb{R}^n$ onto the row space $\operatorname{Row}(\mathbf{A})$.
Every real matrix—regardless of dimensions or rank—possesses a strictly unique Moore-Penrose pseudoinverse.
Analytic Formulations for Full-Rank Matrices
When $\mathbf{A}$ has full rank, the pseudoinverse reduces to convenient closed-form Gram matrix expressions:
- Full Column Rank ($m \ge n$, $\operatorname{rank}(\mathbf{A}) = n$ — Tall/Square):
The Gram matrix $\mathbf{A}^T\mathbf{A}$ is invertible, yielding the left pseudoinverse:
- Full Row Rank ($m \le n$, $\operatorname{rank}(\mathbf{A}) = m$ — Wide/Square):
The Gram matrix $\mathbf{A}\mathbf{A}^T$ is invertible, yielding the right pseudoinverse:
- Square Invertible Matrix ($m = n$, $\det(\mathbf{A}) \ne 0$):
The pseudoinverse coincides exactly with the standard matrix inverse: $\mathbf{A}^+ = \mathbf{A}^{-1}$.
General SVD Formulation (Rank-Deficient Case)
If $\mathbf{A}$ is rank-deficient ($\operatorname{rank}(\mathbf{A}) < \min(m, n)$), both Gram formulas fail due to zero determinants. The pseudoinverse is constructed via the Singular Value Decomposition $\mathbf{A} = \mathbf{U}\mathbf{\Sigma}\mathbf{V}^T$:
where $\mathbf{\Sigma}^+ \in \mathbb{R}^{n \times m}$ is formed by replacing each non-zero singular value $\sigma_i$ with its reciprocal $\frac{1}{\sigma_i}$ and transposing the matrix.
Worked Numerical Example
Find the Moore-Penrose pseudoinverse of the tall $3 \times 2$ matrix:
- Check Dimensions and Rank:
$m = 3, n = 2$. The columns are linearly independent, so $\operatorname{rank}(\mathbf{A}) = 2 = n$ (full column rank).
- Compute Transpose and Gram Matrix:
- Invert Gram Matrix:
- Compute Left Pseudoinverse:
- Verify Axioms:
- $\mathbf{A}^+\mathbf{A} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} = \mathbf{I}_2$ (Left identity).
- $\mathbf{A}\mathbf{A}^+ = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \end{bmatrix}$ (Projection onto $\operatorname{span}\{\mathbf{e}_1, \mathbf{e}_2\}$ in $\mathbb{R}^3$).
- $\mathbf{A}\mathbf{A}^+\mathbf{A} = \mathbf{A}$ and $\mathbf{A}^+\mathbf{A}\mathbf{A}^+ = \mathbf{A}^+$ hold identically.
How does the pseudoinverse solve overdetermined linear systems?
For an inconsistent or overdetermined system $\mathbf{A}\mathbf{x} = \mathbf{b}$, the vector $\hat{\mathbf{x}} = \mathbf{A}^+\mathbf{b}$ provides the unique minimum-norm least-squares solution. It minimizes the residual Euclidean error $\|\mathbf{A}\mathbf{x} - \mathbf{b}\|_2$. If multiple vectors achieve this minimum, $\hat{\mathbf{x}}$ selects the unique minimizer with the smallest vector length $\|\mathbf{x}\|_2$.
Is the pseudoinverse equal to the ordinary inverse for invertible matrices?
Yes. If $\mathbf{A}$ is a square matrix with $\det(\mathbf{A}) \ne 0$, then $(\mathbf{A}^T\mathbf{A})^{-1}\mathbf{A}^T = \mathbf{A}^{-1}(\mathbf{A}^T)^{-1}\mathbf{A}^T = \mathbf{A}^{-1}$. The Moore-Penrose pseudoinverse generalizes the ordinary inverse without altering its behavior on non-singular matrices.
Does (AB)+ equal B+ A+ in general?
No. Unlike ordinary matrix inverses where $(\mathbf{A}\mathbf{B})^{-1} = \mathbf{B}^{-1}\mathbf{A}^{-1}$ always holds, the identity $(\mathbf{A}\mathbf{B})^+ = \mathbf{B}^+ \mathbf{A}^+$ holds only under specific conditions, such as when $\mathbf{A}$ has orthonormal columns or $\mathbf{B}$ has orthonormal rows.
Why is computing the pseudoinverse via SVD more stable than Gram formulas?
In floating-point arithmetic, computing $(\mathbf{A}^T\mathbf{A})^{-1}$ squares the matrix condition number ($\kappa(\mathbf{A}^T\mathbf{A}) = \kappa(\mathbf{A})^2$), causing catastrophic loss of precision for poorly conditioned matrices. SVD computes $\mathbf{A}^+ = \mathbf{V}\mathbf{\Sigma}^+\mathbf{U}^T$ without squaring condition numbers and allows setting tiny singular values below a noise threshold to zero (truncated pseudoinverse).
- Eliakim Hastings Moore and Roger Penrose: American mathematician E. H. Moore first described generalized matrix inverses in 1920. British physicist Roger Penrose independently rediscovered the concept in 1955, formulating the four defining algebraic axioms that established modern pseudoinverse theory.
- Projection Geometry: The products $\mathbf{A}\mathbf{A}^+$ and $\mathbf{I}_m - \mathbf{A}\mathbf{A}^+$ geometrically partition the codomain $\mathbb{R}^m$. For any target vector $\mathbf{b}$, $\mathbf{A}\mathbf{A}^+\mathbf{b}$ is the perpendicular projection into $\operatorname{Col}(\mathbf{A})$, while $(\mathbf{I}_m - \mathbf{A}\mathbf{A}^+)\mathbf{b}$ is the orthogonal least-squares error pointing into $\operatorname{Null}(\mathbf{A}^T)$.