Matrix calculator
Set the size of matrix A (and B when the operation needs it), fill in the cells and pick an operation. Entries can be integers, decimals or fractions like 1/2. Arithmetic is exact, so the inverse of a whole-number matrix comes out as clean fractions.
Runs in your browser: nothing you enter is sent anywhere.
How to use it
- Choose the operation. Matrix B appears only for A + B, A − B and A × B.
- Pick the rows and columns of each matrix and type the entries.
- The result appears below. For an inverse the determinant is shown too. The Copy button copies the result with tabs between columns.
How it works
Addition and subtraction work cell by cell. Multiplication takes row-by-column dot products. The determinant and the inverse come from Gauss-Jordan elimination over exact fractions: each row swap flips the sign of the determinant, and the determinant is the product of the pivots. A column with no usable pivot means the determinant is 0 and the matrix is singular.
Worked example
A = [2 −1 0; −1 2 −1; 0 −1 2]:
- Determinant: 2 × (4 − 1) − (−1) × (−2 − 0) = 6 − 2 = 4.
- Inverse: ¼ × [3 2 1; 2 4 2; 1 2 3], shown as 3/4, 1/2, 1/4 in the first row, and so on.
Tips
- The product of a matrix and its inverse is the identity, which makes a handy check.
- Matrix multiplication is not commutative: A × B and B × A usually differ.
- The transpose swaps rows and columns, so a 2×3 matrix becomes 3×2.
Frequently asked questions
How do you multiply two matrices?
Each entry of A × B is the dot product of a row of A with a column of B. The result has A's rows and B's columns, and A's column count must equal B's row count. For [1 2; 3 4] × [5 6; 7 8] the top-left entry is 1×5 + 2×7 = 19.
What is a singular matrix?
A square matrix whose determinant is 0. It squashes space onto a lower dimension, so it cannot be undone and has no inverse. In [1 2; 2 4] the second row is twice the first, so the determinant is 1×4 − 2×2 = 0.
How is the inverse calculated?
The tool runs Gauss-Jordan elimination on A next to the identity matrix with exact fractions. When A has been reduced to the identity, the other half is the inverse A⁻¹, and A × A⁻¹ is the identity matrix.
Why are results shown as fractions?
Whole-number matrices usually have rational inverses, like 3/4 or −1/2. Fractions are exact, whereas decimals such as 0.333333 are rounded. Switch to decimals if you need a numeric value.
What size limits are there?
Matrices can be from 1×1 up to 4×4, which covers most homework and quick checks. Determinant and inverse need a square matrix.