Matrix Multiplication Calculator
Multiply two matrices of compatible sizes (up to 3 × 3) instantly. Choose the dimensions of matrix A and B, enter their elements, and get the full product matrix A × B.
Matrix Multiplication Solver
Matrix Multiplication Formula
Where:
- \(C_{ij}\) — element in row \(i\), column \(j\) of the product matrix
- \(A_{ik}\) — element in row \(i\), column \(k\) of matrix A
- \(B_{kj}\) — element in row \(k\), column \(j\) of matrix B
- \(n\) — the shared dimension: the number of columns of A, which must equal the number of rows of B
Each element of the product is the sum of the products of the corresponding entries from a row of A and a column of B — the classic "row times column" rule.
Matrix Multiplication – Calculation Example
Example: multiply two 3 × 3 matrices (these are the calculator's default values, so you can reproduce the result above).
\[ A = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{bmatrix}, \quad B = \begin{bmatrix} 9 & 8 & 7 \\ 6 & 5 & 4 \\ 3 & 2 & 1 \end{bmatrix} \]
Take row 1 of A and column 1 of B: \( 1 \cdot 9 + 2 \cdot 6 + 3 \cdot 3 = 30 \). Repeating this for every row–column pair gives:
\[ C = A \times B = \begin{bmatrix} 30 & 24 & 18 \\ 84 & 69 & 54 \\ 138 & 114 & 90 \end{bmatrix} \]
Result: a 3 × 3 matrix whose first element is 30, second 24, and so on.
How to use the calculator
- Set the Matrix A size (e.g. 3 × 3) and the Matrix B size using the dropdowns. The number of columns of A must equal the number of rows of B — otherwise the calculator reports incompatible sizes.
- Enter the elements of Matrix A in the fields A11, A12, … Fields outside the selected size become read-only and are ignored.
- Enter the elements of Matrix B in the fields B11, B12, …
- Read the product matrix A × B in the result table. Its dimensions are (rows of A) × (columns of B).
What is matrix multiplication?
Matrix multiplication is a binary operation that combines two matrices into a new matrix. Unlike ordinary number multiplication, it is not element-by-element: each entry of the result is a dot product of a row from the first matrix and a column from the second. An \(m \times n\) matrix A can be multiplied by an \(n \times p\) matrix B, and the result has size \(m \times p\).
The order of multiplication matters. In general \(AB \neq BA\), and often only one of the two products is even defined. Whenever you compute \(A \times B\), you are multiplying rows of A by columns of B — swapping the matrices produces a different (or impossible) operation.
Matrix products appear everywhere in applied mathematics: transforming points and objects in computer graphics, chaining transformations in robotics, solving systems of linear equations, and powering the layers of neural networks in machine learning. Multiplying a matrix by itself gives the matrix squared, which you can compute with the Matrix Squared calculator.
Interpreting the result
The result table shows the product matrix \(C\) with \(m\) rows and \(p\) columns. Each element \(C_{ij}\) was obtained by multiplying the \(i\)-th row of A element-wise with the \(j\)-th column of B and summing the results. If any row of A is multiplied out of order, the element will be wrong — which is exactly the kind of slip this calculator prevents.
If you also need to combine matrices entry-by-entry, use the matrix addition or subtraction calculators instead — those operations work element-wise and require identical dimensions.
Assumptions, limitations and tips
- Size limits: this calculator supports matrices up to 3 × 3. Larger products are computed the same way but must be done with software or by hand.
- Compatibility rule: multiplication is only defined when columns of A = rows of B. A 2 × 3 matrix times a 3 × 2 matrix works (result 2 × 2); a 3 × 2 matrix times a 2 × 3 matrix also works (result 3 × 3) — but they give different answers.
- Non-commutativity: since \(AB \neq BA\) in general, always check which matrix comes first in your problem.
- Determinant shortcut: for square matrices, \(\det(AB) = \det(A) \cdot \det(B)\). You can verify this with the Determinant Multiplication calculator.
- Applications: if the product feeds into further linear-algebra work — for example finding an inverse — the Inverse Matrix 3×3 calculator covers the next step.
Frequently Asked Questions
How do I multiply two matrices by hand?
Use the row-times-column rule. To get the element in row \(i\), column \(j\) of the product, multiply each entry of row \(i\) of the first matrix by the matching entry of column \(j\) of the second matrix, then add. For a 2 × 2 example: \(\begin{bmatrix} a & b \\ c & d \end{bmatrix} \begin{bmatrix} e & f \\ g & h \end{bmatrix} = \begin{bmatrix} ae+bg & af+bh \\ ce+dg & cf+dh \end{bmatrix}\). Repeat for every row–column pair, staying organized cell by cell.
Why is matrix multiplication not commutative?
Because rows of the first matrix are paired with columns of the second, reversing the order pairs different entries together, so \(AB\) and \(BA\) are usually computed from different numbers. The two products may even have different dimensions — a 2 × 3 times a 3 × 2 gives 2 × 2, while the reverse gives 3 × 3 — or one product may not exist at all. Only in special cases, such as when one matrix is the identity, are the products equal.
Can I multiply matrices of any size?
No. The inner dimensions must match: an \(m \times n\) matrix can only be multiplied by an \(n \times p\) matrix. The result is always \(m \times p\) — the outer dimensions. A quick check is to write the sizes side by side: (2 × 3)(3 × 4) works because the middle numbers agree, giving a 2 × 4 result. If the middle numbers differ, the product is undefined.
What are the most common mistakes when multiplying matrices?
The top errors are: multiplying element-by-element like ordinary numbers, pairing a column of A with a row of B instead of a row with a column, misaligning entries when reading diagonally, and losing track of a negative sign in the sums. Also watch out for order — entering B before A gives a different answer. This calculator avoids all of these by enforcing compatible sizes and doing the arithmetic exactly.
How do I multiply a matrix by a vector?
Treat the vector as a matrix with one column — a 3 × 1 matrix. Multiply it just like any other matrix: \(A v\) is defined when A has as many columns as the vector has entries, and the result is another column vector. For example, \(\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \begin{bmatrix} 5 \\ 6 \end{bmatrix} = \begin{bmatrix} 17 \\ 39 \end{bmatrix}\). This operation is at the heart of solving linear systems \(Ax = b\).
What happens when I multiply by the identity matrix?
The identity matrix \(I\), with 1s on the diagonal and 0s elsewhere, leaves any compatible matrix unchanged: \(AI = IA = A\). It plays the same role as the number 1 in ordinary multiplication. You can use this as a quick sanity check: if multiplying your matrix by I does not return the original matrix, something went wrong in your method.
Does matrix multiplication work with decimals or negative numbers?
Yes. Entries can be any real numbers — positive, negative, fractions, or decimals — and the row-times-column rule works exactly the same way. Just be careful with signs: two negatives make a positive in each product, and it is easy to drop a minus sign when summing. With fractions, converting to decimals first can reduce arithmetic slips, though exact fractions avoid rounding.