← mapVectors & Matrices

Matrices & Their Arithmetic

⚗ Dr. Möbius, from the lab

You spent several lessons turning systems of equations into geometry. Good. Now I'm going to show you what happens when you sand off all the variables, keep the numbers, and treat the resulting grid as a single mathematical object. The matrix. It stores everything — and we haven't even gotten to the transformation magic yet, that's next — but for now I need you to respect the grid. Touch the wrong index once in this lab and the whole beaker shatters.

THE BIG IDEA

A matrix is a rectangular array of numbers indexed by row and column; matrices support entrywise addition and scalar multiplication, and a transpose operation that flips rows and columns.

What a matrix is

A matrix is a rectangular grid of numbers. Here is a 2×32 \times 3 matrix (two rows, three columns):

A=(125031)A = \begin{pmatrix} 1 & -2 & 5 \\ 0 & 3 & -1 \end{pmatrix}

The dimensions of a matrix are always stated rows-first, columns-second: an m×nm \times n matrix has mm rows and nn columns. The entry in row ii and column jj is written aija_{ij} or AijA_{ij} or (A)ij(A)_{ij} — all the same, all slightly annoying. Row index first, column index second, always — this is not a convention you get to disagree with. Getting it backwards is the canonical beginner mistake, and if you do it in my lab you will write "aija_{ij} means row ii, column jj" on the blackboard until the chalk runs out and then you'll continue with your finger.

Single-column matrices (n=1n = 1) are column vectors — you've been using these as vectors since the previous two lessons. Single-row matrices (m=1m = 1) are row vectors. A 1×11 \times 1 matrix is just a scalar with delusions of grandeur.

Three jobs matrices hold

Before we compute anything, let me tell you why matrices exist. They serve three distinct purposes in this course:

  1. Storing a linear system's coefficients. The system 2x+3y=52x + 3y = 5, xy=1x - y = 1 becomes the matrix (2311)\begin{pmatrix} 2 & 3 \\ 1 & -1 \end{pmatrix} with the xx's and yy's sandblasted off. All the information is there; nothing is lost. This is why you saw elimination in the Algebra stratum — it's secretly matrix row reduction, and you'll meet it again in a later lesson as Gaussian elimination.

  2. Storing data in a table. A spreadsheet is a matrix. A grayscale image is a matrix (each entry is a pixel brightness). A social network's connections can be a matrix. This use is important in applications but not our main concern here.

  3. Encoding a transformation. This is the real one. A 2×22 \times 2 matrix isn't just a table of four numbers — it's a function that moves the entire plane around. This third use is the reason this stratum exists, and we will spend the next several lessons building up to it.

Addition and scalar multiplication: embarrassingly simple

Adding two matrices of the same size: add the corresponding entries.

(1234)+(5107)=(1+52+(1)3+04+7)=(61311)\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} + \begin{pmatrix} 5 & -1 \\ 0 & 7 \end{pmatrix} = \begin{pmatrix} 1+5 & 2+(-1) \\ 3+0 & 4+7 \end{pmatrix} = \begin{pmatrix} 6 & 1 \\ 3 & 11 \end{pmatrix}

You cannot add matrices of different sizes. R2×2+R2×3\mathbb{R}^{2\times 2} + \mathbb{R}^{2\times 3} is undefined, exactly the way you can't add vectors of different lengths. Dimensions must agree.

Scalar multiplication: multiply every entry by the scalar.

3(1250)=(36150)3 \begin{pmatrix} 1 & -2 \\ 5 & 0 \end{pmatrix} = \begin{pmatrix} 3 & -6 \\ 15 & 0 \end{pmatrix}

All the familiar laws hold: commutativity and associativity of addition, distributivity of scalar multiplication over matrix addition. These are inherited component-by-component from the real number laws. I won't prove them because they're exercises, and I strongly — no, I furiously — suggest you verify at least one with a 2×22\times 2 example. Seriously. Do the damn check. Nine seconds. Go.

The zero matrix OO (all entries zero) is the additive identity: A+O=AA + O = A.

Transpose: flipping rows and columns

The transpose of a matrix AA, written ATA^T, is the matrix you get by reflecting AA across its main diagonal — row ii becomes column ii, or equivalently (AT)ij=Aji(A^T)_{ij} = A_{ji}.

A=(123456)AT=(142536)A = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{pmatrix} \quad \Longrightarrow \quad A^T = \begin{pmatrix} 1 & 4 \\ 2 & 5 \\ 3 & 6 \end{pmatrix}

The 2×32 \times 3 matrix became a 3×23 \times 2 matrix. In general, the transpose of an m×nm \times n matrix is n×mn \times m.

A symmetric matrix satisfies A=ATA = A^T, meaning aij=ajia_{ij} = a_{ji} for all i,ji, j. Symmetric matrices are necessarily square, and their entries mirror across the main diagonal:

(1337)=(1337)T\begin{pmatrix} 1 & 3 \\ 3 & 7 \end{pmatrix} = \begin{pmatrix} 1 & 3 \\ 3 & 7 \end{pmatrix}^T

Symmetric matrices are extremely special — they are the royalty of the matrix world and they know it. They'll headline the final boss of this entire course, the Spectral Theorem, which is so damn beautiful it should be illegal. File the word "symmetric" away and treat it with reverence whenever it appears.

The identity matrix

The identity matrix InI_n (or just II when the size is clear) is the n×nn \times n matrix with 11's on the main diagonal and 00's everywhere else:

