An exact matrix calculator that shows its working
This matrix calculator works on two matrices, A and B, anywhere from 1×1 to 6×6. It adds, subtracts and multiplies them, and finds the transpose, trace, rank, determinant, inverse matrix, a power Aⁿ and the solution of AX = B. Every value is kept as an exact fraction, so 1/3 stays 1/3 instead of turning into 0.333. That makes it handy for checking homework in Further Maths, a first-year linear algebra course or an engineering module, right down to the last digit.
Under each answer you get the "Working": the rule of Sarrus for a 3×3 determinant, every row operation for Gauss-Jordan, and the sum behind each entry of a product.
How to use it
- Pick the size of "Matrix A" and "Matrix B" with "Rows" and "Columns".
- Fill in the cells with integers, decimals (0.5) or fractions (2/3). An empty cell counts as 0. Arrow keys and Enter move between cells, and a block copied from a spreadsheet can be pasted into one cell in a single go.
- Click an operation such as "Determinant", "Inverse A⁻¹", "A × B" or "Solve AX = B". The result updates as you type.
- Choose "Fractions" or "Decimals" under "Display", then "Copy as text" or "Copy for a spreadsheet".
The rules behind the results
Addition and multiplication
Matrices of the same size are added entry by entry. For A × B, the number of columns of A must equal the number of rows of B. Entry (i, j) is row i of A times column j of B, term by term, added up. A 2×3 matrix times a 3×2 matrix gives a 2×2 matrix:
| A (2×3) | B (3×2) | A × B (2×2) |
|---|---|---|
[[1, 2, 3], [4, 5, 6]] | [[7, 8], [9, 10], [11, 12]] | [[58, 64], [139, 154]] |
The top-left entry is 1 × 7 + 2 × 9 + 3 × 11 = 58. Order matters: here B × A is a 3×3 matrix, so A × B and B × A are not even the same size.
Determinant
For a 2×2 matrix, det = ad − bc, so det [[1, 2], [3, 4]] = 1 × 4 − 2 × 3 = −2. For 3×3, the rule of Sarrus adds the three downward diagonal products and subtracts the three upward ones. For larger matrices the tool expands along the row with the most zeros, or uses Gaussian elimination if you pick that method.
Inverse
A square matrix has an inverse exactly when its determinant is not zero. The inverse of [[2, 1], [1, 1]], whose determinant is 1, is [[1, −1], [−1, 2]]; multiply the two and you get the identity matrix. If the determinant is 0, a message tells you the matrix is singular.
Rank and linear systems
The rank is the number of non-zero rows left after row reduction. [[1, 2, 3], [4, 5, 6], [7, 8, 9]] has rank 2, because the third row equals twice the second minus the first. For AX = B the tool tells you whether there is one solution, none or infinitely many.
FAQ
Why does A × B give an error?
A needs as many columns as B has rows. A 2×3 matrix can multiply a 3×2 matrix but not a 2×2 one.
Can I type fractions and decimals?
Yes. 1/3, −2/5, 0.25 and 1,5 are all accepted. Decimals become exact fractions, so 0.25 is stored as 1/4.
What does "not invertible" mean?
The determinant is 0: the rows depend on each other and no matrix can turn this one back into the identity. Its rank is smaller than its size.
How do I get the result into a spreadsheet?
"Copy for a spreadsheet" copies the matrix as tab-separated columns in decimal form, with up to 10 decimal places.