Lesson 4 of 13 9 min · 159 words
Matrix multiplication
Composing linear maps; inner dimensions must match.
The product of and is with : entry is the dot product of row of with column of . The inner dimensions must match ( and ).
Matrix multiplication is not commutative — in general, and may not even be defined. It is associative, , and .
A matrix is a linear map: transforms vector . Multiplying matrices composes maps — first apply , then . This is why a neural network without activation functions collapses to a single matrix: .
Predicting for a whole dataset at once is one matrix product: , with of shape and of shape . This vectorisation is why GPUs make ML fast.
Formula to remember
Lp norm
p = 1 Manhattan, p = 2 Euclidean, p → ∞ max-norm.
Quick check · +5 XP