Skip to main content

Free Matrix Calculator – Inverse and Determinant with Every Step Shown

Add, subtract, multiply, transpose, invert and power matrices up to 4x4, with determinants to 5x5. Shows the cofactor expansion and every Gauss-Jordan row operation.

Written & reviewed by Helperzy Editorial Team · Updated July 2026

10 operationsGauss-Jordan stepsCofactor expansionExact fractionsCopy as LaTeXFree

Operation

Matrix A

A⁻¹ needs a square matrix, so rows and columns stay linked.

Result — A⁻¹

0.20.20
−0.20.31
0.2−0.30

Self-check: A × A⁻¹ should be the identity

100
010
001

If this is the identity matrix, the inverse is correct.

Gauss-Jordan elimination on [ A | I ]

1. Start with the augmented matrix [ A | I ].

302100
20−2010
011001

2. R1 ← R1 ÷ 3 (make the pivot equal 1)

100.6666670.33333300
20−2010
011001

3. R2 ← R2 − 2·R1 (clear column 1)

100.6666670.33333300
00−3.333333−0.66666710
011001

4. R2 ↔ R3 (swap so the largest pivot sits on the diagonal — this keeps the arithmetic stable)

100.6666670.33333300
011001
00−3.333333−0.66666710

5. R3 ← R3 ÷ −3.333333 (make the pivot equal 1)

100.6666670.33333300
011001
0010.2−0.30

6. R1 ← R1 − 0.666667·R3 (clear column 3)

1000.20.20
011001
0010.2−0.30

7. R2 ← R2 − 1·R3 (clear column 3)

1000.20.20
010−0.20.31
0010.2−0.30

8. The left half is now the identity, so the right half is A⁻¹.

1000.20.20
010−0.20.31
0010.2−0.30

Rows are swapped to put the largest pivot on the diagonal, which keeps the arithmetic stable. Many valid row-operation paths reach the same inverse, so your textbook's sequence may differ while the final matrix agrees.

When each operation is defined
OperationRequirementResult shape
A + B, A − Bidentical dimensionssame as A
A × Bcolumns of A = rows of Brows(A) × cols(B)
k × Aany shapesame as A
Aᵀany shapecols(A) × rows(A)
det(A)square, up to 5×5single number
A⁻¹square and det(A) ≠ 0same as A
rank(A)any shapesingle number ≤ min(rows, cols)
tr(A)squaresingle number
Aⁿsquare, integer n from −10 to 10same as A

Determinants use cofactor (Laplace) expansion by minors and inverses use Gauss-Jordan elimination, both as described on Wolfram MathWorld and taught on Math is Fun. MathWorld's rule applies throughout: a square matrix has an inverse if and only if its determinant is non-zero. Matrix entries are unitless.

100% Private

Every row operation runs in your browser. No matrix is uploaded.

How to Use Matrix Calculator

1

Choose the Operation and Size

Tap one of the ten operations, then set the rows and columns for matrix A using the dropdowns. Operations that require a square matrix, such as determinant and inverse, keep the row and column counts linked automatically.

2

Fill in the Entries

Type a number into each cell, using matrix B as well for addition, subtraction and multiplication. Empty or non-numeric cells are read as zero and the tool tells you how many it treated that way, so no result silently turns into NaN.

3

Read the Result and Every Step

The answer appears immediately, with the cofactor expansion or the full Gauss-Jordan row-operation sequence below it. Switch on exact fractions to match a textbook answer key, then copy the result as plain text or as a LaTeX pmatrix.

The Ten Matrix Operations and How the Steps Are Produced

A matrix is a rectangular grid of numbers, and matrix arithmetic is the language of linear systems, computer graphics transforms, Markov chains and least-squares fitting. This calculator handles ten operations — addition, subtraction, scalar multiplication, matrix multiplication, transpose, determinant, inverse, rank, trace and integer powers — for sizes up to 4×4, with determinants, transposes, ranks and traces extending to 5×5. What separates it from a plain answer box is that it shows the working: the determinant is expanded term by term along the first row, and the inverse is produced by Gauss-Jordan elimination with every single row operation printed and the augmented matrix redrawn after each one. Students are usually graded on the method rather than the answer, so the method is the product. The determinant uses cofactor expansion, also called Laplace expansion by minors, as described on Wolfram MathWorld. Along the first row, det(A) = Σⱼ (−1)^(1+j) · a₁ⱼ · M₁ⱼ, where a₁ⱼ is the entry in row 1 column j and M₁ⱼ is the minor — the determinant of what remains after deleting row 1 and column j. The signs alternate, and for a 2×2 this collapses to ad − bc. The inverse uses Gauss-Jordan elimination on the augmented matrix [A | I]: the row operations that reduce A to the identity simultaneously turn I into A⁻¹. Those operations are swapping two rows, dividing a row by a non-zero constant, and subtracting a multiple of one row from another. This tool applies partial pivoting, swapping the largest pivot onto the diagonal first, which keeps the arithmetic stable. Rank counts non-zero pivot rows, and multiplication uses (AB)ᵢⱼ = Σₖ Aᵢₖ · Bₖⱼ. Take A = [[3, 0, 2], [2, 0, −2], [0, 1, 1]], the worked example Math is Fun publishes for both methods. Expanding along the top row, the minors are 2, 2 and 2, so det = 3 × 2 − 0 × 2 + 2 × 2 = 10. Since 10 is non-zero, the inverse exists. Running Gauss-Jordan on [A | I] takes six row operations — divide row 1 by 3, clear row 2, swap rows 2 and 3, scale the new pivot, then clear the last column twice — and the right half becomes [[0.2, 0.2, 0], [−0.2, 0.3, 1], [0.2, −0.3, 0]], matching the published result. Switch on exact fractions and the same inverse reads [[1/5, 1/5, 0], [−1/5, 3/10, 1], [1/5, −3/10, 0]], which is what an answer key shows. Multiplying A by that inverse returns the identity, and the tool displays that check so the answer verifies itself. The two failure modes are where a bad calculator does real damage, so both get a plain explanation. If the determinant is zero the matrix is singular and no inverse exists — [[1, 2, 3], [4, 5, 6], [7, 8, 9]] is the classic case, since its first and third columns sum to twice the second. The tool says the matrix has no inverse because its determinant is 0, rather than dividing through and printing a grid of Infinity or NaN. If you multiply matrices whose shapes do not line up, it states the rule with your actual numbers: the columns of A must equal the rows of B, because each result entry is a dot product of one row of A with one column of B. When B × A would be defined instead, it says so. Addition needs identical dimensions, and determinant, trace, inverse and power all need a square matrix. Three practical notes. Exact fractions matter more than they sound: an inverse full of 0.333333 cannot be checked against an answer key that says 1/3, so the fraction toggle converts entries to exact rationals and marks anything genuinely irrational with an approximation sign rather than faking a fraction. The row-operation sequence you see may differ from your textbook's, because partial pivoting swaps rows your lecturer might not — many valid paths reach the same inverse, and Math is Fun itself notes there is no single right order. The final matrix is what must agree. Matrix powers also grow fast, so the exponent is capped at ten. Every row operation runs in your browser, and no matrix is uploaded.

