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

โšก Order Matters! A ร— B โ‰  B ร— A

๐Ÿ“– Lesson 5 of 9

๐Ÿ“Œ Key ideas of this section

A ร— B is usually NOT the same as B ร— A.
The handshake: (2 ร— 3) ร— (3 ร— 2) works โ€” the INNER numbers match.
The answer takes the OUTER numbers: 2 ร— 2.

Socks and shoes

With ordinary numbers, 2 ร— 3 = 3 ร— 2 โ€” order never matters. (Grown-up word: multiplication commutes.) Grid addition works that way too: A + B = B + A, since matching squares meet either way. But matrix multiplication is like getting dressed: socks first, then shoes, is NOT the same as shoes first, then socks.

Watch the same two grids multiply in both orders:

A = [ 1  2 ]        B = [ 0  1 ]
    [ 3  4 ]            [ 1  0 ]
A ร— B = [ 2  1 ]        B ร— A = [ 3  4 ]
        [ 4  3 ]                [ 1  2 ]

Check one square of each: in A ร— B, the top-left square is 1ร—0 + 2ร—1 = 2. In B ร— A, it's 0ร—1 + 1ร—3 = 3. Different from the very first square! (Sharp eyes: A ร— B swapped A's columns, and B ร— A swapped A's rows. B is the swapper grid โ€” you'll meet it again in Lesson 7.)

Usually different โ€” not always. Once in a while a special pair of grids multiplies to the same answer in both orders (the intermediate problems sneak one in). But you can never count on it: with matrices, order matters.

The size handshake

Which grids can even meet? Write their sizes side by side and check the INNER numbers:

(2 ร— 3) ร— (3 ร— 2)   โ†’   inner 3 and 3: MATCH โœ…   answer size: 2 ร— 2
(2 ร— 3) ร— (2 ร— 3)   โ†’   inner 3 and 2: NO MATCH โŒ   impossible!

Why? Every row of A must pair with a column of B, number by number. A row of a 2 ร— 3 grid holds 3 numbers, so it can only pair with a column that also holds 3 โ€” and the columns of a (3 ร— anything) grid always do. Inner numbers match = every pairing is complete.

The answer takes the OUTER numbers: rows of A by columns of B. And the extreme case is wild:

(1 ร— 4) ร— (4 ร— 1)  โ†’  1 ร— 1   (one number โ€” a single giant dot product!)
(4 ร— 1) ร— (1 ร— 4)  โ†’  4 ร— 4   (sixteen squares from the same two skinny grids!)

Same grids, flipped order โ€” even the SIZES disagree. Order really, really matters.

โœ๏ธ Your Turn!

A is 2 ร— 3 and B is 3 ร— 1. (a) Does A ร— B exist? If so, what size? (b) Does B ร— A exist?

๐Ÿ‘€ Show the answers

Answers: (a) Yes โ€” the inner 3s match; the answer is 2 ร— 1 (a column!). (b) No โ€” the inner numbers would be 1 and 2, and 1 โ‰  2: no handshake, no product.

V.3.1