Exercises — Matrix multiplication — definition, associativity, non-commutativity
Before we start, one picture of the whole "row crosses column" motion — keep it in your head for every single problem below.

Read the figure first. On the left, the pale-blue arrow sweeps across row of (the entries ). On the right, the pink arrow runs down column of (the entries ). The yellow curved arrow shows those two streams meeting at a single yellow dot — that dot is the output entry . The lesson the picture teaches: one output number costs one full row-times-column pass. Every solution below is just this figure repeated for each .
Level 1 — Recognition
(Can you read shapes and grab the right row and column?)
Recall Solution L1.1
First, what those two words mean. Write each matrix as (rows)(columns): is . When you line up a product as , the inner dimensions are the two numbers that sit next to each other in the middle — and — and the outer dimensions are the two on the outside — and . The rule: to form the inner dimensions must match (so each row of has exactly as many entries as each column of , letting the dot product line up), and the result takes the outer dimensions as its (rows)(columns).
- : → inner ✓ → size (outer) . Defined.
- : → inner ✗. Not defined.
- : → inner ✓ → size . Defined.
- : → inner ✓ → size . Defined.
- : → inner ✗. Not defined. What we did: just matched the two inner numbers and copied the two outer numbers. Nothing computed — this is pure bookkeeping.
Recall Solution L1.2
= row of dotted with column of . Row 2 of is ; column 1 of is : = row of dotted with column of . Row 1 of is ; column 2 of is : Why the index reads = (row )(column ): the first index is which output row, the second is which output column. The output row is decided by which row of you slide; the output column by which column of you drop it onto.
Level 2 — Application
(Turn the crank on full products.)
Recall Solution L2.1
Four dot products, each row of against each column of .
- (from L1.2)
- (from L1.2)
Recall Solution L2.2
Inner dims ✓, so is . Each entry is a three-term dot product over the shared index .
Recall Solution L2.3
(a) Row·column. Each output entry is a row of dotted with : (b) Column combination. is copies of column 1 minus copy of column 2: Why both work: the row·column rule and "weight the columns by the vector's entries" are the same arithmetic re-grouped. View (b) is the one that reveals matrices as linear transformations — the output is always a weighted mix of the columns.
Level 3 — Analysis
(Explain and exploit why, not just compute.)
Recall Solution L3.1
FR=\begin{pmatrix}1&0\\0&-1\end{pmatrix}\begin{pmatrix}0&-1\\1&0\end{pmatrix}=\begin{pmatrix}0&-1\\-1&0\end{pmatrix}.$$ They differ, so $RF\neq FR$. **Reading the notation:** $RF$ means "$F$ first, then $R$" — remember the *rightmost matrix touches the vector first*. Track the point $\mathbf{p}=(1,0)$ (the white "start" arrow in **both panels of the figure below**): - $RF\,\mathbf{p}$ (**left panel**): flip $y$ first — $(1,0)$ stays $(1,0)$ (it's on the $x$-axis) — then rotate $90^\circ$ → $(0,1)$, the blue "end" arrow. Check: $\begin{pmatrix}0&1\\1&0\end{pmatrix}\begin{pmatrix}1\\0\end{pmatrix}=\begin{pmatrix}0\\1\end{pmatrix}$ ✓. - $FR\,\mathbf{p}$ (**right panel**): rotate first → $(0,1)$, then flip $y$ → $(0,-1)$, the pink "end" arrow. Check: $\begin{pmatrix}0&-1\\-1&0\end{pmatrix}\begin{pmatrix}1\\0\end{pmatrix}=\begin{pmatrix}0\\-1\end{pmatrix}$ ✓. Same white start arrow, two *different* coloured end arrows → order genuinely matters. That contrast is the whole point of the figure.
The two panels above sit side by side precisely so you can see one identical white starting arrow produce a blue ending arrow on the left (, pointing up) and a pink ending arrow on the right (, pointing down). If matrix multiplication were commutative, the two coloured arrows would coincide — they don't, and that visible gap is non-commutativity.
Recall Solution L3.2
BA=\begin{pmatrix}1&0\\1&1\end{pmatrix}\begin{pmatrix}1&1\\0&1\end{pmatrix}=\begin{pmatrix}1&1\\1&2\end{pmatrix}.$$ $$[A,B]=AB-BA=\begin{pmatrix}2-1&1-1\\1-1&1-2\end{pmatrix}=\begin{pmatrix}1&0\\0&-1\end{pmatrix}.$$ **Meaning:** the commutator is $0$ *if and only if* $A$ and $B$ commute. Here it is nonzero, so $AB\neq BA$ — and the *entries* of $[A,B]$ literally measure how far apart the two products land (they disagree on the diagonal by $\pm1$).Recall Solution L3.3
First . Then . Now the other bracketing: . Then . Equal ✓. Why guaranteed: both spell out "do , then , then " — the same pipeline; only the order you paused to multiply changed, never the order maps act.
Level 4 — Synthesis
(Combine several rules in one problem.)
Recall Solution L4.1
The rule from the parent note: to undo " then " you undo first, so Compute: Proof of ordering (why not ): using the identity and associativity, The inner cancels because it's adjacent; the reversed order is what makes the cancellation line up. The wrong order would leave a mismatched in the middle that does not collapse.
Recall Solution L4.2
, so . Now the transpose side. , : Match ✓. Why order reverses again: transpose swaps rows↔columns, and since pairs row of with column of , transposing turns that into column of (= row of )... the only consistent reassembly is .
Recall Solution L4.3
. The correct expansion keeps order: . From L3.2, and . Also , . Sum: The wrong would use instead of , giving — wrong, because here .
Level 5 — Mastery
(Prove / discover.)
Recall Solution L5.1
Take . Compute entry by entry, each entry a row·column dot product — no shortcuts.
- row 1 col 1 .
- row 1 col 2 .
- row 2 col 1 .
- row 2 col 2 . Notice the bottom row of is all zeros, so any dot product using it is automatically — that kills and . The top row survives, but the only nonzero piece ( in position 2) always meets a from the columns of , so it too dies. Hence Why numbers can't: for reals, (no zero divisors). Matrices do have zero divisors, so " or " is false. Geometrically collapses the plane onto the -axis, then the leftover pushes that line to the origin — two squashes kill everything.
Recall Solution L5.2
Write . The hypothesis says for every ; in particular it must hold for specially chosen test matrices, and each choice squeezes out a constraint on . Test 1: . Setting entrywise: the entries give ; the entries give . So must be diagonal, . Test 2: (the swap matrix). Using the now-diagonal : Setting : the entries force . Hence , i.e. with . Why this finishes the proof. Commuting with all is an extremely strong demand — yet we only needed two cleverly chosen 's to pin down all four entries: Test 1 killed the off-diagonal entries, Test 2 tied the two diagonal entries together. Conversely, obviously commutes with everything, since for any . So the set of "commutes with everything" matrices is exactly — nothing more, nothing less.
Recall Solution L5.3
For a , (see Determinants). . . Product . Now , so . ✓ Why remarkable: determinants measure area-scaling. Doing two maps multiplies the scalings — and multiplying scalars doesn't care about order, so always, even when the matrices themselves don't commute. Order-sensitivity lives in the matrix, not in its determinant.
Active recall
Which product is defined: or ?
In , which matrix touches first?
What does mean?
Correct expansion of for matrices?
and
Give a nonzero with .
Which matrices commute with every matrix?
Connections
- Matrix multiplication — definition, associativity, non-commutativity — the parent these exercises drill.
- Dot Product — every entry of a product is one.
- Linear Transformations — the column view (L2.3) and order-of-composition (L3.1).
- Identity and Inverse Matrices — L4.1 and L5.2.
- Transpose — L4.2 order reversal.
- Determinants — L5.3 multiplicativity.
- Matrix Powers and Diagonalization — commuting matrices (L3.2, L5.2) share eigenvectors.