Open Calculator

Matrix Calculator

Determinant, inverse, transpose, and matrix multiplication.

How the matrix calculator works

This matrix calculator covers the four operations that come up most often: the determinant, the inverse, the transpose, and the product of two matrices. Everything is computed with exact rational arithmetic, so a determinant of -1 is reported as -1 and an inverse entry of 3/5 stays 3/5. For the determinant and inverse the calculator also lists the elimination steps it took, which is useful when checking homework or learning the algorithms.

Worked example: determinant of the default matrix

The default A has rows (2, 1, 1), (1, 3, 2), (1, 0, 0). Expanding along the third row, whose only nonzero entry is the 1 in position (3, 1), gives det A = 1 x (1 x 2 - 1 x 3) = -1 (the cofactor sign for position (3, 1) is +). The calculator gets the same result by elimination: it subtracts 1/2 of row 1 from rows 2 and 3, then eliminates below the second pivot, and multiplies the diagonal of the resulting triangular matrix. Because the determinant is nonzero the inverse exists; switching the operation to Inverse shows the row reduction of [A | I] that produces it, and its first row is (0, 0, 1).

Determinant shortcuts

MatrixDeterminant
2 x 2: [[a, b], [c, d]]ad - bc
3 x 3a(ei - fh) - b(di - fg) + c(dh - eg) (expansion along the first row)
Triangular (upper or lower)Product of the diagonal entries
Two equal or proportional rows0
Product A Bdet A x det B
TransposeSame as det A
Inverse1 / det A

How each operation is computed

OperationMethodDefined for
DeterminantGaussian elimination to triangular form, tracking row swapsSquare matrices
InverseRow reduce [A | I] to [I | A^-1]Square with det not 0
TransposeSwap rows and columnsAny matrix
MultiplyRow-by-column dot productsColumns of A = rows of B

The 2 x 2 inverse formula

For A = [[a, b], [c, d]] with ad - bc not zero, A^-1 = (1 / (ad - bc)) [[d, -b], [-c, a]]: swap the diagonal, negate the off-diagonal, divide by the determinant. Try it with [[4, 7], [2, 6]]: the determinant is 24 - 14 = 10, so the inverse is [[6/10, -7/10], [-2/10, 4/10]] = [[3/5, -7/10], [-1/5, 2/5]], which the calculator confirms. For larger matrices the formula generalizes through the adjugate, but row reduction is far less work, which is why the calculator uses it.

Multiplying matrices

Select Multiply to reveal matrix B. The entry in row i, column j of the product is the sum of products of row i of A with column j of B, and the calculator prints each of those sums so the arithmetic can be followed. Remember that the order matters: A B and B A are generally different, and one of them may not even be defined. Multiplying by the identity leaves a matrix unchanged, and multiplying A by its inverse produces the identity, which is a quick way to verify an inverse.

Entering and sharing matrices

Pick the sizes first, then fill the cells; resizing keeps the values you have already typed. Cells accept integers, decimals, and fractions such as -3/4, and decimals are converted to exact fractions before any arithmetic happens. To share a filled-in problem, append ?a=2,1,1;1,3,2;1,0,0 to the page address, with commas between entries and semicolons between rows; add &b=... for the second matrix when multiplying.

Frequently asked questions

What does the determinant tell me?

For a square matrix the determinant is a single number that is zero exactly when the matrix is singular (no inverse, dependent rows). Its absolute value is the volume scaling factor of the linear map, and its sign says whether orientation is preserved.

When does a matrix have an inverse?

Only square matrices with a nonzero determinant. The calculator finds the inverse by row reducing [A | I]; if the left block cannot be turned into the identity, the matrix is singular and no inverse exists.

When can two matrices be multiplied?

A (m x n) times B (n x p) is defined only when the column count of A equals the row count of B, and the product is m x p. Each entry is the dot product of a row of A with a column of B. Matrix multiplication is not commutative.

Why are results shown as fractions?

All arithmetic is exact over the rationals, so inverses like 3/5 come out exactly instead of as 0.6. Inputs may be integers, decimals, or fractions such as 1/2.

How large a matrix can I enter?

Up to 6 x 6 for each matrix. For row reduction of a rectangular matrix use the RREF calculator, and for eigenvalues use the eigenvector calculator.

Related calculators