Pseudoinverse Calculator
Enter any real matrix up to 4 rows by 4 columns and this calculator finds its Moore-Penrose pseudoinverse (also written A+). The tool automatically selects the best method: the column-rank shortcut A+ = (A^T A)^-1 A^T, the row-rank shortcut A+ = A^T (A A^T)^-1, or a Jacobi SVD for rank-deficient matrices. You get the full pseudoinverse matrix, the method used, a Frobenius-norm condition check, and a step-by-step breakdown of the computation.
Formula
Worked example
For A = [[1,2],[3,4],[5,6]], A^T A = [[35,44],[44,56]], (A^T A)^-1 = [[2.8,-2.2],[-2.2,1.75]], and A+ = (A^T A)^-1 A^T = [[-1.333,-0.333,0.667],[1.083,0.333,-0.417]]. Verifying: A A+ A = A (Penrose condition 1 satisfied).
What is the Moore-Penrose pseudoinverse?
The Moore-Penrose pseudoinverse A+ is a generalisation of the matrix inverse that exists for any real or complex matrix, whether or not it is square or has full rank. It was independently discovered by E.H. Moore in 1920 and Roger Penrose in 1955. For a square invertible matrix, A+ equals the ordinary inverse A^-1. For all other matrices, A+ is the unique matrix satisfying four Penrose conditions: A A+ A = A, A+ A A+ = A+, (A A+)^T = A A+, and (A+ A)^T = A+ A. These conditions guarantee that A+ x gives the best possible approximate solution to the linear system Ax = b in the least-squares sense, or the minimum-norm exact solution when the system is underdetermined.
Three computational methods
When A has full column rank (more rows than columns and all columns independent), the formula A+ = (A^T A)^-1 A^T is efficient: it requires only one matrix inversion of the small n x n product A^T A. When A has full row rank (more columns than rows), the dual formula A+ = A^T (A A^T)^-1 applies and inverts the smaller m x m product. When neither product is invertible, meaning the matrix is rank-deficient, the singular value decomposition A = U Sigma V^T must be used. The pseudoinverse is then V Sigma+ U^T, where Sigma+ replaces each non-zero singular value with its reciprocal and leaves zero singular values as zero. This SVD approach is the most general and numerically stable, and it is always correct regardless of the matrix rank.
Applications of the pseudoinverse
The most common use of the pseudoinverse is solving least-squares problems. In statistics and machine learning, ordinary least-squares regression asks for the coefficient vector x that minimises ||Ax - b||. The solution is x = A+ b, which is exactly what the pseudoinverse computes. This appears in linear regression, polynomial curve fitting, trend forecasting, and fitting calibration curves. In control systems and robotics, the pseudoinverse of the Jacobian matrix gives the minimum-norm joint velocities that achieve a desired end-effector motion, a technique called the Jacobian pseudoinverse for inverse kinematics. In image processing and signal recovery, the pseudoinverse reconstructs a signal from underdetermined or noisy measurements, and it appears in compressed sensing and the computation of the fundamental matrix in computer vision.
How to use this calculator
Select the number of rows and columns for your matrix using the two drop-downs. Enter the matrix entries in the text field, separating values within a row with commas and different rows with semicolons. For example, a 3 x 2 matrix would be entered as 1,2;3,4;5,6. The calculator instantly shows the pseudoinverse A+ as a formatted matrix, the method it used (full column rank shortcut, full row rank shortcut, or SVD), the dimensions of the resulting A+ matrix, and a verification that the first Penrose condition A A+ A = A is numerically satisfied. The step-by-step panel shows the full computation with the intermediate matrices so you can follow or check every stage.
Moore-Penrose pseudoinverse: methods and when they apply
| Matrix type | Condition | Formula used | Application |
|---|---|---|---|
| Full column rank | m >= n and rank = n | A+ = (A^T A)^-1 A^T | Least-squares regression (overdetermined) |
| Full row rank | n >= m and rank = m | A+ = A^T (A A^T)^-1 | Minimum-norm solution (underdetermined) |
| Square invertible | m = n and rank = n | A+ = A^-1 | Unique solution to Ax = b |
| Rank-deficient | rank < min(m,n) | A+ = V Sigma+ U^T (SVD) | Image processing, regularisation |
| Zero matrix | rank = 0 | A+ = zero matrix (transposed) | Trivial degenerate case |
The method selected depends on the rank and shape of the input matrix A (m rows, n columns).
Frequently asked questions
What is the difference between the pseudoinverse and the regular inverse?
The ordinary inverse A^-1 exists only for square matrices that are non-singular (non-zero determinant). It satisfies A A^-1 = I exactly. The pseudoinverse A+ exists for any matrix of any shape and any rank. For an invertible square matrix A+ equals A^-1. For all other matrices, A+ gives the least-squares or minimum-norm solution rather than an exact solution, and it satisfies four weaker conditions (the Penrose conditions) instead of the strict identity requirement.
What are the four Penrose conditions?
A matrix A+ is the Moore-Penrose pseudoinverse of A if and only if it satisfies all four conditions: (1) A A+ A = A, meaning A+ sends outputs of A back to a reasonable input. (2) A+ A A+ = A+, meaning A+ is itself consistent. (3) (A A+)^T = A A+, meaning the product A A+ is symmetric (a Hermitian projector onto the range of A). (4) (A+ A)^T = A+ A, meaning A+ A is also symmetric (the projector onto the row space of A). Any matrix satisfying all four conditions is unique and is the Moore-Penrose pseudoinverse.
Why is the pseudoinverse useful in least-squares problems?
When you want to solve Ax = b but the system is overdetermined (more equations than unknowns), an exact solution usually does not exist. The pseudoinverse gives x = A+ b, which minimises the sum of squared residuals ||Ax - b||^2. When the system is underdetermined (more unknowns than equations), infinitely many solutions exist and A+ b gives the one with the smallest norm ||x||. In both cases, the pseudoinverse provides the statistically optimal answer.
What does the Frobenius norm represent?
The Frobenius norm of a matrix is the square root of the sum of the squares of all its entries. It is the matrix generalisation of the Euclidean length of a vector. A larger Frobenius norm means the matrix contains entries with larger magnitudes overall. The Frobenius norm is useful as a quick scale indicator and for checking convergence in iterative algorithms.
When does the SVD method apply?
The SVD method is needed when the matrix is rank-deficient, meaning some columns or rows are linearly dependent. In that case, both A^T A and A A^T are singular and the shortcut formulas cannot be applied. The singular value decomposition A = U Sigma V^T decomposes A into rotation, scaling, and rotation factors. Setting near-zero singular values to zero and inverting the rest gives Sigma+, and then A+ = V Sigma+ U^T is the unique pseudoinverse even for a rank-deficient matrix.
Can the pseudoinverse handle non-square matrices?
Yes, that is one of its main advantages over the regular inverse. If A is m x n, then A+ is n x m regardless of whether m equals n. For a tall matrix (m > n, more rows than columns), A+ is a wide matrix. For a wide matrix (m < n), A+ is tall. The dimensions of A+ are always the transpose of the dimensions of A.