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
| Matrix | Determinant |
|---|---|
| 2 x 2: [[a, b], [c, d]] | ad - bc |
| 3 x 3 | a(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 rows | 0 |
| Product A B | det A x det B |
| Transpose | Same as det A |
| Inverse | 1 / det A |
How each operation is computed
| Operation | Method | Defined for |
|---|---|---|
| Determinant | Gaussian elimination to triangular form, tracking row swaps | Square matrices |
| Inverse | Row reduce [A | I] to [I | A^-1] | Square with det not 0 |
| Transpose | Swap rows and columns | Any matrix |
| Multiply | Row-by-column dot products | Columns 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.