Compute one entry of a product AB
Say that entry (i,j) of AB is row i of A dotted with column j of B. The idea in plain words, a worked example, and a check with the answers shown — part of the free Linear Algebra guides.
Entry of is row of dotted with column of:
Row 1 of is; column 2 of is. Multiply matching entries and add:. The answer is filed in row 1, column 2.
The indices split for a reason. The row index is's, because is the thing doing the acting. The column index is's, because column of is times column of. Neither index ever moves to the other matrix.
The sizes make this possible. A row of has exactly as many entries as a column of — that is what "the inner dimensions match" buys you. If they did not, the dot product would not exist.
Column of is times column of. That single fact generates the whole multiplication rule: to get one column of the product, feed one column of into.
Feeding a vector into means, by the row picture, taking one dot product per row of. So column of has, in row, the dot product of row of with that column of. That is the rule, derived rather than memorised.
Run the same argument with a column of the answer instead of a single entry and you get the column picture: each output column is a weighted sum of's columns. Both pictures describe the same arithmetic; the row picture is faster by hand and the column picture explains more.
Question. For
compute entries and of.
Step 1 — record the shapes. is and is, so is and both required positions exist.
Step 2 — entry: row 1 of with column 2 of. Row 1 of is; column 2 of is. Dot:.
Step 3 — entry: row 2 of with column 1 of. Row 2 of is; column 1 of is. Dot:.
Step 4 — answer. and.
Step 5 — check by a different route. Column 2 of is
, which is. The first entry matches ✓ — and the second entry,, is, which we did not ask for but now know.
- Say that entry (i,j) of AB is row i of A dotted with column j of B
- Compute one entry correctly for a rectangular pair
- Name the slot a computed dot product belongs in
- Reject column-of-A-times-row-of-B as the rule
and. Compute entry of, and then all of if you can.
Answer
Entry is row 2 of with column 2 of:.
The whole product is:
Check one entry by the column route: column 1 of is ✓, which is the first column above.