Matrix Calculator

Enter matrices up to 4×4 to add, subtract, multiply, scalar-multiply, transpose, or compute the determinant, inverse, and rank — every operation shows every step, from cofactor expansion for determinants to row-by-row Gauss-Jordan elimination for 4×4 inverses.

Matrix A (2×2)

-2

det(A)

Determinant: -2

Show every step
2×2 minor det[[1, 2], [3, 4]] = (1)(4) − (2)(3) = -2

Cells show the decimal value (rounded to 6 places) and, when it is a simple fraction, the exact form in parentheses. How we calculate →

How to find the determinant of a matrix (cofactor expansion)

For a 2×2 matrix [[a, b], [c, d]], the determinant is simply ad − bc. For [[1, 2], [3, 4]]: det = (1)(4) − (2)(3) = -2.

For 3×3 and 4×4 matrices, the calculator above expands by cofactors along the first row: each entry is multiplied by the determinant of the smaller matrix left after deleting its row and column (its "minor"), with alternating + / − signs. For [[6, 1, 1], [4, −2, 5], [2, 8, 7]], expanding along row 1 gives a determinant of -306 — a classic reference example you can check by hand.

A determinant of 0 means the matrix is singular: its rows (or columns) are linearly dependent, and it has no inverse.

Finding the inverse: adjugate method (2×2, 3×3) vs. Gauss-Jordan (4×4)

For 2×2 and 3×3 matrices, the calculator builds the adjugate (the transpose of the matrix of cofactors) and divides every entry by the determinant: A⁻¹ = adj(A) ÷ det(A). For [[4, 7], [2, 6]] (det = 10), the inverse is [[0.6, −0.7], [−0.2, 0.4]].

For 4×4 matrices, computing the full adjugate by hand requires sixteen 3×3 determinants — impractical to show as clean steps. The calculator instead runs Gauss-Jordan elimination: augment A with the identity matrix [A | I], then row-reduce the left side to the identity; whatever remains on the right side is A⁻¹. Every row operation (swap, scale, subtract-a-multiple) is shown.

Either method fails the same way: if a row reduces to all zeros (or the determinant is 0), the matrix has no inverse.

Matrix multiplication: why dimensions matter

Two matrices A (m×n) and B (p×q) can only be multiplied if n = p — the number of columns of A must equal the number of rows of B. The result is an m×q matrix. Each entry of the result is the dot product of a row of A with a column of B, which is why matrix multiplication is not commutative: A × B usually doesn't equal B × A, and B × A might not even be defined if the dimensions don't line up in reverse.

Addition and subtraction, by contrast, require matrices of the identical size (same rows, same columns) — every entry combines with the entry in the same position.

What rank tells you about a matrix

The rank of a matrix is the number of linearly independent rows (equivalently, columns) it has — found by row-reducing to echelon form and counting the nonzero rows. A matrix has full rank when its rank equals the smaller of its row and column counts. For [[1, 2], [2, 4]] — where row 2 is exactly twice row 1 — the rank is only 1, not 2, because the rows carry no independent information from each other.

Rank matters beyond pure math: a square matrix with less than full rank is automatically singular (determinant 0, no inverse), and in applications like systems of linear equations, a rank deficiency signals redundant or contradictory equations.

Frequently asked questions

How do you calculate the determinant of a 3×3 matrix?

Expand along the first row: multiply each entry by the determinant of the 2×2 "minor" left after deleting its row and column, alternate the signs (+, −, +), and add the three results. For [[6, 1, 1], [4, −2, 5], [2, 8, 7]], that comes to -306.

How do you find the inverse of a 2×2 matrix?

For [[a, b], [c, d]], swap a and d, negate b and c, then divide every entry by the determinant (ad − bc): A⁻¹ = (1 ÷ det) × [[d, −b], [−c, a]]. For [[4, 7], [2, 6]] (det = 10), the inverse is [[0.6, −0.7], [−0.2, 0.4]].

What does it mean if a matrix has no inverse?

It means the matrix is singular — its determinant is 0. Singular matrices have linearly dependent rows/columns (rank less than their size), so the system of equations they represent either has no solution or infinitely many.

Can you multiply any two matrices?

No — the number of columns in the first matrix must equal the number of rows in the second. A 2×3 matrix can multiply a 3×4 matrix (giving a 2×4 result), but not a 2×3 or 4×3 matrix.

What is the difference between a matrix's rank and its size?

Size is just the row × column dimensions. Rank is the number of linearly independent rows (or columns) inside it, found by row reduction — it can be smaller than either dimension when some rows are combinations of others.

How do you find the inverse of a 4×4 matrix?

Gauss-Jordan elimination: augment the matrix with the 4×4 identity matrix, then apply row operations (swap, scale, subtract multiples) until the left side becomes the identity. Whatever ends up on the right side is the inverse. This is the practical method for anything larger than 3×3, where the adjugate/cofactor method becomes unwieldy.

Is matrix multiplication commutative?

Generally no — A × B ≠ B × A, even when both are defined and square. Order matters in matrix multiplication, unlike ordinary number multiplication.

Researched & verified by the Calcuris Data & Research Team. How we build and check our tools →