Matrix Multiplication Calculator
Multiply two matrices A and B with the row-by-column dot product rule to get the product matrix C = AB.
How does this calculator work?
To multiply matrices A (m×n) and B (n×q), the inner dimensions must match. Each entry of the product C (m×q) is the dot product of a row of A with a column of B: C[i][j] = Σ A[i][k]·B[k][j]. Order matters, since AB is generally not equal to BA.
Formula
How this is calculated
Enter Matrix A (size m×n) and Matrix B (size p×q), each as text where every line is a row and entries are separated by spaces or commas. Every row within a matrix must contain the same number of values, and all values must be valid numbers.
Matrix multiplication is only defined when the inner dimensions match, that is when the number of columns of A (n) equals the number of rows of B (p). The product C has size m×q. Each entry C[i][j] is the dot product of row i of A with column j of B: C[i][j] = A[i][0]·B[0][j] + A[i][1]·B[1][j] + … + A[i][n-1]·B[n-1][j].
Matrix multiplication is associative and distributive but generally NOT commutative, so AB is usually different from BA. If the inner dimensions do not match, the product is undefined and the calculator reports an error. Empty lines are ignored, and a ragged matrix (rows of unequal length) is treated as invalid.
Frequently asked questions
Only when the number of columns of the first matrix equals the number of rows of the second. An m×n matrix can be multiplied by an n×q matrix, producing an m×q result.
No. In general AB ≠ BA. The order matters, and sometimes only one of the two products is even defined depending on the dimensions.
Type each row on its own line, separating the numbers with spaces or commas. Every row must have the same number of entries.
Also known as
TG we-Calculate Editorial Team. (2026). Matrix Multiplication Calculator [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/matrix-multiplication-calculator
TG we-Calculate Editorial Team. "Matrix Multiplication Calculator." TG we-Calculate. 2026. https://we-calculate.com/calculator/matrix-multiplication-calculator.
TG we-Calculate Editorial Team, "Matrix Multiplication Calculator," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/matrix-multiplication-calculator
@misc{wecalculate_matrix_multiplication_calculator, title = {Matrix Multiplication Calculator}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/matrix-multiplication-calculator}}, year = {2026}, note = {TG we-Calculate} }
Did this calculator help you?
