Mistake Master
Home Unit 4 · Functions Involving Parameters, Vectors, and Matrices 4.1·4.2·4.3·4.4·4.5·4.6·4.7·4.8·4.9·4.10·4.11·4.12·4.13·4.14 Lesson
Skill Check 0 / 10 complete

Matrices

A matrix is a rectangular array of numbers, and most of its arithmetic behaves exactly as you would guess: addition and scalar multiplication work entry by entry. The one operation that refuses to be guessed is matrix multiplication, a row-by-column machine with its own dimension rule, its own geometry, and no tolerance for the shortcuts that work on ordinary numbers.

§1

Dimensions: rows first, always.

A matrix with n rows and m columns is an n × m matrix, rows first, every time. The array [[1, 2, 3], [4, 5, 6]], written row by row, has 2 rows and 3 columns: a 2 × 3 matrix, never a 3 × 2. The entry $a_{ij}$ lives in row i, column j, same order.

This bookkeeping sounds trivial until products enter the picture, because the entire legality of a matrix product hangs on reading dimensions in the right order. Say the shape out loud, rows then columns, before doing anything else.

§2

The entrywise operations.

Two operations behave exactly like ordinary arithmetic spread across the array:

  1. Addition (same-shape matrices only): add matching entries. [[1, 2], [3, 4]] + [[5, 0], [−1, 2]] = [[6, 2], [2, 6]].
  2. Scalar multiplication: multiply every entry by the scalar. 3 · [[1, −2], [0, 5]] = [[3, −6], [0, 15]]. Note that 2A doubles the entries; it does not add 2 to them, and it does not change the shape.

These two are the safe ones. The trouble starts when the entrywise habit gets carried into multiplication, where it is flatly wrong.

§3

The product: row dot column.

Matrix multiplication is not entrywise. The entry in row i, column j of AB is the dot product of row i of A with column j of B: march across the row and down the column, multiplying pairs and adding.

Worked in full: [[2, 1], [0, 3]] · [[1, 4], [2, 5]]. Row 1 dot column 1: 2·1 + 1·2 = 4. Row 1 dot column 2: 2·4 + 1·5 = 13. Row 2 dot column 1: 0·1 + 3·2 = 6. Row 2 dot column 2: 0·4 + 3·5 = 15. Product: [[4, 13], [6, 15]]. The entrywise imitation, [[2·1, 1·4], [0·2, 3·5]] = [[2, 4], [0, 15]], is a different and meaningless array.

The dimension rule falls straight out of the mechanism: a row of A must pair off with a column of B, so an n × m matrix can only multiply an m × p matrix, inner dimensions equal, and the product is n × p, the outer pair. A 2 × 3 times a 3 × 4 gives a 2 × 4; the reversed order, 3 × 4 times 2 × 3, has inner pair 4 and 2 and is simply undefined.

§4

Order matters, and the identity.

Even when both orders are defined, they usually disagree. Take A = [[1, 2], [3, 4]] and B = [[0, 1], [1, 0]]. Then AB = [[2, 1], [4, 3]] but BA = [[3, 4], [1, 2]]: B on the right swaps A's columns, B on the left swaps A's rows. AB ≠ BA in general, and no rule of ordinary arithmetic overrides that.

The number 1 does have a matrix analogue: the identity matrix I, ones on the diagonal and zeros elsewhere ([[1, 0], [0, 1]] in the 2 × 2 case). It is the do-nothing factor from either side: AI = IA = A. It is not the all-ones matrix, which very much changes what it multiplies.

§5

Skill Check.

Ten scenarios. Pick the chips that match your answer, then check. A scenario marks complete the first time every part is right. Progress saves on this device.

0 of 10 scenarios complete