Matrix Multiplication: Why It Works the Way It Does
You already know how to multiply numbers. 3×5=15. Simple. Matrix multiplication looks different — and it is different — but there's a reason for every rule.
The Intuition: A Factory Analogy
Imagine you run a factory that makes two products: chairs and tables. Each product needs raw materials: wood and metal.
Let the first matrix tell you how much of each material goes into each product:
This is a 2×2 matrix: A=[2314].
Now suppose you have two different price lists for wood and metal — one from Supplier X, one from Supplier Y:
| Supplier X | Supplier Y |
|---|
| Wood | 5 | 6 |
| Metal | 7 | 8 |
This is a 2×2 matrix: B=[5768].
You want to know: What is the total cost of making one chair using Supplier X's prices? You take the wood cost (2×5) plus the metal cost (1×7) = 10+7=17.
That single number — 17 — is the first entry of the product matrix AB. It comes from the first row of A (chair's material needs) dotted with the first column of B (Supplier X's prices).
Matrix multiplication is row times column. Each entry (i,j) of AB is the dot product of row i of A with column j of B.
The Precise Definition
If A is an m×n matrix and B is an n×p matrix, then their product C=AB is an m×p matrix where:
cij=∑k=1naikbkj
That sum is just a compact way of saying: multiply each element in row i of A by the corresponding element in column j of B, then add them all up.
The number of columns in A must equal the number of rows in B. If A is 3×2 and B is 2×4, you can multiply — the inner dimensions match (2 = 2). If A is 3×2 and B is 3×3, you cannot. The operation is undefined.
Properties That Hold (and One That Doesn't)
1. Associativity: (AB)C=A(BC) — as long as the dimensions line up, the grouping doesn't matter. This is a lifesaver in calculations.
2. Distributivity: A(B+C)=AB+AC and (A+B)C=AC+BC — exactly like numbers.
3. Identity: There is an identity matrix I (1's on the diagonal, 0's elsewhere) such that AI=A and IA=A.
Matrix multiplication is NOT commutative. In general, AB=BA. Even when both products are defined, they rarely give the same result. This is the single most important difference from ordinary multiplication.
Why Commutativity Fails …