What is a matrix?
A matrix is a rectangular array of numbers arranged in rows and columns. Matrices are used to store data, describe transformations and solve systems of linear equations.
This calculator handles matrices up to 4 by 4 for adding, subtracting and multiplying, and up to 3 by 3 for determinants and inverses.
Matrix formulas for each operation
(AB)ᵢⱼ is the sum of Aᵢₖ × Bₖⱼ over k.
How to use the matrix calculator
- Type matrix A with rows separated by semicolons and entries by commas.
- Choose the operation.
- If the operation needs two matrices, type matrix B.
- Read the result and the steps.
- Check sizes if the tool shows a message.
Matrix examples
Example 1: Multiplying
Multiply A = [1 2; 3 4] by B = [5 6; 7 8]. Entry (1,1) is 1 × 5 + 2 × 7 = 19. Entry (1,2) is 1 × 6 + 2 × 8 = 22. Entry (2,1) is 3 × 5 + 4 × 7 = 43. Entry (2,2) is 3 × 6 + 4 × 8 = 50. The product is [19 22; 43 50].
Example 2: Adding
Add the same A and B. Add entry by entry: 1 + 5 = 6, 2 + 6 = 8, 3 + 7 = 10 and 4 + 8 = 12. The sum is [6 8; 10 12].
Example 3: Determinant and inverse
For A = [1 2; 3 4], the determinant is 1 × 4 − 2 × 3 = −2. Since it is not zero, the inverse exists: (1 ÷ −2) × [4 −2; −3 1] = [−2 1; 3/2 −1/2].
Example 4: A 3 by 3 determinant
Find the determinant of [2 1 1; 1 3 2; 1 0 0]. Expanding along the bottom row gives 1 × (1 × 2 − 1 × 3) = −1. The tool uses row reduction and gets the same answer, −1.
When each operation works
| Operation | Size rule |
|---|---|
| A + B, A − B | A and B must be the same size |
| A × B | columns of A must equal rows of B; a 2 × 3 times a 3 × 4 gives a 2 × 4 |
| Determinant | A must be square |
| Inverse | A must be square with a determinant that is not 0 |
| Transpose | any size |
If multiplication shows an error, the inner sizes do not match. Swapping A and B can change the answer or make it impossible, because matrix multiplication is not commutative.
When does an inverse exist?
Only when the determinant is not zero. For [[2, 4], [1, 2]], the determinant is 2 × 2 − 4 × 1 = 0, so there is no inverse. The rows are multiples of each other, and the matrix squashes the plane onto a line. The determinants and inverses guide shows the 2 × 2 shortcut and the 3 × 3 method.
What the calculator does not do
It does not reduce to row echelon form (RREF), find eigenvalues or raise a matrix to a power. For A², multiply A by itself. To solve a system such as 2x + y = 5 and x − y = 1, find the inverse of the coefficient matrix and multiply it by the column of constants. Inputs can have up to six decimal places.
Tips
- Use a semicolon between rows and a comma between entries.
- Check the size rule before multiplying.
- A determinant of 0 means no inverse.
- The tool keeps exact fractions.
- Read matrices basics explained for the ideas.
Common mistakes
- Multiplying entry by entry. That is not matrix multiplication.
- Assuming AB = BA.
- Adding matrices of different sizes.
- Looking for the inverse of a non-square matrix.
Real-life uses
Matrices drive computer graphics, which rotate and scale images, as well as machine learning, economics, networks and physics. A system of equations can be written with a matrix and solved with its inverse. In data science, tables of numbers are matrices. The 3D video game you play is built on thousands of matrix multiplications per second. For fractions in your answers, use the fraction calculator.