Matrix Inverse Calculator
Compute exact 2×2 and 3×3 matrix inverses, adjugate matrices, cofactors, determinants, and linear system solutions ($A\mathbf{x} = \mathbf{b}$) with complete step-by-step derivations.
Step-by-Step Adjugate & Cofactor Expansion Formula: A⁻¹ = (1 / det(A)) × adj(A)
How to Calculate the Inverse of a Square Matrix
To invert a square matrix A, first verify that its determinant is non-zero (det(A) ≠ 0). For a 2x2 matrix [[a, b], [c, d]], swap diagonal elements (d, a), negate off-diagonal elements (-b, -c), and divide by det(A) = ad - bc: A⁻¹ = (1/det(A)) [[d, -b], [-c, a]]. For a 3x3 matrix, calculate the matrix of minors, apply the chessboard sign pattern to create cofactors, transpose to get the adjugate adj(A), and divide by det(A).
Anatomy of Matrix Inversion & The Identity Matrix
In matrix algebra, division is not defined directly. Instead, multiplication by the matrix inverse ($A^{-1}$) serves as the exact algebraic equivalent of division.
Just as multiplying a scalar $x$ by its reciprocal $x^{-1} = 1/x$ produces the multiplicative identity $1$, multiplying an $n \times n$ matrix $A$ by its inverse $A^{-1}$ yields the $n \times n$ identity matrix $I_n$:
Multiplying a matrix by its inverse yields ones on the main diagonal and zeros elsewhere.
A matrix possesses an inverse if and only if its determinant is non-zero.
Inverting a matrix product reverses the order of the individual matrix factors.
The 2×2 Matrix Inverse Shortcut Formula (Adjugate Method)
For any $2 \times 2$ matrix, the inverse can be written directly using a simple mnemonic:
Matrix: A = [[a, b], [c, d]]
A⁻¹ = (1 / (ad − bc)) × [[d, −b], [−c, a]]
Step 1: Compute determinant det(A) = ad - bc.
Step 2: Swap the main diagonal entries (a ⟷ d).
Step 3: Negate the off-diagonal entries (b ⟶ -b, c ⟶ -c).
Step 4: Scale every entry by 1 / det(A).
The 3×3 Matrix Inverse Algorithm (Minors, Cofactors, Adjugate)
Inverting a $3 \times 3$ matrix involves four classical linear algebra stages:
- Calculate Determinant: Evaluate $\det(A)$ using first-row cofactor expansion. If $\det(A) = 0$, stop—the matrix is singular.
- Matrix of Minors ($M$): For each of the 9 entries, compute the $2 \times 2$ determinant of the submatrix remaining when its row and column are deleted.
- Matrix of Cofactors ($C$): Multiply each minor by $(-1)^{i+j}$ according to the alternating chessboard sign pattern:
[[+, -, +], [-, +, -], [+, -, +]]
- Adjugate Matrix ($\text{adj}(A) = C^T$): Transpose the cofactor matrix by swapping rows and columns ($C_{ij} \leftrightarrow C_{ji}$).
- Scalar Division: Divide the adjugate matrix by the determinant: $A^{-1} = \frac{1}{\det(A)} \text{adj}(A)$.
Gauss-Jordan Elimination Method [A | I] to [I | A⁻¹]
For large matrices ($n \ge 3$), Gauss-Jordan elimination is computationally superior to cofactor expansion:
Augmented Matrix Representation:
Apply elementary row operations (row swapping, scaling, and adding multiples of rows) until the left block becomes the identity matrix $I$. The right block will transform into $A^{-1}$.
Solving Linear Systems Ax = b with Matrix Inverses
When a system of $n$ linear equations with $n$ variables is represented in matrix-vector form:
Multiplying the constant vector $\mathbf{b}$ by $A^{-1}$ yields the exact unique solution vector $\mathbf{x}$ immediately.
Singular Matrices & Invertibility Conditions (det(A) = 0)
A matrix is singular (non-invertible) if any of the following equivalent conditions hold:
- $\det(A) = 0$ (Zero Determinant).
- The rows or columns of $A$ are linearly dependent (one row is a multiple or linear combination of others).
- The rank of $A$ is strictly less than $n$ ($\text{rank}(A) < n$).
- $\lambda = 0$ is an eigenvalue of $A$.
- The system $A\mathbf{x} = \mathbf{0}$ has non-trivial (infinite) solutions.
Step-by-Step Worked Examples (2×2 and 3×3 Inverses)
Find the inverse of A = [[3, 2], [7, 5]].
1. Determinant: det(A) = (3)(5) − (2)(7) = 15 − 14 = 1.
2. Adjugate: Swap diagonal (5, 3) and negate off-diagonal (−2, −7) → adj(A) = [[5, −2], [−7, 3]].
3. Divide by det(A) = 1: A⁻¹ = [[5, −2], [−7, 3]].
Verification: [[3, 2], [7, 5]] × [[5, −2], [−7, 3]] = [[1, 0], [0, 1]].
Common Pitfalls & Numerical Stability Errors
The adjugate matrix is the transpose of the cofactor matrix ($\text{adj}(A) = C^T$). Forgetting to swap rows and columns of the cofactor matrix is the most common error in $3 \times 3$ inversion.
If $\det(A)$ is extremely close to zero (e.g. $10^{-12}$), floating-point roundoff errors explode. In numerical programming, use LU or QR decomposition rather than direct matrix inversion.
Lead Developer & Founder of Basic Math Tools. Specializes in browser-native computational algorithms and applied mathematics.
Mathematics & curriculum specialists. Audited against standard algebraic and arithmetic principles.