4.210 min read
Defining Matrix-Matrix Multiplication
The matrix product is defined so that represents the composition of the linear maps represented by and . Specifically: for all .
This definition immediately gives us the size rule: if is and is , then is . The inner dimension is "consumed" — it represents the intermediate space where outputs and inputs.
The product is only defined when the number of columns of equals the number of rows of . This is not a convention — it's forced by the composition definition.
Formal View
Definition 4.2 — Matrix Product
For and , the matrix product is the unique matrix satisfying for all .
Why This Matters
Understanding that AB = "do B first, then A" is the key to using matrix multiplication correctly.
- In deep learning, where encodes features and classifies: compose the two operations
- 3D transformation matrices: applies scale first, then rotation
Quiz
Question 1
Can we compute if is and is ?
Common Mistakes
- Checking the wrong dimensions — columns of must match rows of , not rows of with rows of .