You might ask: "Why do we multiply rows by columns? Why is it so weird?" It's not arbitrary. Matrix multiplication is fundamentally about combining transformations.
If Matrix A rotates a point 90 degrees, and Matrix B scales it by 2x, multiplying A times B gives you a single matrix that does both at once. It is the command center of linear algebra. Once you see matrices as actions rather than grids of numbers, the strange multiplication rule suddenly makes perfect sense: each entry of the product answers the question "how much does this input direction contribute to this output direction?"
How to Do It (Row x Column)
To find the entry in the 1st Row and 1st Column of the result, you take the entire 1st Row of the left matrix and dot-product it with the 1st Column of the right matrix.
[ 3 4 ] x [ 7 8 ] = [ ... ... ]
One more rule before you start: the inner dimensions must match. A matrix with size m×n can only multiply a matrix of size n×p, and the result is m×p. If the inner numbers disagree, the product simply doesn't exist.
Worked Example: The Full 2x2 Product
Let's finish the multiplication above completely, entry by entry.
- Row 1 × Column 1: (1·5) + (2·7) = 5 + 14 = 19
- Row 1 × Column 2: (1·6) + (2·8) = 6 + 16 = 22
- Row 2 × Column 1: (3·5) + (4·7) = 15 + 28 = 43
- Row 2 × Column 2: (3·6) + (4·8) = 18 + 32 = 50
[ 3 4 ] x [ 7 8 ] = [ 43 50 ]
Now try it in the reverse order. Multiplying B × A instead gives a completely different matrix — the top-left entry becomes (5·1) + (6·3) = 23, not 19. This is concrete proof of the most important warning in linear algebra: order matters.
Real World Magic
- 3D Graphics: Every frame you see in Fortnite or Call of Duty is generated by millions of 4x4 matrix multiplications to calculate 3D perspective, rotation, and lighting.
- Artificial Intelligence: Neural networks are basically giant layers of matrix multiplications. Input data (vectors) is multiplied by weights (matrices) to detect patterns.
- Quantum Mechanics: In quantum physics, states of matter are represented by vectors and observables (like energy or momentum) are represented by matrices (operators).
Common Mistakes to Avoid
- Multiplying entry by entry. The product of two matrices is NOT found by multiplying corresponding entries (that's a different operation called the Hadamard product). Always use row-times-column.
- Ignoring dimension compatibility. Trying to multiply a 2×3 matrix by another 2×3 matrix. The inner dimensions (3 and 2) don't match, so the product is undefined — check sizes before you start.
- Assuming commutativity. Swapping the order of matrices mid-calculation because "multiplication is commutative." For matrices, it isn't, and this silently corrupts every step that follows.
- Row/column mix-ups. Dotting a column of the left matrix with a row of the right matrix. It must always be a row from the left and a column from the right.
Frequently Asked Questions
Why is matrix multiplication defined this strange way?
Because it makes composition of linear transformations work. If A and B each represent a transformation, the product AB is defined precisely so that applying AB to a vector gives the same result as applying B first, then A. The row-times-column rule is what falls out of that requirement.
Is there any case where AB equals BA?
Yes, occasionally — for example, when one matrix is the identity matrix, when both are powers of the same matrix, or when both are diagonal. Such matrices are said to "commute." But it's the exception, not the rule, so never assume it.
How do computers multiply huge matrices so fast?
GPUs perform thousands of row-column dot products in parallel, and clever algorithms (like Strassen's method) reduce the number of multiplications needed. This hardware-level parallelism is exactly why modern AI runs on graphics cards.