Matrix Calculator

Determinant, inverse, RREF, rank, eigenvalues and more — with the row operations shown step by step.

Matrix A ×
Matrix B ×

How to use

Set the size of each matrix, type the numbers in, and pick an operation. Operations that need two matrices use A and B; the rest work on A alone. Tab moves through the cells, so a matrix can be typed without touching the mouse. Fractions are accepted as input too — 1/3 in a cell is read as a third.

Tick show row operations before running row reduction or an inverse and every step is listed underneath, in the same R2 − 3·R1 notation used in class. That is usually the part being marked, not the answer.

How the numbers are worked out

Row reduction, the inverse and the determinant all use Gaussian elimination with partial pivoting — before clearing a column, the row with the largest entry in it is swapped to the top. Skipping that step is the classic way a matrix calculator goes quietly wrong: dividing by a pivot that is very small but not quite zero magnifies rounding error enormously, and the answer that comes back looks perfectly reasonable.

The determinant comes from that same elimination rather than from cofactor expansion. Expanding by cofactors needs on the order of n! operations — a 6×6 is 720 terms, a 10×10 is over three million — while elimination needs about n³ and is far more accurate.

A matrix is reported as singular when no pivot can be found above a tolerance scaled to the size of the entries in the matrix, rather than against a fixed number. A matrix of millions and a matrix of millionths need very different definitions of "close enough to zero".

Fractions

Results are computed in floating point and then shown as a fraction when a short one reproduces the value to within rounding error — so an inverse comes back as 1/3 rather than 0.333333333333. Anything that is not cleanly a simple fraction stays a decimal, so nothing is ever dressed up as more exact than it is. Untick the box for plain decimals.

Eigenvalues

Eigenvalues are available for 2×2 and 3×3 matrices, solved from the characteristic polynomial, and complex pairs are reported as such rather than dropped. Larger matrices need iterative methods that belong in a numerical library rather than a web page, so the tool says it cannot do them instead of returning something unreliable.