How the Moore-Penrose Pseudoinverse Works
The Moore-Penrose pseudoinverse, written A⁺, generalizes the matrix inverse to matrices that are not square or that have no ordinary inverse. Every real matrix A has exactly one pseudoinverse A⁺, and it is defined by four conditions: AA⁺A = A, A⁺AA⁺ = A⁺, and both AA⁺ and A⁺A are symmetric. When A is square and invertible, A⁺ = A⁻¹ exactly. When A is not square, A⁺ is the matrix that produces the best least-squares solution to Ax = b, which is why it shows up constantly in linear regression, robotics, and control theory.
Formula and method
For a "tall" matrix A with more rows than columns whose columns are linearly independent (full column rank), the pseudoinverse has a closed form: A⁺ = (AᵀA)⁻¹Aᵀ. This calculator uses a 3×2 matrix A: it first forms the 2×2 matrix AᵀA, checks that its determinant is nonzero (which confirms A's two columns are linearly independent), inverts that 2×2 matrix, and multiplies the result by Aᵀ to get the 2×3 pseudoinverse. For the mirror-image case — a "wide" matrix with more columns than rows and independent rows — the formula is instead A⁺ = Aᵀ(AAᵀ)⁻¹. Neither formula works when A is rank-deficient in the relevant direction; that general case requires the singular value decomposition (SVD), A = UΣVᵀ, giving A⁺ = VΣ⁺Uᵀ where Σ⁺ is formed by taking the reciprocal of each nonzero singular value.
Common sources of error
- Forgetting the transpose: A⁺ = (AᵀA)⁻¹Aᵀ is not the same matrix as (A⁻¹) — that inverse does not exist unless A is square, so the transpose step is not optional.
- Assuming AA⁺ = I: for a tall full column rank matrix, A⁺A = I (the 2×2 identity here), but AA⁺ is a 3×3 projection matrix, not the identity — only square invertible matrices satisfy both.
- Ignoring rank deficiency: if the two columns of A are parallel (one is a scalar multiple of the other), AᵀA is singular, det(AᵀA) = 0, and this closed-form formula cannot be used — the SVD-based pseudoinverse is needed instead.
Checking your result
The most reliable check is to multiply the computed A⁺ by the original A: for a full column rank matrix, A⁺A should equal the 2×2 identity matrix (1s on the diagonal, 0s elsewhere) up to rounding error. This calculator performs that check automatically and reports the largest entrywise deviation from the identity — a value near zero (below roughly 1e-8) confirms the pseudoinverse was computed correctly.
Applications
- Least-squares regression: fitting a line or plane through data points that outnumber the unknown coefficients, exactly the shape of the default 3×2 example (three data points, an intercept and a slope).
- Robotics and inverse kinematics: converting a desired end-effector velocity into joint velocities when the Jacobian matrix is not square.
- Control systems and signal processing: solving over-determined or under-determined linear systems that arise in state estimation and filter design.
- Image and data compression: the pseudoinverse appears alongside the SVD in low-rank approximation and denoising techniques.