Matrix Multiplication Calculator

About Matrix Multiplication Calculator

Matrix multiplication is the operation people get wrong most often, because unlike addition it is not element by element and the two matrices do not have to be the same size. The rule is that the number of columns in A must equal the number of rows in B. Multiplying a 2x3 by a 3x4 works and gives a 2x4 result; multiplying a 2x3 by a 2x3 does not work at all. This calculator checks that condition before computing and tells you which dimension is wrong rather than returning a meaningless answer. Each entry in the result is the dot product of a row from A with a column from B: the first entry is row 1 of A paired term by term with column 1 of B and summed. The other property worth remembering is that matrix multiplication is not commutative. AB and BA are generally different matrices, and often only one of the two is even defined. That is why order matters when composing transformations, where the rightmost matrix is applied first. Set both grids, enter the values and the result updates as you type. For the other operations see Matrix Calculator.

How to use Matrix Multiplication Calculator

  1. Select an operation from the tab bar (Add, Multiply, etc.)
  2. Set matrix dimensions and enter values in the grid cells
  3. See the result matrix or scalar instantly

Frequently Asked Questions

How do you multiply two matrices?
Each entry of the result is the dot product of a row from the first matrix and a column from the second: multiply corresponding terms and add them. The entry in row i, column j of the result comes from row i of A and column j of B.
When can two matrices be multiplied?
When the number of columns in the first equals the number of rows in the second. An m x n matrix can multiply an n x p matrix, giving an m x p result. If that inner dimension does not match, the product is undefined.
Is AB the same as BA?
No. Matrix multiplication is not commutative, so AB and BA are usually different, and frequently only one of them is even defined. This is why the order of transformations matters in graphics and physics.
What size result do I get?
The outer dimensions. Multiplying an m x n by an n x p gives an m x p matrix. A 2x3 times a 3x4 produces a 2x4 result, so the inner dimension disappears.
Can I multiply a matrix by a vector?
Yes. A vector is a matrix with one column, so set the second matrix to n rows by 1 column. That is the standard way of applying a transformation to a point.
What is the identity matrix?
A square matrix with ones on the diagonal and zeros elsewhere. Multiplying by it leaves the other matrix unchanged, so it plays the role that 1 plays in ordinary multiplication.

Related Tools

Also Available As