Pseudoinverse Calculator - Moore-Penrose A+ for Square and Non-Square Matrices
Pseudoinverse calculator that returns the Moore-Penrose pseudoinverse A+ of a 2x2, 3x3, 3x2, 2x3, or 3x4 matrix together with its rank and singular values.
Pseudoinverse Calculator
Results
Pseudoinverse A^+
What Is a Pseudoinverse Calculator?
A pseudoinverse calculator returns the Moore-Penrose pseudoinverse A^+ of any m x n matrix A, including non-square and rank-deficient cases, in a single pass. It is the right tool when the ordinary inverse A^-1 does not exist, and it gives the minimum-norm least-squares solution to A x = b without forcing the user to compute an SVD by hand.
- • Linear-algebra homework and exams: Verify the Moore-Penrose conditions and the closed-form (A^T A)^-1 A^T on 2x2, 3x3, and small non-square problems.
- • Linear regression and curve fitting: Solve the normal equations A^T A x = A^T b for the slope, intercept, and any number of basis coefficients in one step.
- • Robotics, computer graphics, and calibration: Invert a small 3x3 Jacobian or 2x3 sensor matrix that is not square, and read off the joint displacements or calibration coefficients from the pseudoinverse.
- • Signal processing and statistics: Project a signal onto the column space of an over-complete dictionary using a tall 3x2 or 3x4 pseudoinverse, and check the rank to see whether the dictionary is full rank.
Most users land on this page because they need to invert a matrix that is not square, has a zero determinant, or both. The pseudoinverse is exactly the right tool for those cases, and the rank panel makes it clear when the result reduces to the ordinary inverse A^-1 (square m = n with rank = n) versus a minimum-norm projection (rectangular or rank-deficient).
For square matrices, the Moore-Penrose pseudoinverse reduces to the cofactor-based inverse that the adjoint matrix calculator returns.
How the Pseudoinverse Calculator Works
The calculator reads the matrix shape, collects the entries, computes the n x n Gram matrix A^T A, and uses the closed-form left-inverse identity A^+ = (A^T A)^-1 A^T whenever the Gram matrix is invertible. When A is rank-deficient, the calculator falls back to the SVD identity A^+ = V Sigma^+ U^T so the user always gets a defined answer.
- A: The m x n input matrix. m is the number of rows, n is the number of columns.
- A^T A: The n x n Gram matrix of A; invertible only when A has full column rank (rank n).
- (A^T A)^-1: The ordinary inverse of the Gram matrix, used in the left-inverse identity.
- A^+: The Moore-Penrose pseudoinverse, an n x m matrix that is defined for every real A.
- Sigma, U, V: The SVD factors. Sigma is an m x n diagonal matrix of singular values, U is m x m, V is n x n.
- Sigma^+: The pseudoinverse of Sigma: each nonzero singular value sigma_i becomes 1/sigma_i, every zero singular value stays zero.
The closed-form identity is the default path because it is exact and fast for matrices up to 4 columns wide. The SVD fallback handles the case where two columns of A are linearly dependent, in which case the Gram matrix is singular and the closed form would divide by zero.
After computing A^+ the calculator counts how many singular values of A are greater than 1e-6, reports that count as the rank, and reports the largest singular value so the user can see whether A^+ is numerically stable.
Worked 2x2 example: A is a diagonal scaling
A = [[2, 0], [0, 3]], A^T A = [[4, 0], [0, 9]], (A^T A)^-1 = [[0.25, 0], [0, 1/9]].
A^+ = (A^T A)^-1 A^T = [[0.5, 0], [0, 0.3333]] and rank(A) = 2.
For a diagonal scaling the pseudoinverse is just the reciprocal of each diagonal entry, exactly the same as the ordinary inverse.
Worked 3x2 example: A is tall and full column rank
A = [[1, 0], [0, 1], [1, 1]], A^T A = [[2, 1], [1, 2]], (A^T A)^-1 = (1/3) * [[2, -1], [-1, 2]].
A^+ = [[0.6667, -0.3333, 0.3333], [-0.3333, 0.6667, 0.3333]] and rank(A) = 2.
The product A^+ A is the 2x2 identity, which is the defining property of a left-inverse.
According to Wikipedia, Moore-Penrose inverse, The Moore-Penrose pseudoinverse of a real m x n matrix A is the unique n x m matrix A^+ that satisfies the four Moore-Penrose conditions: A A^+ A = A, A^+ A A^+ = A^+, (A A^+)^T = A A^+, and (A^+ A)^T = A^+ A.
The closed-form normal equations behind the regression slope and intercept are exactly A^T A x = A^T b, which the pseudoinverse solves in one step, as the linear regression calculator uses to fit a line through data points.
Key Concepts Behind the Pseudoinverse
Four ideas cover the full pseudoinverse pipeline. They are the same concepts a linear-algebra textbook uses, and the result panel of this calculator mirrors them so the user can audit each step.
Gram matrix A^T A
The n x n matrix whose (i, j) entry is the dot product of column i of A with column j. It is symmetric and positive semi-definite, and it is invertible exactly when A has full column rank.
Left-inverse identity A^+ = (A^T A)^-1 A^T
The closed-form pseudoinverse for full column rank A. Multiplying on the right by A gives A^+ A = I_n, which is the defining property of a left-inverse.
Singular values and rank
The singular values of A are the square roots of the eigenvalues of A^T A. The rank is the count of singular values greater than zero. They tell the user how numerically well-conditioned A is.
Moore-Penrose conditions
Four identities that uniquely determine A^+: A A^+ A = A, A^+ A A^+ = A^+, (A A^+)^T = A A^+, and (A^+ A)^T = A^+ A. They hold for every real A, square or not, full rank or not.
These four concepts are the only bookkeeping the calculator does, and they line up exactly with what an instructor or textbook would expect to see. The result panel shows the rank and the largest singular value so the user can see at a glance whether the closed-form identity applied or the SVD fallback kicked in.
According to Wolfram MathWorld, Pseudoinverse, For a square invertible matrix A, the pseudoinverse reduces to the ordinary inverse A^-1, and for a rank-deficient matrix the pseudoinverse is given by the SVD identity A^+ = V Sigma^+ U^T.
Singular values are the matrix-level generalization of vector length, so a quick magnitude check on each column is the vector magnitude calculator way to spot a near-singular Gram matrix A^T A before dividing by it.
How to Use This Pseudoinverse Calculator
Pick the matrix shape, type the entries, and read the pseudoinverse grid, the rank, and the largest singular value in the right-hand panel. The numbers update on every keystroke.
- 1 Choose the matrix shape: Select 2x2, 2x3, 3x2, 3x3, or 3x4 from the shape selector.
- 2 Type the matrix entries: Real numbers, decimals allowed. Unused cells are ignored.
- 3 Read the rank of A: Equals min(m, n) for a full-rank matrix, and a smaller number when rows or columns are linearly dependent.
- 4 Read the largest singular value: The spectral norm of A, which scales the columns of A on average.
- 5 Read the pseudoinverse grid A^+: For a 3x2 input the grid is 2x3; for a 2x3 input the grid is 3x2.
- 6 Reset or change the shape: Reset restores the 3x3 identity matrix.
Suppose you have two over-determined observations: A = [[1, 0], [0, 1], [1, 1]] and b = [2, 3, 4]. Pick the 3x2 shape, type the six entries, and the calculator returns A^+ = [[0.6667, -0.3333, 0.3333], [-0.3333, 0.6667, 0.3333]] with rank 2. The least-squares solution is x = A^+ b = [2, 2.3333].
A^T A is the matrix of pairwise dot products between the columns of A, so the dot product calculator is a quick sanity check on a single entry of the Gram matrix before trusting the pseudoinverse.
Benefits of This Pseudoinverse Calculator
The pseudoinverse is the most useful matrix identity for working with real-world data, which is almost never square and is often rank-deficient. The calculator makes the identity usable in seconds.
- • Works on square and non-square matrices: A single tool covers 2x2, 2x3, 3x2, 3x3, and 3x4 inputs.
- • Closed form and SVD identity combined: Uses the fast (A^T A)^-1 A^T identity for full column rank and falls back to SVD for rank-deficient A.
- • Rank and singular values on the result panel: The rank and largest singular value sit next to the pseudoinverse grid.
- • Decimal-friendly arithmetic: Entries can be decimals like 1.5 or 0.25.
- • Direct link to the least-squares solution: Multiply the pseudoinverse grid by the right-hand side b to get the minimum-norm least-squares solution.
When A is square and invertible, the pseudoinverse gives the exact solution to A x = b, which is the same answer the system of equations calculator returns via Cramer's rule for 2x2 and 3x3 systems.
Factors That Affect Your Pseudoinverse Result
A handful of input choices and structural facts decide whether the pseudoinverse grid matches the matrix the user intended, and whether the result is numerically trustworthy.
Matrix shape (m x n)
The pseudoinverse A^+ has shape n x m, so the result grid swaps rows and columns when the input is transposed.
Rank of A
Equals min(m, n) for a full-rank matrix. A smaller rank means the calculator falls back to the SVD identity rather than the closed form.
Singular value spread
A large spread between the largest and smallest nonzero singular values makes A^+ numerically sensitive: small changes in A produce large changes in A^+.
Decimal precision
Output is rounded to four decimal places for display, but the calculation uses full double precision internally.
Rank-deficient rows or columns
When two rows or two columns of A are linearly dependent, the pseudoinverse is still defined but is a projection onto the column space of A.
- • The calculator is restricted to 2x2, 2x3, 3x2, 3x3, and 3x4 matrices. For 4x4 and larger a numerical library is usually the better tool.
- • Treat any displayed value with absolute magnitude below 1e-6 as zero before using the grid in a subsequent calculation.
According to MIT OpenCourseWare 18.06 Linear Algebra (Strang), For a full column rank m x n matrix A, the closed-form expression A^+ = (A^T A)^-1 A^T is the left-inverse identity that gives the minimum-norm least-squares solution to the normal equations A^T A x = A^T b, and the same x = A^+ b is the pseudoinverse solution to minimize ||A x - b||.
Frequently Asked Questions
Q: What is the pseudoinverse of a matrix?
A: The pseudoinverse (Moore-Penrose pseudoinverse) is the unique n x m matrix A^+ that generalizes the ordinary inverse to any m x n matrix A, including non-square and rank-deficient cases. It is the matrix that satisfies four Moore-Penrose conditions, the most famous being A A^+ A = A and A^+ A A^+ = A^+.
Q: How do you compute the Moore-Penrose pseudoinverse?
A: For a full column rank m x n matrix, the closed form is A^+ = (A^T A)^-1 A^T, which is an n x m left-inverse of A. For a rank-deficient matrix, the SVD identity A = U Sigma V^T gives A^+ = V Sigma^+ U^T, where each nonzero singular value sigma_i is replaced by 1/sigma_i and zero singular values are left as zero.
Q: What is the difference between the pseudoinverse and the inverse?
A: The ordinary inverse A^-1 is only defined for square invertible matrices. The pseudoinverse A^+ is defined for every m x n matrix, square or not, full rank or not. When A is square and invertible, A^+ reduces to A^-1 exactly; when A is rank-deficient, A^+ still exists and is the least-squares left-inverse.
Q: Can the pseudoinverse exist when the inverse does not?
A: Yes. The pseudoinverse exists for every real matrix, even when det(A) = 0. For example, A = [[1, 2], [2, 4]] has no inverse because its rows are linearly dependent, but it has a pseudoinverse A^+ = [[0.04, 0.08], [0.08, 0.16]] that is the minimum-norm least-squares solution to A x = b for any b.
Q: Why is the pseudoinverse important for least-squares problems?
A: When a system A x = b has no exact solution, the pseudoinverse gives the closest possible x: x = A^+ b minimizes the squared error ||A x - b||^2. This is why linear regression, sensor calibration, and small robotics inverses are all written with A^+ rather than A^-1 when A is non-square or singular.
Q: Does this calculator support non-square matrices?
A: Yes. The shape selector includes 2x2, 2x3, 3x2, 3x3, and 3x4, so the pseudoinverse of a tall 3x2 or a wide 2x3 matrix is computed in the same pass. The rank and singular values are reported so the user can see whether the matrix is full rank for its shape.