0.512
Custom
Explanation
Articles
Matrix calculator
Custom
Matrix A
Matrix B
Explanation

How Matrix Multiplication Builds Each Entry

Click a cell of C to replay the calculation for that entry. The numbers above can be changed too.

In matrix multiplication, the (i, j) entry of the result C is what you get by taking the i-th row of A and the j-th column of B, multiplying them term by term and adding everything up. The animation above follows that calculation for a single entry from start to finish. Click a cell of C to replay the calculation for that entry.

The shape condition falls out of that recipe. The i-th row of A is as long as A has columns, and the j-th column of B is as long as B has rows, so unless those two numbers agree, some terms have nothing to pair with. That is why only an m×n matrix and an n×p matrix can be multiplied, and why the result is m×p.

Unlike multiplying numbers, matrix multiplication does not let you swap the order. A × B and B × A can have different shapes, and even when both are defined they are usually different matrices. Try swapping the values of A and B above and see.

Articles