Matrix Inverse Calculator (2×2, 3×3, 4×4)

Enter your square matrix below and instantly get its inverse, determinant, and a non-singularity check — computed entirely in your browser.

How the inverse is computed

A square matrix A has an inverse A⁻¹ only when its determinant is non-zero. When det(A) = 0 the matrix is called singular and no inverse exists. This calculator first evaluates the determinant; if it is non-zero it returns the unique inverse satisfying A · A⁻¹ = A⁻¹ · A = I, the identity matrix.

For small matrices the classical formula is the adjugate method: A⁻¹ = adj(A) / det(A), where the adjugate is the transpose of the cofactor matrix. Each cofactor Cij = (−1)i+j · Mij uses the minor Mij, the determinant of the submatrix formed by deleting row i and column j. For a 2×2 matrix this reduces to the well-known shortcut: swap a and d, negate b and c, then divide by ad − bc.

Under the hood this tool actually uses Gauss–Jordan elimination with partial pivoting for numerical stability. It augments A with the identity matrix to form [A | I], then applies elementary row operations to reduce the left block to the identity. Whatever the right block becomes is A⁻¹. Partial pivoting — selecting the row with the largest absolute pivot at each step — keeps rounding error small and is exactly how production linear-algebra libraries handle the job. The determinant is read off as the product of pivots (with a sign flip for each row swap), so you get both results from a single sweep. Values are rounded for display but the inverse is verified to reproduce the identity, confirming correctness for well-conditioned inputs.

Related Tools

Matrix Determinant Calculator
Matrix Multiplication Calculator
Eigenvalue & Eigenvector Calculator