๐ Key idea of this section
Rows go ACROSS. Columns go DOWN. Size = (rows) ร (columns). Address = (row, column) โ row first!
The scoreboard grid
You and a friend play three rounds of a game. Your scores are 3, 7, 1; your friend's are 8, 2, 6. A table holds the whole story:
[ 3 7 1 ] [ 8 2 6 ]
That grid of numbers is a matrix. The sideways lines are rows (like rows of seats in a theater โ across!). The up-and-down lines are columns (like the stone columns that hold up a roof โ up and down!). Here, row 1 is you, row 2 is your friend, and each column is one round.
Size: rows first, always
Count the rows, then the columns: this grid is 2 by 3, written 2 ร 3. Not 3 ร 2! Rows always get named first โ a 3 ร 2 grid has THREE rows and two columns, a completely different shape:
[ 3 8 ] [ 7 2 ] [ 1 6 ]
Addresses: every square has a seat number
Every square in a grid has an address made of two numbers: (row, column). In the scoreboard, the 6 sits at (row 2, column 3). Row first, always. (Grown-ups squeeze the address into a tiny corner: aโโ means "row 2, column 3." Same idea, smaller costume.)
The flat way to write a grid
Drawing a grid takes several lines, so there's a squished one-line notation too: a semicolon means "drop down to the next row."
[ 3 7 1 ; 8 2 6 ] is the very same scoreboard grid
You'll see both styles in the practice problems โ they're the same grids in different outfits.
Two special shapes
A grid with ONE row, like [ 4 0 6 1 ], is called a row grid (size 1 ร 4). A grid with ONE column is a column grid (size 3 ร 1):
[ 5 ] [ 2 ] [ 9 ]
Even a single number like 7 is secretly a 1 ร 1 grid. Once you see it, you see grids everywhere: a spreadsheet is a giant matrix, and a photo is a giant matrix of pixel numbers.
โ๏ธ Your Turn!
Here is a grid: T = [ 5 9 2 ; 4 0 8 ]. (a) What is its size? (b) What number sits at (row 1, column 3)? (c) What is the address of the 9?
๐ Show the answers
Answers: (a) 2 ร 3 โ two rows, three columns. (b) 2. (c) (row 1, column 2) โ the 9 is in the first row, second column.