What is a matrix?
A matrix is a rectangular array of numbers called elements. A matrix with rows and columns is an matrix (rows first, then columns). Change the size below and read off the names.
| If… | it is called | example |
|---|---|---|
| (square) | a square matrix | |
| 1 column | a column matrix (vector) | |
| 1 row | a row matrix |
Where do matrices come from?
Anywhere you have a table of numbers. The simultaneous equations become .
Or a shopping list. Amy buys 2 cakes, 1 doughnut, 1 eclair; Bob buys 4, 0, 2. That is the matrix - one row per person, one column per item.
Zero matrix : every element 0, and .
Identity matrix : 1s down the diagonal, 0 elsewhere. It is the "1" of matrices - . , .
Add, subtract and scalar multiply
You can only add or subtract matrices of the the same size - just add matching elements. A scalar multiplies every element. Type your own numbers; the answer updates live.
Is matrix addition commutative? associative?
Yes to both, because it is just element-by-element ordinary addition. and . (Multiplication is a different story - see the next tab.)
Multiplying matrices
To multiply, the columns of A must match the rows of B: an times an gives an . Each entry is a row of A dotted with a column of B. Click a result cell to see exactly which row and column made it.
Does order matter? (is it commutative?)
Usually yes, order matters: in general . Sometimes is not even a valid size. Swap A and B above (make them both square) and compare - this is why for transformations the matrix you apply first is written on the right.
Determinant and inverse of a 2×2
For the determinant is . It is the area scale factor of the transformation. The inverse undoes the matrix: swap the diagonal, negate the other two, and divide by the determinant.
What if the determinant is zero?
If the matrix is singular and has no inverse - geometrically it squashes the whole plane onto a line (area scale factor 0), so the move cannot be undone.
The formula
Check it works: always (the box above shows it for your numbers).
Determinant and inverse of a 3×3
For a 3×3 we use minors and cofactors. Strike out a row and column to get a 2×2 minor; attach the sign from the + − + grid to get the cofactor. Expand along the top row for the determinant, then transpose the cofactor matrix and divide by it for the inverse.