Home / Topics / Matrices
Course · Linear algebra foundations

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.

9 lessons ~45 min 8 live demos 6 quizzes Beginner → intermediate
01

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.

i
The core intuition: a matrix is a transformation in disguise. The numbers tell the transformation how to stretch, rotate, shear, or squash space.

A 2×3 matrix has 2 rows and 3 columns:

A = 1   2   3
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

Live

Click any cell to edit. Add or remove rows and columns on the fly.

A is a 2 × 3 matrix with 6 entries.
Quick check

Which of these is a matrix?

A matrix is any rectangular arrangement of numbers into rows and columns.
A A single number, like 7
B A list of numbers, like [1, 2, 3, 4]
C A grid of numbers with rows and columns
D A function like f(x) = x²
02

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.

a23 = the entry in row 2, column 3

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.
!
Memory aid: "rows × columns" — like reading a room: rows across, columns tall. (Or just remember the m × n = "m by n" hint.)

Demo 2 · Build a shape, see the dimension

Live

Pick the shape and the size — we'll fill it with the right pattern.

A 3 × 3 matrix of ones. 9 entries total.
Quick check

What's the dimension of this matrix?

A matrix with 4 rows and 7 columns is described as…
A 7 × 4
B 4 × 7
C 11 × 11
D 4 + 7
03

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:

1 2
3 4
+ 5 6
7 8
= 6   8
10 12

Scalar multiplication. Multiply every entry by the same number (the "scalar"):

3 · 1 2
3 4
= 3   6
9   12
!
You can only add matrices with the same shape. A 2×3 plus a 2×4? Nope — undefined.

Demo 3 · Add two matrices live

Live

Edit any cell in A or B. The result C = A + B updates instantly. The highlighted cells show what was just added.

A
+
B
=
A + B
Cij = Aij + Bij — try editing!
Quick check

Can you add these two matrices?

A is 2×3, B is 2×4. What's the deal?
A Yes, the result is 2×3
B Yes, the result is 2×4
C No — they need the same shape
D Only on Tuesdays
04

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:

(AB)ij = ai1b1j + ai2b2j + … + ainbnj

The shape rule. If A is m × n and B is n × p, then AB is m × p. The inner dimensions must match.

i
Order matters! In general, AB ≠ BA. Matrix multiplication is not commutative.

Demo 4 · Watch the dot products happen

Animated

Click a cell in C to see which row and column of A and B are being multiplied.

A (2×3)
×
B (3×2)
=
A · B (2×2)
Click any cell in C to see how it's computed.
Quick check

What's the shape of A · B?

A is 3 × 4, B is 4 × 5. What shape is A · B?
A 3 × 5
B 4 × 4
C 5 × 3
D Undefined
05

Transpose

The transpose of A, written AT, flips the matrix along its diagonal — rows become columns.

1 2 3
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

Live

Edit the matrix on the left; its transpose appears on the right.

A
AT
A is 2 × 4. Its transpose AT is 4 × 2.
Quick check

True or false: (AB)T = ATBT

Watch out for the order…
A True — it's symmetric.
B False — it's actually BTAT.
C True only for square matrices.
D Undefined.
06

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:

det(a b
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.

i
Geometric meaning: |det(A)| is the factor by which A scales area (in 2D) or volume (in 3D). If det = 0, A collapses space — it has no inverse.

Demo 6 · Determinant calculator

2×2 · 3×3

Pick a size, edit the values, watch the determinant compute step-by-step.

A
det(A)
Edit any cell — the determinant updates with the step-by-step breakdown.
Quick check

Compute this determinant.

det of [[2, 3], [1, 4]] is…
A 24
B 5
C −1
D 8 − 3 = 5? No wait, 2×4 − 3×1 = 5. So actually 5… (re-checking)
07

The inverse matrix

The inverse of A, written A−1, is the matrix that "undoes" A. It's the matrix equivalent of a reciprocal.

A · A−1 = A−1 · A = I

For a 2×2 matrix:

A−1 = (1 / det(A)) · d   −b
−c   a
  (swap a↔d, negate b↔c)
!
A matrix has an inverse if and only if det(A) ≠ 0. Matrices with det = 0 are called singular. They collapse at least one dimension and can't be undone.

Demo 7 · Inverse live

Live

Edit A. We compute A−1 and verify by showing A · A−1 = I.

A
·
A−1
=
A · A−1
A · A−1 should equal the identity matrix I.
Quick check

When does A have an inverse?

Pick the right condition.
A When det(A) ≠ 0
B When A has more rows than columns
C Always, every matrix has an inverse
D When A is symmetric
08

Solving A·x = b

The classic use case: you have a system of linear equations, and you want to solve it fast.

A · x = b   ⟹   x = A−1 · b

For example, suppose:

  • 2x + 3y = 8
  • x − y = 1

That becomes:

2 3
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

Live

Edit A and b. We solve for x in real time. Try setting up a tricky one.

A
·
x
=
b
x = A−1 · b — the solution vector.
09

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.

A · v = λ · v

v is an eigenvector, λ (lambda) is its eigenvalue. The matrix acts like a simple scalar on these special vectors.

To find them, you solve:

det(A − λI) = 0

That's the characteristic polynomial. For a 2×2, it's a quadratic — two eigenvalues. For 3×3, a cubic. And so on.

i
Where eigenvalues show up: vibration modes of bridges, principal components in data science, Google's original PageRank, quantum mechanics, facial recognition — basically anywhere a "preferred direction" matters.

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

Visual

Drag a vector on the canvas. See it transform by A — and watch which vectors stay on their own line.

Eigenvalues: — —  ·  eigenvectors: —
Final boss

The eigenvector equation

A · v = λ · v means…
A v is the zero vector
B A and v are perpendicular
C A only scales v, doesn't rotate it
D A is the identity matrix

Glossary