Matrices, from zero to ohhh.
Nine bite-sized lessons. Eight live demos you can poke. Quizzes that don't try to trick you. By the end, "matrix" stops being a scary grid of numbers and starts being a tool you reach for.
What is a matrix?
A matrix is just a rectangular grid of numbers, arranged in rows and columns. That's it. The magic isn't in the object — it's in what it does: it transforms, encodes, and solves.
Think of a matrix as a machine. You feed it a vector (a column of numbers), and out comes another vector — usually a transformed version of the first one.
A 2×3 matrix has 2 rows and 3 columns:
4 5 6 (2 × 3)
The plural of "matrix" is matrices (pronounced MAY-trih-seez). The singular adjective is matrix.
Demo 1 · Play with a matrix
LiveClick any cell to edit. Add or remove rows and columns on the fly.
Which of these is a matrix?
Notation & dimensions
We describe a matrix by its dimensions: m × n means m rows and n columns. An entry is named aij where i is the row and j is the column.
Special cases worth knowing:
- Row vector: 1 × n — a single row of numbers.
- Column vector: n × 1 — a single column of numbers.
- Square matrix: n × n — same number of rows and columns. These are the stars of the show.
- Identity matrix In: square with 1s on the diagonal and 0s elsewhere.
- Zero matrix: every entry is 0.
m × n = "m by n" hint.)Demo 2 · Build a shape, see the dimension
LivePick the shape and the size — we'll fill it with the right pattern.
What's the dimension of this matrix?
Addition & scalar multiplication
The two simplest operations, and the rules are dead simple:
Matrix addition. Add two matrices of the same shape, entry by entry:
3 4 + 5 6
7 8 = 6 8
10 12
Scalar multiplication. Multiply every entry by the same number (the "scalar"):
3 4 = 3 6
9 12
Demo 3 · Add two matrices live
LiveEdit any cell in A or B. The result C = A + B updates instantly. The highlighted cells show what was just added.
Can you add these two matrices?
Matrix multiplication (the fun one)
Multiplication is where matrices earn their keep. The rule:
To compute the entry (AB)ij, take the dot product of row i of A with column j of B:
The shape rule. If A is m × n and B is n × p, then AB is m × p. The inner dimensions must match.
Demo 4 · Watch the dot products happen
AnimatedClick a cell in C to see which row and column of A and B are being multiplied.
What's the shape of A · B?
Transpose
The transpose of A, written AT, flips the matrix along its diagonal — rows become columns.
4 5 6 T = 1 4
2 5
3 6
A matrix that equals its own transpose is called symmetric. These pop up everywhere in physics and statistics.
Handy identities:
- (AT)T = A
- (A + B)T = AT + BT
- (AB)T = BTAT (note the flip!)
Demo 5 · Transpose live
LiveEdit the matrix on the left; its transpose appears on the right.
True or false: (AB)T = ATBT
Determinant
The determinant, written det(A) or |A|, is a single number that captures a square matrix's character.
For a 2×2 matrix, the formula is delightfully simple:
c d) = ad − bc
For a 3×3 matrix, you use the rule of Sarrus or cofactor expansion. The idea: you recursively expand along a row.
Demo 6 · Determinant calculator
2×2 · 3×3Pick a size, edit the values, watch the determinant compute step-by-step.
Compute this determinant.
The inverse matrix
The inverse of A, written A−1, is the matrix that "undoes" A. It's the matrix equivalent of a reciprocal.
For a 2×2 matrix:
−c a (swap a↔d, negate b↔c)
Demo 7 · Inverse live
LiveEdit A. We compute A−1 and verify by showing A · A−1 = I.
When does A have an inverse?
Solving A·x = b
The classic use case: you have a system of linear equations, and you want to solve it fast.
For example, suppose:
- 2x + 3y = 8
- x − y = 1
That becomes:
1 −1 · x
y = 8
1
The solution (x = 11/5, y = 6/5) is the unique point where two lines intersect — and that's a geometric view you'll see a lot of in Linear Algebra.
Demo 8 · Solve A·x = b live
LiveEdit A and b. We solve for x in real time. Try setting up a tricky one.
Eigenvalues, briefly
This is the punchline of a lot of linear algebra. Some vectors are special: when a matrix transforms them, they don't change direction — only magnitude.
v is an eigenvector, λ (lambda) is its eigenvalue. The matrix acts like a simple scalar on these special vectors.
To find them, you solve:
That's the characteristic polynomial. For a 2×2, it's a quadratic — two eigenvalues. For 3×3, a cubic. And so on.
That's the end of the matrix tutorial! If you want to keep going, the next stop is Linear Algebra — which takes all of this and runs with the geometry.
Demo 9 · Eigenvectors visualized
VisualDrag a vector on the canvas. See it transform by A — and watch which vectors stay on their own line.