4.5.7 · D2Linear Algebra (Full)

Visual walkthrough — Matrix multiplication — definition, associativity, non-commutativity

1,888 words9 min readBack to topic

Before line one, three plain words we will use constantly:

Everything else is earned below.


Step 1 — A matrix eats a vector and spits out a vector

WHAT. Take the numbers in a matrix and a vector . The rule " acting on ", written , produces a new vector. Its -th slot is:

Read the annotation: to get output slot , you walk along row of , and pair each number with the matching slot of , multiply, and add. The symbol ("sum over ") is just shorthand for "do this for every column and add the results."

WHY this and not something simpler? Because we insist be a linear machine: it must send the grid to a new grid where straight lines stay straight and evenly-spaced dots stay evenly spaced. The only formula with that property is this weighted sum. (Any curved or lopsided rule would bend the grid.)

PICTURE. The grid's basis arrows (right) and (up) get sent to the two columns of . Any is carried along for the ride.

Figure — Matrix multiplication — definition, associativity, non-commutativity

Step 2 — Two machines back to back: the composition question

WHAT. Now run two machines in a row: first , then . Start with , get , then feed that into to get . The brackets say "innermost first."

WHY. This is the whole reason matrix multiplication exists. We want a single machine so that using once does the same job as " then ": The name for that single machine is . Note the reading order: the machine written on the right () acts first, because it sits closest to . This right-to-left habit is where every "order reverses" surprise later comes from.

PICTURE. A dot flows through two boxes: grid (box ) tilted grid (box ) final grid.

Figure — Matrix multiplication — definition, associativity, non-commutativity

Step 3 — Forcing the formula out of the composition promise

WHAT. We compute slot by slot and read off what the combined machine's entries must be. Take output slot :

Term by term: = row of , entry . = slot of the intermediate vector, which we already expanded in Step 1. So is the shared index — the slot where 's columns meet 's rows.

Now swap the two sums and collect the coefficient sitting in front of each :

WHY the swap is legal. These are finite sums of ordinary numbers, so reordering never changes the total (it's just addition rearranged). No calculus, no limits — just applied many times.

The punchline. For the single machine we also need . Matching the coefficient of in both expressions forces Nothing was chosen. The word "compose" wrote this equation.

PICTURE. The bracketed coefficient is literally row of slid across column of : line them up, multiply pairs, add.

Figure — Matrix multiplication — definition, associativity, non-commutativity

Step 4 — Watch one entry get built (a numbers close-up)

WHAT. Concretely with the parent's example , , compute the top-left entry:

The index bookkeeping: (top row of ), (left column of ), and runs across that row and down that column.

WHY show only one entry? Because the pattern is the lesson — every other entry is the same dance with different . Do it four times and you get the parent's .

PICTURE. Highlight row 1 of (horizontal) and column 1 of (vertical); their crossing feeds the top-left slot of .

Figure — Matrix multiplication — definition, associativity, non-commutativity

Step 5 — Order counts: the same two machines, swapped

WHAT. Use (turn 90° left) and (flip up↔down). Then

WHY they differ. Remember Step 2: the right machine acts first. Track the point at : flip-then-turn lands it up top; turn-then-flip lands it at the bottom. Different final spot ⟹ different machines ⟹ . This is non-commutativity, and it's the normal case, not an exception.

PICTURE. The same little flag pushed through the two boxes in each order ends in two different places.

Figure — Matrix multiplication — definition, associativity, non-commutativity

Step 6 — The degenerate & edge cases (no scenario left unshown)

WHAT. Three cases that trip people up:

  • Shapes must lock. If is and is , the inner dimensions () touch and vanish; the outer ones () survive: is . But is — a different shape, so it can't even be compared to . Mismatched inner dimensions ( times ) are simply undefined — the row and column have different lengths, so the dot product can't be formed.
  • The identity . leaves the grid untouched: . Its columns are , so it sends every arrow to itself. See Identity and Inverse Matrices.
  • Zero divisors. With , even though . Geometrically squashes the whole plane onto a line, then onto the origin — two squashes annihilate everything. So does not force or .

WHY collect these. Real problems throw non-square, identity, and singular matrices at you; the row·column rule handles all of them the same way, but the shapes and surprises need to be seen once.

PICTURE. Panels: shape-locking (inner dims cancel), leaving the flag alone, and collapsing the plane to a line.

Figure — Matrix multiplication — definition, associativity, non-commutativity

Step 7 — Associativity is free (grouping never matters)

WHAT. For three machines, .

WHY, visually. A dot flowing through three boxes has one destiny. Whether you first fuse the last two boxes () or the first two (), the pipeline is identical. Applied to any vector: Each equality is just "peel one box off at a time." True for all ⟹ the matrices match.

WHY algebraically. Both bracketings collapse to the same triple sum — and finite sums may be reordered (Step 3's trick again). So "" needs no brackets.

Contrast that with Step 5: grouping is free, but order is not. Two very different-feeling facts, both consequences of "matrices are composed maps."

PICTURE. Three boxes in a line; two different fusings drawn — same output arrow.

Figure — Matrix multiplication — definition, associativity, non-commutativity

The one-picture summary

Figure — Matrix multiplication — definition, associativity, non-commutativity

One figure, the whole story: an arrow enters , becomes a tilted arrow, enters , becomes the final arrow — and the fused machine does it in one step, with each of its entries drawn as a row-of- meeting a column-of-.

Recall Feynman retelling (plain words)

A matrix is a machine that shoves the dots of a grid to new spots, keeping the grid straight. Its two columns tell you exactly where the "right" arrow and the "up" arrow land — everything else follows. To glue two machines into one ("do , then "), I ask: what single machine gives the same landing spot for every starting arrow? Chasing an arrow through both machines and collecting the numbers, the answer is forced: to fill slot (row , column ) of the combined machine, slide row of across column of , multiply the matched numbers, and add — that's the dot product, that's the whole rule. Because the machine on the right runs first, swapping the order usually lands dots elsewhere () — normal, not weird. But regrouping three machines never changes the pipeline, so needs no thought. Shapes must lock (inner sizes kiss and disappear), the identity leaves everything alone, and some non-zero machines squash the plane so hard that squaring them gives zero.


Active recall

Where do the columns of come from, geometrically?
They are where the basis arrows land after acts.
Which index is shared (summed over) in ?
— it runs along row of and down column of .
Why does the right-hand matrix act first in ?
It sits closest to ; brackets say innermost first, so runs before .
Why is reordering the double sum legal in the derivation?
They are finite sums of ordinary numbers, and addition can be rearranged freely.
Why is associativity "free"?
Both groupings are the same pipeline of maps and collapse to the same triple sum .
Can and have different shapes?
Yes — e.g. times gives , but the reverse gives .
Give a non-zero matrix whose square is zero.
; it squashes the plane to a line, then to a point.

Connections

  • Linear Transformations — the "machine moves the grid" picture behind every step.
  • Dot Product — each entry of is a row·column dot product (Step 3–4).
  • Identity and Inverse Matrices — the do-nothing machine and undoing composition.
  • Determinants — how much a machine scales area, and .
  • Transpose — flips rows↔columns; order reverses just like inverses.
  • Matrix Powers and Diagonalization — repeating one machine, and when machines commute.