Module 2 · 4 lessons · about 260 minutes
Matrices are machines
Matrices as linear transformations, matrix multiplication as composition, and the shapes and batches that every neural network layer is made of.
- Lessons
- 0/4
- Exercises
- 0/20
- Code
- 0/4
- Checkpoint
- Not taken
Already comfortable with this? Take the checkpoint cold. If you pass, move on and come back only for what you missed.

- 1Matrices as transformationsA matrix is a function you can write down. Its columns record where the basis vectors land, and that is enough to know where every vector goes. Read row by row, the same numbers are a layer of neurons.85 min
- 2Matrix multiplicationDoing one transformation after another is again a transformation, and its matrix is the product. The row-times-column rule falls out of that, along with three ways to read a product and a way to count its cost.75 min
- 3Shapes, transposes and batchesReading shapes is the skill that prevents most bugs. This lesson builds that habit, introduces the transpose, turns the column vectors of math into the row batches of code, and shows how numpy stretches one bias across a whole batch.55 min
- 4Layers and parameter countsA dense layer is a matrix product plus a bias, and a network is a stack of them with nonlinearities in between. This lesson shows why the nonlinearities are needed, then counts parameters and multiply-adds from a small network up to a 7B model.45 min
- Checkpoint12 questions. Pass with 80% to finish the module.
Practice sets for this module
Fresh problems every time. Use them until the mechanics feel automatic.
Compute for and .
One entry per box, top to bottom. 0.25, -2, 3/4 and sqrt(2) all work. Enter moves to the next empty box and checks once all are filled.
Compute for and .
One entry per box, row by row (Tab moves along a row). 0.25, -2, 3/4 and sqrt(2) all work. Enter moves to the next empty box and checks once all are filled.
In numpy, A has shape (10, 12) and b has shape (10,). What is the shape of A + b?