I2=(1001),I3=(100010001)I_2 = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}, \quad I_3 = \begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix}

The identity matrix will be the "11" of matrix multiplication (next lesson). It's also symmetric, self-transpose, and has every column and row summing to exactly 11. It is, in a very real sense, the do-nothing transformation — it leaves every vector exactly where it was. This makes it the matrix version of the number 11, the "identity element" for multiplication. It is called the identity matrix for exactly that reason.

🔬 SPECIMENS (worked examples)

Worked example 1 — matrix addition and scalar multiplication

Let A=(2105)A = \begin{pmatrix} 2 & -1 \\ 0 & 5 \end{pmatrix} and B=(3421)B = \begin{pmatrix} 3 & 4 \\ -2 & 1 \end{pmatrix}. Compute 2A+B2A + B.

Step 1: Scalar multiplication first — multiply every entry of AA by 22: 2A=(42010)2A = \begin{pmatrix} 4 & -2 \\ 0 & 10 \end{pmatrix}

Step 2: Add entrywise: 2A+B=(42010)+(3421)=(4+32+40+(2)10+1)=(72211)2A + B = \begin{pmatrix} 4 & -2 \\ 0 & 10 \end{pmatrix} + \begin{pmatrix} 3 & 4 \\ -2 & 1 \end{pmatrix} = \begin{pmatrix} 4+3 & -2+4 \\ 0+(-2) & 10+1 \end{pmatrix} = \begin{pmatrix} 7 & 2 \\ -2 & 11 \end{pmatrix}

Check each entry: (1,1)(1,1): 4+3=74+3=7. (1,2)(1,2): 2+4=2-2+4=2. (2,1)(2,1): 02=20-2=-2. (2,2)(2,2): 10+1=1110+1=11. All correct.

Worked example 2 — transpose and identifying symmetry

Compute ATA^T for A=(132407)A = \begin{pmatrix} 1 & 3 & -2 \\ 4 & 0 & 7 \end{pmatrix}. Then determine whether B=(5113)B = \begin{pmatrix} 5 & -1 \\ -1 & 3 \end{pmatrix} is symmetric.

Transpose of AA: Row 11 of AA becomes column 11 of ATA^T; row 22 becomes column 22. AT=(143027)A^T = \begin{pmatrix} 1 & 4 \\ 3 & 0 \\ -2 & 7 \end{pmatrix}

AA was 2×32\times 3; its transpose is 3×23\times 2.

Symmetry of BB: Compute BTB^T by flipping the off-diagonal entries. BT=(5113)B^T = \begin{pmatrix} 5 & -1 \\ -1 & 3 \end{pmatrix}

B=BTB = B^T, so yes, BB is symmetric. Notice: the diagonal can be anything; the test is whether b12=b21b_{12} = b_{21} (and in larger matrices, bij=bjib_{ij} = b_{ji} for all off-diagonal pairs).

Worked example 3 — the trap: rows first, columns second, or suffer

For the matrix M=(721504)M = \begin{pmatrix} 7 & 2 & -1 \\ 5 & 0 & 4 \end{pmatrix}, find the entries m12m_{12}, m21m_{21}, and m23m_{23}.

Remember: mijm_{ij} means row ii, column jj.

  • m12m_{12}: row 11, column 22. Row 11 is (7,2,1)(7, 2, -1); column 22 of that is 2\mathbf{2}.
  • m21m_{21}: row 22, column 11. Row 22 is (5,0,4)(5, 0, 4); column 11 of that is 5\mathbf{5}.
  • m23m_{23}: row 22, column 33. Row 22 is (5,0,4)(5, 0, 4); column 33 of that is 4\mathbf{4}.

The common trap is to read m21m_{21} as "row 2, column 1 = 0" because you scanned the second entry of the second row. But column 1 of row 2 is the first entry of the second row, which is 55. Slow down and count.

☠ KNOWN HAZARDS

  • Reading the index backwards. aija_{ij} means row ii, column jj — NOT the other way around. The row index comes first in every convention, everywhere, forever. If you write a32a_{32} when you mean row 2, column 3, every single matrix computation you do will be wrong and you will go insane trying to figure out why.

  • Adding matrices of different sizes. Matrix addition is only defined when the dimensions match. A+BA + B requires AA and BB to have exactly the same number of rows AND the same number of columns.

  • Thinking (AT)T=(A^T)^T = something new. Transposing twice returns you to the original: (AT)T=A(A^T)^T = A. It's a flip; two flips is where you started.

  • Thinking scalar multiplication changes the dimensions. Multiplying a 3×23\times 2 matrix by a scalar gives a 3×23\times 2 matrix. The size never changes under scalar multiplication — only under operations like transposition or (later) matrix multiplication.

TL;DR

  • A matrix is an m×nm\times n grid of numbers; entry aija_{ij} is in row ii and column jj — rows first, always.

  • Addition and scalar multiplication work entrywise; both matrices must have the same dimensions for addition to be defined.

  • Transpose: (AT)ij=Aji(A^T)_{ij} = A_{ji}. Flips rows into columns; turns an m×nm\times n matrix into n×mn\times m.

  • Symmetric matrices satisfy A=ATA = A^T; they are always square and will become very important in later strata.

  • The identity matrix InI_n is the n×nn\times n matrix with 11's on the diagonal and 00's elsewhere — the do-nothing matrix.

unlocks