A matrix written out
Square brackets around a grid of numbers show a matrix entry by entry. Each line is a row; each position across a line is a column.
Read a matrix by its shape first: count the rows, then the columns, and say "rows by columns". A matrix with 4 rows and 2 columns is "4 by 2", written . As a weight matrix acting on a row vector, a matrix turns a 4-number input into a 2-number output. Often the shape is all you need to follow the argument.
(In the LaTeX source, & separates columns and \\ starts a new row.)
Example
Three rows, two columns: a 3×2 matrix.
Where the course uses it
- 1.1 Scalars, Vectors, Matrices, and Tensors · Module 1, Shapes and Linear Algebrafirst use
- 1.2 Matrix Multiplication, Done by Hand · Module 1, Shapes and Linear Algebra
- 1.3 The Matrix Toolkit · Module 1, Shapes and Linear Algebra
- 1.6 Linear Projections: One Vector Into Three · Module 1, Shapes and Linear Algebra
- 2.3 The Chain Rule and the Jacobian · Module 2, Calculus and Optimization
- 6.4 Masks · Module 6, Attention
- 7.1 Positional Encodings · Module 7, The Block and the Full Model
- 15.1 Rotary Position Embedding (RoPE) · Module 15, The LLaMA Block
Related terms
- Matrix multiplicationTwo matrices written side by side, like AB, are multiplied. Each entry of the result is a row of A dotted with a column of B. An (m×n) times an (n×p) gives an (m×p).
- TransposeRead "A transpose". The raised T flips a matrix so its rows become its columns. On a vector it turns a column into a row.
- ℝ^d — all vectors of length dRead "R d" or "R to the d". It is the set of all lists of d real numbers, so "x ∈ ℝ^d" says x is a vector of d numbers.