Phase 2 · Math, when you need it · Linear algebra
Matrix multiplication
Many dot products at once: what a neural network layer computes.
Open this lesson Create a free account
Why it matters
Matrix multiplication is where nearly all of an AI model's computing time goes. Scoring 10,000 customers with one formula is one matrix multiplication. A neural network layer is one. Attention inside ChatGPT or Claude is a few of them. The chips that run AI (GPUs) exist mainly to do this one job fast. The good news: it's built from the dot product you already know. The one thing to watch is the shapes, because most bugs in AI code are shapes that don't fit together.
What you'll be able to do
- Multiply a matrix by a vector as a batch of dot products
- Multiply two matrices, and predict the result's shape from the inputs' shapes
- Recognize X @ W + b as a neural network layer
- Implement matrix multiplication with loops and check it against NumPy
Before this lesson
Next in this phase: Matrices as transformations