How this calculation works
The Moore–Penrose pseudoinverse extends useful inverse properties to rectangular and singular matrices. It is uniquely defined by four algebraic symmetry and reconstruction identities. This page computes it using an exact rational rank factorization, not a floating singular-value cutoff. It then verifies all four identities before returning the complete transposed-shape matrix. An ordinary inverse is recovered when the input is square and nonsingular.
If A=BC is a full-rank factorization, A⁺=Cᵀ(CCᵀ)⁻¹(BᵀB)⁻¹Bᵀ.A worked example
For A = [[1,2],[2,4]], the matrix is singular with exact rank one. Its pseudoinverse is [[1/25,2/25],[2/25,4/25]]. Multiplying AA⁺A reproduces A, while AA⁺ is a symmetric rank-one projector rather than the identity. Treating this matrix as ordinarily invertible would be invalid.
Good to know
Supports rational matrices up to 6×6 and bounded intermediate fraction size. Rank is exact for the entered fractions: tiny nonzero entries are not automatically truncated. This differs from noise-sensitive numerical SVD rank decisions. The page does not fit a regularization parameter, estimate uncertainty or solve arbitrary weighted pseudoinverse problems. Exact computation can grow expensive for nearly singular-looking rational data.
Reference: SciPy — Moore–Penrose definition and numerical-rank contrast (opens in a new tab) ↗
Four identities specify the generalized inverse
A candidate G must satisfy AGA=A and GAG=G, while AG and GA must both be symmetric for real matrices. Merely finding a matrix that reconstructs A through one product is insufficient. The implementation checks all four properties with exact fractions. This provides stronger evidence than displaying a plausible decimal matrix with the right dimensions.
If A has m rows and n columns, its pseudoinverse has n rows and m columns. The products AA⁺ and A⁺A act in different spaces. They project onto the column and row spaces, respectively, rather than both being full identity matrices for every rectangular input. The dimensions and rank metrics help interpret those products. Their symmetry is verified independently of reconstruction, so a one-sided generalized inverse cannot accidentally pass as a Moore–Penrose inverse.
The Nonnegative least-squares calculator adds coefficient constraints that applying a pseudoinverse does not enforce.
Exact rank and numerical rank answer different questions
A diagonal matrix with entries one and a tiny nonzero rational has exact rank two, and its inverse has a large reciprocal entry. A numerical pseudoinverse may deliberately discard that small singular direction under a chosen tolerance. Neither operation should silently masquerade as the other. This page keeps the literal rational problem and states that no tolerance is applied.
For consistent linear systems, applying A⁺ to a right-hand side gives the minimum-norm solution among exact solutions; for inconsistent systems it gives a minimum-norm least-squares solution. Those properties do not justify truncating coefficients to meet nonnegativity constraints. The separate nonnegative least-squares calculator solves that constrained task. The ordinary matrix inverse calculator remains the direct choice for a nonsingular square matrix when generalized-inverse interpretation is unnecessary.
A few questions, answered
What is the pseudoinverse of a zero matrix?
The zero matrix of the transposed dimensions. Its exact rank is zero and all four identities hold.
Are fractions in the answer rounded?
No. Displayed rational entries are reduced exact fractions. The supported fraction-growth bound can reject an input rather than silently round its output.