A grid of numbers
A matrix is simply a rectangular arrangement of numbers, lined up in horizontal rows and vertical columns and wrapped in brackets. Each number inside is called an entry. That is the whole idea — a matrix holds many numbers in one neat package, so we can carry a table of data, or the coefficients of a whole system of equations, as a single object.
column 1 column 2 column 3 row 1 [ 2 -1 0 ] row 2 [ 5 3 7 ] This matrix has 2 rows and 3 columns. The entry in row 2, column 3 is 7. We write it a(2,3) = 7.
Dimensions and shapes
The dimensions (or size) of a matrix are written “rows × columns”. A matrix with 2 rows and 3 columns is a 2 × 3 matrix, read “two by three”. When the number of rows equals the number of columns, we have a square matrix — and square matrices are the ones that can have a determinant and an inverse, which is where the real power lives later in this track.
Two matrices that hold the same numbers but in different shapes are not the same matrix — shape matters. A 1 × 3 matrix (one row) is called a row matrix; a 3 × 1 matrix (one column) is a column matrix. These thin matrices are exactly how we package a single point or a list of values.
- Count the horizontal rows — that is the first number.
- Count the vertical columns — that is the second number.
- Write size as rows × columns; if the two are equal, it is a square matrix.
Two special matrices
The zero matrix has every entry equal to 0; it behaves like the number 0 — adding it changes nothing. The identity matrix, written I, is square with 1's running down the main diagonal (top-left to bottom-right) and 0's everywhere else. It behaves like the number 1 for matrix multiplication: multiplying by I leaves a matrix unchanged.
Zero matrix (2x2): Identity matrix I (3x3):
[ 0 0 ] [ 1 0 0 ]
[ 0 0 ] [ 0 1 0 ]
[ 0 0 1 ]
The diagonal of I is all 1's; everything off it is 0.