What a matrix is
A matrix is a rectangular grid of numbers. Here is a matrix (two rows, three columns):
The dimensions of a matrix are always stated rows-first, columns-second: an matrix has rows and columns. The entry in row and column is written or or — 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 " means row , column " on the blackboard until the chalk runs out and then you'll continue with your finger.
Single-column matrices () are column vectors — you've been using these as vectors since the previous two lessons. Single-row matrices () are row vectors. A 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:
-
Storing a linear system's coefficients. The system , becomes the matrix with the 's and '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.
-
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.
-
Encoding a transformation. This is the real one. A 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.
You cannot add matrices of different sizes. is undefined, exactly the way you can't add vectors of different lengths. Dimensions must agree.
Scalar multiplication: multiply every entry by the scalar.
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 example. Seriously. Do the damn check. Nine seconds. Go.
The zero matrix (all entries zero) is the additive identity: .
Transpose: flipping rows and columns
The transpose of a matrix , written , is the matrix you get by reflecting across its main diagonal — row becomes column , or equivalently .
The matrix became a matrix. In general, the transpose of an matrix is .
A symmetric matrix satisfies , meaning for all . Symmetric matrices are necessarily square, and their entries mirror across the main diagonal:
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 (or just when the size is clear) is the matrix with 's on the main diagonal and 's everywhere else:
The identity matrix will be the "" of matrix multiplication (next lesson). It's also symmetric, self-transpose, and has every column and row summing to exactly . 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 , the "identity element" for multiplication. It is called the identity matrix for exactly that reason.