Advertisement
Advertisement
LINEAR ALGEBRA

Pseudoinverse Calculator — Moore-Penrose, any shape

Compute the Moore-Penrose pseudoinverse of any rectangular or rank-deficient matrix, with all four defining conditions verified and reported on the page.

Any shape from 1×1 up to 8×8. Rows may be shorter than the longest row; missing entries are filled with zero and the tool says so.
A singular value is treated as zero when it falls below max(m,n) × largest σ × machine epsilon, scaled by this factor. Rank is not a well-posed question in floating point without such a threshold.
Pseudoinverse A⁺
 
0
Rank
0
Condition number
0
Largest singular value
0
Max Moore-Penrose residual
Tip: the residual figure is the largest absolute violation of the four Moore-Penrose conditions by the result actually computed. Anything at the 10⁻¹⁵ level is ordinary floating-point noise; anything larger means the answer should not be trusted.
 
Advertisement

The Moore-Penrose pseudoinverse, written A⁺, is the generalisation of the matrix inverse to matrices that have no inverse — which is to say, almost all of them. Only square matrices with a non-zero determinant can be inverted. Every matrix, of any shape and any rank, has exactly one pseudoinverse, and it does the most useful thing an inverse does: it solves least-squares problems.

This calculator computes A⁺ for any matrix up to 8×8 by singular value decomposition, then checks the result against all four defining Moore-Penrose conditions and reports the worst violation on the page. Arb Digital built the verification into the output because a pseudoinverse is easy to compute wrongly and impossible to eyeball, and a tool that will not show its own error is asking to be trusted rather than checked.

What This Pseudoinverse Calculator Does

Paste a matrix, one row per line, and the tool returns A⁺ along with the singular values, the numerical rank, the condition number, and each of the four Moore-Penrose residuals individually. Non-square input is expected rather than tolerated: a 2×3 matrix produces a 3×2 pseudoinverse, and the dimensions are reported so the transposition is never in doubt.

Rank-deficient matrices are the case this page is really for. A singular square matrix has no inverse and a conventional inverse calculator will simply report that. It still has a pseudoinverse, and this tool computes it, explains in words which directions have collapsed, and states what the result means for solving Ax = b. A matrix of all zeros returns a pseudoinverse of all zeros, which is the correct answer and not a failure.

The rank tolerance is exposed as a control because in floating-point arithmetic rank is not a property of the matrix alone. A singular value of 10⁻¹⁷ is indistinguishable from zero at double precision, and where you place the cut-off changes the answer. The default follows the standard convention — max(m, n) × largest singular value × machine epsilon — and the selector lets you move it deliberately rather than discovering it by accident.

How to Use It

  1. Enter the matrix with one row per line. Separate entries with spaces, commas or tabs; all three work, so a paste from a spreadsheet parses directly.
  2. Check the reported dimensions in the result panel. If a row was short and got padded with zeros, the tool says so explicitly.
  3. Read the rank. If it is less than the smaller of the two dimensions, the matrix is rank-deficient and the written explanation below the result applies.
  4. Adjust the tolerance if your matrix has singular values clustered near the threshold and you need to control which are treated as zero.
  5. Check the residual before using the result. It should be around 10⁻¹⁵ or smaller for a well-conditioned matrix.

The Four Conditions: How the Pseudoinverse Is Defined

A⁺ is not defined by a formula but by four properties, and it is the unique matrix satisfying all four. Writing the conjugate transpose as a superscript H, they are: A A⁺ A = A, A⁺ A A⁺ = A⁺, (A A⁺)ᴴ = A A⁺, and (A⁺ A)ᴴ = A⁺ A. MathWorld sets out the same four. Uniqueness is the crucial part: many matrices satisfy some subset of these — a generalised inverse only needs the first — but exactly one satisfies all four.

That is why this page checks all four rather than one. Reporting only that A A⁺ A ≈ A would leave three-quarters of the definition unverified, and a result that satisfies the first condition alone is a generalised inverse, not the pseudoinverse. The detail panel prints each residual separately so you can see which condition, if any, is failing.

Advertisement

How It Is Computed: SVD and Reciprocal Singular Values

The construction goes through the singular value decomposition, A = U Σ Vᵀ, where U and V are orthogonal and Σ is diagonal with the singular values on it. The pseudoinverse is then A⁺ = V Σ⁺ Uᵀ, where Σ⁺ is formed by taking the reciprocal of every non-zero singular value, leaving the zeros as zeros, and transposing.

Leaving the zeros alone is the entire trick and the reason the pseudoinverse exists at all. Inverting a zero singular value would require dividing by zero; the pseudoinverse instead simply discards that direction, which is the mathematically principled choice — those are exactly the directions the matrix maps to nothing, and no inverse could recover them. This tool uses a one-sided Jacobi SVD, which is numerically well-behaved for small matrices and does not require forming AᵀA, an operation that squares the condition number and loses half the available precision.

Two shortcut formulas exist for the full-rank cases. When A has full column rank, A⁺ = (AᵀA)⁻¹Aᵀ, the left inverse. When it has full row rank, A⁺ = Aᵀ(AAᵀ)⁻¹, the right inverse. Both are textbook staples and both are poor computational choices, because forming AᵀA doubles the condition number in exponent terms. Neither works at all when the matrix is rank-deficient, which is precisely when you most need the pseudoinverse.

What the Pseudoinverse Is Actually For

The defining application is least squares. Given an inconsistent system Ax = b — more equations than unknowns, no exact solution — the vector x = A⁺b is the least-squares solution: it minimises the norm of the residual Ax − b. That single fact underpins linear regression, curve fitting, sensor calibration, photogrammetry and a large share of applied numerical work.

