Why do you multiply a row by a column to get a single number? Whoever taught you matrix multiplication probably just handed you the rule and moved on. Let's actually figure out where it comes from.
Most people memorize it: take a row from the first matrix, take a column from the second, multiply matching entries, add them up. It works, but it feels arbitrary. It isn't. By the end of this, you'll see matrix multiplication as something much simpler: gluing two transformations of space into one.
What does one entry of the product actually mean?
Let's start small. Say is and is . Their product is , and each entry of is built the same way:
In plain English: to get the entry in row , column of , take row of , take column of , multiply them position by position, and add up the results.
Every Entry Is a Dot Product
Click a cell in C. Its value comes from one row of A and one column of B, multiplied term by term and added up.
Click around the result grid. Every cell in C pulls from exactly one row of A and one column of B, nothing else. That's the whole rule. The "multiply and add" part has a name: it's a dot product. Matrix multiplication is just a grid of dot products, one for every combination of row and column.
But why a dot product? What is A actually doing to a vector?
Here's the thing that makes it click: before we multiply two matrices, look at what a matrix does to a single vector.
Take where . Write it out:
Multiplying a matrix by a vector isn't some abstract operation. It's just scaling A's columns by v's entries and adding the results. tells you how much of column 1 to take, tells you how much of column 2, and you add them.
A Vector Times a Matrix Is a Blend of Columns
Spin the input vector v around the circle. The output is always v's first coordinate times A's first column, plus its second coordinate times A's second column.
Spin the vector v around and watch the output. It never does anything mysterious, it's always just a blend of the same two fixed columns, in different proportions. And hey, notice that a dot product is exactly this same blending idea, just for a single output number instead of a full vector.
So what happens when B is a whole matrix instead of one vector?
Now for the interesting part. A matrix is really just a bundle of column vectors stacked side by side. When we compute , we're not doing anything new, we're applying the "blend A's columns" trick to every column of B, one at a time.
Which means is what you get if you take every vector B would produce, and run it through A afterward. Applying to something is the same as applying , then applying to the result. Multiplying matrices is composing transformations.
AB Means "Do B, Then Do A"
Step through shearing the square with B, then rotating the result with A. On the last step, the dashed outline shows AB applied directly, same shape, one move.
Press play. First B shears the square, then A rotates whatever B produced. On the last step, the dashed outline shows what does in a single move, applied directly to the original square, and it lands in exactly the same place. Two steps, or one matrix. Same answer.
We write this as:
Read right to left: acts first, then acts on whatever came out.
Does the order we multiply in matter?
You'd think and should give the same thing, addition doesn't care about order, so why would this? But matrix multiplication represents doing one thing, then another, and doing things in a different order usually lands you somewhere else.
Order Matters: AB vs BA
Toggle which product runs first. The faint dashed shape is the other order, same two matrices, different result. Matrix multiplication is not commutative.
Toggle between AB and BA. Same two matrices, same starting square, genuinely different results. Rotating a shape and then stretching it sideways does not land in the same place as stretching it first and then rotating it, picture stretching a photo horizontally versus rotating it 90° first, then stretching, the stretch now runs along a completely different direction of the shape.
We write this fact compactly:
There are special matrices where order stops mattering (identity matrices, for one), but in general, matrix multiplication is not commutative. Order is part of the meaning.
Where this shows up
Every 3D game and CAD program chains rotation, scale, and translation matrices together for every object on screen, in a specific order, every frame.
Neural networks are, at their core, layers of matrix multiplications stacked one after another, each layer's output feeding into the next layer's input, exactly the composition idea from above.
Robotics uses chained matrix products to track a robot arm's joints, each joint's rotation composed on top of the last one's position.
Computer graphics pipelines multiply a whole sequence of transformation matrices together in advance, precisely because collapsing two steps into one saves recomputing the whole chain for every point on screen.
The plain-English version
Matrix multiplication looks like an odd row-times-column rule, but it's really composition in disguise. Each entry of the product is a dot product because that's what "how much of this output direction comes from that input direction" boils down to. Multiplying a matrix by a vector blends the matrix's columns. Multiplying two matrices does that blending for every column of the second matrix at once, which is exactly the same as running one transformation through another. And because order changes what "running one thing, then another" means, and are usually different matrices entirely.
All four visualizations are interactive React components running in your browser. No libraries beyond React.