A matrix calculator performs operations on grids of numbers. To multiply two matrices, each entry of the result is the dot product of a row of the first with a column of the second, which requires the first matrix to have as many columns as the second has rows. Choose A × B above to see it worked out for 2×2, 3×3 or 4×4 matrices.
How does matrix multiplication work?
To multiply A × B you take the first row of A, multiply it entry by entry with the first column of B, and add the products. That sum is the top-left entry of the result. Repeat for every row of A and column of B. For two 2×2 matrices [[1,2],[3,4]] × [[5,6],[7,8]] the top-left entry is 1×5 + 2×7 = 19, which gives the matrix [[19,22],[43,50]]. This is the standard matrix multiplication that people search for as a matrix multiplication calculator, and the tool above shows B × A too, because the order matters: A × B is generally different from B × A.
Addition and subtraction
Add or subtract matrices of the same size by combining the entries in the same position. There are no tricky rules here: A + B = B + A, and subtracting is the same as adding the negative. Scalar multiplication, multiplying every entry by a number, is also entry by entry.
What else can you do with one matrix?
- Determinant: a single number that tells you whether the matrix is invertible. See the determinant calculator.
- Inverse: the matrix that undoes A, so that A × A⁻¹ = I. See the inverse matrix calculator.
- Eigenvalues and eigenvectors: the directions a matrix only stretches, and the stretch factors. See the eigenvalue calculator.
- Transpose: swap rows and columns.
Where matrices are used
Matrices describe linear transformations, so they appear in computer graphics (rotating and scaling images), solving systems of equations, statistics (covariance matrices), engineering (stiffness matrices) and machine learning (weights of neural networks). Many Dutch university courses in the first year of technical studies, such as at TU Delft, TU/e and Twente, include linear algebra with exactly these operations.
Tips for avoiding mistakes
- Check the sizes first. For A × B the number of columns in A must equal the number of rows in B. This tool uses square matrices of the same size, which always work.
- Multiplication is not commutative. If your answer changes when you swap A and B, that is normal.
- Round-off: results show up to four decimals. For exact fractions, work the arithmetic by hand once to confirm.
How to use this calculator
- Choose the matrix size (2×2, 3×3 or 4×4) and the operation.
- Type your numbers into the matrix grids. Decimals and negatives are fine.
- The result updates instantly, including checks such as A × A⁻¹.
- Change the operation to explore the same matrix in other ways.
Key figures at a glance
| Sizes | 2×2, 3×3, 4×4 |
|---|---|
| Product entry | row · column dot product |
| Identity | I × A = A × I = A |
| Commutative? | No (A×B ≠ B×A) |
Frequently asked questions
Multiply each row of the first matrix by each column of the second, entry by entry, and add the products. The result at row i, column j is the dot product of row i of A and column j of B.
No. A × B is usually different from B × A.
Square matrices of 2×2, 3×3 and 4×4.
A square matrix with ones on the diagonal and zeros elsewhere. Multiplying by it leaves a matrix unchanged.
Enter decimals. The result is shown to four decimal places.