When the system is underdetermined instead, with more unknowns than equations and therefore infinitely many exact solutions, A⁺b picks out the one with the smallest norm. That is a genuine choice among solutions rather than a computational artefact, and it is often the one you want: the minimum-energy control input, the smallest correction, the least surprising fit. Our linear regression calculator solves the specific case of fitting a straight line, which is the pseudoinverse of a two-column design matrix applied to the observations.

The pseudoinverse is also the tool that makes rank deficiency survivable. If two of your predictors are perfectly collinear, the normal equations become singular and the ordinary inverse does not exist. The pseudoinverse still returns an answer — the minimum-norm one — which is why software that reports a result on collinear data is usually computing a pseudoinverse behind the scenes. That is a reason to check your design matrix, not a reason to trust the coefficients.

Where It Differs From a Real Inverse

When A is square and invertible, A⁺ = A⁻¹ exactly, so nothing is lost by using the pseudoinverse routinely. The differences appear everywhere else, and several familiar identities stop holding.

(AB)⁺ is not generally B⁺A⁺, even though (AB)⁻¹ is always B⁻¹A⁻¹ for invertible matrices. A A⁺ is not generally the identity — it is the orthogonal projection onto the column space of A, and it equals the identity only when A has full row rank. Likewise A⁺A is the projection onto the row space. Those two projection matrices are what conditions three and four are really asserting: that both products are symmetric, hence genuine orthogonal projections.

Our matrix inverse calculator handles the square invertible case by Gauss-Jordan elimination and correctly reports that a singular matrix has no inverse. This page is what you use when it does. The matrix rank calculator establishes the rank on its own, and the determinant calculator tests invertibility for a square matrix directly.

Reading the Condition Number

The condition number reported here is the ratio of the largest singular value to the smallest non-zero one. It measures how much a small relative change in the input can be amplified in the output, and it is the single most useful number for judging whether a result is trustworthy.

As a rough guide, a condition number of 10ᵏ means you can expect to lose about k decimal digits of accuracy relative to the precision you started with. Double precision carries roughly sixteen digits, so a condition number around 10⁸ leaves about eight good digits and one around 10¹⁵ leaves essentially none. A matrix that is rank-deficient has an infinite condition number in exact arithmetic; here the truncated singular values are excluded from the ratio, so the reported figure describes only the retained subspace, and the rank line is what tells you the rest of the story.

Need serious numerical tools on your own site?

Arb Digital builds browser-native calculators that do real computation without a backend or a megabyte of library code. If your product needs working linear algebra rather than a formula reference, we can build it.

Web Design Services Talk to Arb Digital

Common Mistakes to Avoid

  • Assuming A A⁺ is the identity — it is the orthogonal projection onto the column space, and equals the identity only at full row rank.
  • Using (AB)⁺ = B⁺A⁺ — the reversal rule holds for true inverses and fails in general for pseudoinverses.
  • Computing via (AᵀA)⁻¹Aᵀ by habit — it squares the condition number and breaks entirely when the matrix is rank-deficient.
  • Treating a returned answer as proof of a well-posed problem — the pseudoinverse always returns something, including on perfectly collinear data.
  • Ignoring the rank tolerance — in floating point, rank depends on where the threshold sits, and a borderline singular value can flip the result.

Related Free Tools From Arb Digital

Use the matrix inverse calculator for square invertible matrices, the matrix rank calculator to establish rank on its own, the determinant calculator to test invertibility, the matrix calculator for multiplication, addition and transposition, the cofactor matrix calculator for the adjugate route, and the linear regression calculator for the least-squares application. Everything else is in the free online tools hub.

Frequently Asked Questions

What is the Moore-Penrose pseudoinverse?

It is the unique matrix A⁺ satisfying four conditions: A A⁺ A = A, A⁺ A A⁺ = A⁺, and both products A A⁺ and A⁺ A being equal to their own conjugate transpose. Every matrix of every shape and rank has exactly one, whether or not it has an ordinary inverse.

Can a non-square matrix have a pseudoinverse?

Yes, and that is one of the main reasons the pseudoinverse exists. An m×n matrix has an n×m pseudoinverse. Only square matrices with a non-zero determinant have ordinary inverses, but the pseudoinverse is defined for every matrix.

What happens with a rank-deficient or singular matrix?

The pseudoinverse still exists and this tool computes it. The singular value decomposition produces one or more zero singular values, and those are left as zeros rather than inverted, so the directions the matrix collapses are simply discarded instead of causing a division by zero.

Is the pseudoinverse the same as the inverse when one exists?

Yes. For a square matrix with a non-zero determinant, A⁺ equals A⁻¹ exactly. The pseudoinverse is a strict generalisation, so nothing is given up by using it when an ordinary inverse is available.

How is the pseudoinverse used for least squares?

For an inconsistent system Ax = b, the vector x = A⁺b minimises the norm of the residual Ax − b, making it the least-squares solution. If the system is underdetermined instead, A⁺b returns the exact solution with the smallest norm.

Why does the tool report a residual instead of just the answer?

Because the pseudoinverse is defined by four conditions, and the only way to know that a computed result really is the pseudoinverse is to substitute it back into all four. The reported figure is the largest absolute violation across them; values near 10⁻¹⁵ are ordinary rounding noise.

What does the rank tolerance do?

It sets the threshold below which a singular value is treated as zero. Rank is not well defined in floating-point arithmetic without such a cut-off, because a true zero and a value of 10⁻¹⁷ are indistinguishable. Moving the threshold can change the computed rank and therefore the pseudoinverse.

This page performs numerical linear algebra in double-precision floating point and reports its own verification residuals. For an ill-conditioned matrix the reported pseudoinverse can be sensitive to small changes in the input, and results that will be relied upon should be reproduced in a dedicated numerical library.

Advertisement
Advertisement

Take it further