Matrix Calculator Formula & Method

Determinant — cofactor (Laplace) expansion by minors, Wolfram MathWorld: det(A) = Σⱼ (−1)^(1+j) · a₁ⱼ · M₁ⱼ a₁ⱼ = entry in row 1, column j M₁ⱼ = the minor: determinant of A with row 1 and column j deleted 2×2 case: det = ad − bc Inverse — Gauss-Jordan elimination on the augmented matrix [ A | I ]: 1. Swap the largest available pivot onto the diagonal (partial pivoting) 2. Divide that row by the pivot so the leading entry is 1 3. Subtract multiples of it from every other row to clear the column 4. Repeat per column; the right half becomes A⁻¹ An inverse exists if and only if det(A) ≠ 0 (MathWorld). Other operations: (A ± B)ᵢⱼ = Aᵢⱼ ± Bᵢⱼ requires identical dimensions (kA)ᵢⱼ = k · Aᵢⱼ (AB)ᵢⱼ = Σₖ Aᵢₖ · Bₖⱼ requires cols(A) = rows(B) (Aᵀ)ᵢⱼ = Aⱼᵢ tr(A) = Σᵢ Aᵢᵢ square only rank(A) = number of non-zero pivot rows in row-echelon form A⁰ = I, Aⁿ = A · Aⁿ⁻¹, A⁻ⁿ = (A⁻¹)ⁿ square only, |n| ≤ 10 Entries are unitless. Sizes: 4×4 for all operations, 5×5 for determinant, transpose, rank and trace. Rounding: full double precision throughout; results rounded only for display, and exact rationals (denominator ≤ 10,000) are offered in fraction mode.

Examples: Matrix Calculator

Input

det of [[6, 1, 1], [4, −2, 5], [2, 8, 7]]

Result

−306

Cofactor expansion along the first row: 6 × ((−2)(7) − (5)(8)) − 1 × ((4)(7) − (5)(2)) + 1 × ((4)(8) − (−2)(2)) = 6 × (−54) − 1 × 18 + 1 × 36 = −306, the published Laplace-expansion example.

Input

inverse of [[3, 0, 2], [2, 0, −2], [0, 1, 1]]

Result

[[0.2, 0.2, 0], [−0.2, 0.3, 1], [0.2, −0.3, 0]] · in fractions [[1/5, 1/5, 0], [−1/5, 3/10, 1], [1/5, −3/10, 0]]

det = 3 × 2 − 0 × 2 + 2 × 2 = 10, so the inverse exists. Six Gauss-Jordan row operations on [A | I] give this result, matching the Math is Fun worked example, and A × A⁻¹ returns the identity.

Input

inverse of [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

Result

No inverse — "this matrix has no inverse because its determinant is 0 (it is singular)"

The first and third columns sum to twice the second, so the rows are linearly dependent, det = 0 and rank = 2. The tool reports the reason rather than printing Infinity or NaN.

Input

[[1, 2, 3], [4, 5, 6]] × [[7, 8], [9, 10], [11, 12]]

Result

[[58, 64], [139, 154]]

A 2×3 times a 3×2 gives a 2×2. The top-left entry is 1 × 7 + 2 × 9 + 3 × 11 = 58, a dot product of the first row of A with the first column of B.

Input

[[1, 2], [3, 4]] raised to the power 2 and 3

Result

A² = [[7, 10], [15, 22]] · A³ = [[37, 54], [81, 118]]

Repeated multiplication: A² multiplies A by itself, and A³ multiplies that result by A again. Entries grow quickly, which is why the exponent is capped at 10.

Frequently Asked Questions – Matrix Calculator

Because its determinant is 0, which makes it singular. A square matrix is invertible only when the determinant is non-zero, so no matrix satisfies A · X = I. The matrix [[1,2,3],[4,5,6],[7,8,9]] is the classic example: its first and third columns add to twice the second.