๐Ÿ  Home โ€บ ๐Ÿ”ข Matrix Math โ€บ Lesson 4

๐Ÿ” The Real Matrix Multiplication โ€” Row ร— Column

๐Ÿ“– Lesson 4 of 9

๐Ÿ“Œ Key idea of this section

Row of A pairs with column of B: multiply the partners, ADD the results.
Each (row, column) meeting makes ONE square of the answer.

The bakery problem

Adding grids was gentle. Multiplying two grids is the strangest recipe in this lesson โ€” so start with the question it was invented to answer.

At the bakery, a muffin costs 2 coins and a juice costs 3. On Monday you buy 3 muffins and 1 juice. On Tuesday, 2 muffins and 4 juices. How much did you spend each day?

Monday:   3 ร— 2 + 1 ร— 3 = 6 + 3 = 9
Tuesday:  2 ร— 2 + 4 ร— 3 = 4 + 12 = 16

Look at the shape of that computation: items ร— prices, paired up and added. Now write the items as a grid (rows = days) and the prices as a column:

[ 3  1 ] ร— [ 2 ] = [  9 ]
[ 2  4 ]   [ 3 ]   [ 16 ]

The top row (Monday's items) pairs with the price column: first ร— first, second ร— second, then add. That's Monday's total โ€” and it lands in the top square of the answer. The bottom row does the same for Tuesday. Each pairing melted a whole row into ONE number.

The pairing has a name: dot product

Pairing two lists number-by-number, multiplying, and adding is called a dot product:

[ 1  2 ] ยท [ 3 ; 1 ]  =  1ร—3 + 2ร—1 = 3 + 2 = 5

Row ร— column = pair, multiply, add. Say it until it's automatic โ€” everything else in this lesson is built from it.

The full recipe: every row meets every column

When B has two columns, each row of A meets EACH column of B โ€” and every meeting makes one square of the answer. Watch all four meetings:

[ 1  2 ] ร— [ 3  1 ] = [ 7  9 ]
[ 0  1 ]   [ 2  4 ]   [ 2  4 ]
(row 1, column 1):  1ร—3 + 2ร—2 = 3 + 4 = 7
(row 1, column 2):  1ร—1 + 2ร—4 = 1 + 8 = 9
(row 2, column 1):  0ร—3 + 1ร—2 = 0 + 2 = 2
(row 2, column 2):  0ร—1 + 1ร—4 = 0 + 4 = 4

The address of each answer square tells you exactly who met: square (row 1, column 2) came from row 1 of A and column 2 of B. Row 1 of A never touches row 2 of the answer. That's the whole machine!

Why the weird recipe? Because it's useful. Rows carry "things that happened" (days, players, purchases); columns carry "weights" (prices, points). Row ร— column turns a table of events into totals โ€” the bakery trick, over and over, a million times a second inside every computer.

โœ๏ธ Your Turn!

Compute [ 2 1 ; 1 2 ] ร— [ 1 3 ; 0 2 ]. Four meetings โ€” do them all.

๐Ÿ‘€ Show the answers

Answer: (row 1, column 1) = 2ร—1 + 1ร—0 = 2; (row 1, column 2) = 2ร—3 + 1ร—2 = 8; (row 2, column 1) = 1ร—1 + 2ร—0 = 1; (row 2, column 2) = 1ร—3 + 2ร—2 = 7. So the answer is [ 2 8 ; 1 7 ]. โœ…

V.3.1