Summary and Revision Notes
Use these notes to review Chapter 3 quickly.
Core Picture
A matrix is a rectangular table of numbers with row-column structure.
In computation, a matrix often acts as an operation:
input vector
-> matrix
-> output vector
The table shape controls whether the operation is allowed and what shape the output has.
Key Ideas
- Matrix entries are indexed by row and column.
- Shape is rows by columns.
- A matrix-vector product uses one dot product per row.
- Matrix multiplication repeats the matrix-vector idea across columns.
- Matrix multiplication is not coordinate-wise multiplication.
- Matrix multiplication is order-sensitive: and are different questions, and one may be undefined.
- The identity matrix leaves vectors unchanged.
- A diagonal matrix scales coordinates separately.
- The transpose swaps rows and columns.
- Batches can be stored as matrices of examples by features.
- A matrix can be read as a linear map.
- Neural layers use weight matrices to mix input features into output features.
Key Notation
| Notation | Read as | Meaning |
|---|---|---|
| matrix A | a table of numbers | |
| a i j | entry in row i, column j | |
| m by n | m rows and n columns | |
| A times x | matrix-vector product | |
| A times B | matrix product | |
| identity matrix | leaves vectors unchanged | |
| diagonal matrix | scales coordinates separately | |
| A transpose | swaps rows and columns | |
| W x plus b | linear layer pre-activation |
Shape Rules
| Expression | Requirement | Output |
|---|---|---|
| is , has length | length | |
| is , is | ||
| is batch by features, maps features to outputs | batch by outputs | |
| is |
Common Mistakes
- Reversing row and column order.
- Multiplying shapes without checking the middle dimensions.
- Treating matrix multiplication as coordinate-wise multiplication.
- Forgetting that each output entry comes from a row dot product.
- Confusing input features with output features in a layer.
- Losing the batch dimension when reading neural network shapes.
- Thinking of a matrix only as a table and not as an operation.
- Forgetting to name what each batch axis means before reading a shape.
- Forgetting that each row of a weight matrix produces one output feature.
Bridge To Geometry
The next chapter will give these operations a picture.
A matrix can stretch, rotate, shear, or project vectors. Geometry explains what those words mean visually.