Matrix Multiplication Calculator
Multiply any two compatible matrices and see the calculated result matrix.
Enter two matrices with their dimensions and values. Get the result matrix from multiplying them together, with validation that the dimensions are compatible for multiplication.
—
Send feedback
💡 Share your idea or report a problem
✓ Thanks! We'll take a look.
Learn more
How It Works
The formula, explained simply
Matrix multiplication combines two matrices into a single result matrix by calculating dot products between rows and columns. When you multiply matrix A by matrix B, each element in the result comes from taking a row from matrix A and multiplying it element-wise with a column from matrix B, then summing those products.
For example, to find the element in row 1, column 2 of your result, you take row 1 from matrix A and column 2 from matrix B. If row 1 is [2, 3, 4] and column 2 is [5, 6, 7], you calculate (2×5) + (3×6) + (4×7) = 10 + 18 + 28 = 56. This process repeats for every position in the result matrix.
The key constraint is dimensional compatibility - the number of columns in the first matrix must equal the number of rows in the second matrix. This ensures that each row-column pair has the same number of elements to multiply and sum. A 3×4 matrix can multiply with any 4×n matrix, but never with a 3×n or 5×n matrix.
The result matrix always has dimensions equal to the outer dimensions of the multiplication - if you multiply a 3×4 matrix by a 4×2 matrix, you get a 3×2 result. Matrix multiplication is not commutative, meaning A×B typically produces a different result than B×A, even when both operations are mathematically valid.
When To Use This
Right tool, right situation
Matrix multiplication is essential in computer graphics for transforming 3D objects - rotation, scaling, and translation operations are represented as matrix multiplications applied to coordinate vectors. Game engines and CAD software rely heavily on these calculations for rendering and animation.
In machine learning, matrix multiplication forms the core of neural network computations. Each layer in a neural network multiplies input vectors by weight matrices to produce outputs, making matrix multiplication the fundamental operation in training and inference.
Economists use matrix multiplication for input-output analysis, modeling how different sectors of an economy interact. The Leontief input-output model multiplies industry demand vectors by inverse coefficient matrices to predict economic impacts.
Engineering applications include solving systems of linear equations, analyzing electrical circuits, and processing digital signals. Control systems engineering uses matrix multiplication to model system responses and design feedback controllers for everything from aircraft autopilots to industrial automation.
Common Mistakes
Why results sometimes look wrong
The most common error is attempting to multiply matrices with incompatible dimensions. Students often assume that any two matrices can be multiplied, but the inner dimensions must match exactly. A 3×2 matrix cannot multiply with a 3×4 matrix - you need the columns of the first to equal the rows of the second.
Another frequent mistake is confusing matrix multiplication with element-wise multiplication. Matrix multiplication involves dot products between rows and columns, not simply multiplying corresponding positions. The result of multiplying two 2×2 matrices is not found by multiplying position (1,1) in both matrices together.
Many students incorrectly assume that matrix multiplication is commutative like regular arithmetic. A×B does not equal B×A in matrix algebra. Even when both A×B and B×A are mathematically possible, they typically produce different results with different dimensions.
Input formatting errors cause calculation failures in matrix calculators. Each row must contain exactly the specified number of values separated by commas, with each row on its own line. Extra spaces, missing commas, or incorrect row counts will prevent the calculation from completing successfully.
The Math
Worked examples and deeper derivation
Matrix multiplication follows the formula: (AB)[i,j] = Σ(k=1 to n) A[i,k] × B[k,j], where n is the shared dimension between the matrices. This summation represents the dot product calculation performed for each position in the result matrix.
The matrices must satisfy the compatibility condition: if matrix A has dimensions m×n and matrix B has dimensions p×q, then n must equal p for multiplication to be possible. The resulting matrix C will have dimensions m×q.
Each element C[i,j] in the result matrix represents the dot product of row i from matrix A and column j from matrix B. For a 2×3 matrix multiplied by a 3×2 matrix, you perform 4 separate dot product calculations (2 rows × 2 columns) to fill the 2×2 result matrix.
The computational complexity grows as O(mnp) for multiplying an m×n matrix by an n×p matrix, making matrix multiplication computationally intensive for large matrices. This is why specialized algorithms like Strassen's method exist to optimize large-scale matrix operations in computer graphics and scientific computing.
Expert Unlock
The thing most explanations skip
The standard O(n³) multiplication algorithm is not optimal for large matrices. Strassen's algorithm achieves O(n^2.807) complexity, while the current best theoretical bound is O(n^2.373). However, these advanced algorithms only become practical for matrices larger than 1000×1000 due to their overhead costs.
Why can't I multiply any two matrices together?
Need something this doesn't cover?
Suggest a tool — we'll build it →