Vectors and matrices

WโˆˆRmร—n\mathbf{W} \in \mathbb{R}^{m \times n} Bold uppercase (matrix)

A bold capital letter is a matrix (or a higher-order tensor).

In ML papers

Bold uppercase = matrix. W\mathbf{W} is a weight matrix, X\mathbf{X} a data matrix with one example per row, Q,K,V\mathbf{Q}, \mathbf{K}, \mathbf{V} the attention matrices. Wx\mathbf{W}\mathbf{x} is a matrix-vector product: an mร—nm \times n matrix times an nn-vector gives an mm-vector. WijW_{ij} (plain) is the entry in row ii, column jj.

How to type it

LaTeXShows
\mathbf{W}W\mathbf{W}
\begin{pmatrix} a & b \\ c & d \end{pmatrix} written out(abcd)\begin{pmatrix} a & b \\ c & d \end{pmatrix}

A worked example

(102011)(123)=(75)\begin{pmatrix} 1 & 0 & 2 \\ 0 & 1 & 1 \end{pmatrix} \begin{pmatrix} 1 \\ 2 \\ 3 \end{pmatrix} = \begin{pmatrix} 7 \\ 5 \end{pmatrix}

A 2ร—32 \times 3 matrix maps a 3-vector to a 2-vector: each output is a row dotted with the input.

Common confusions

Equations that use it

Related

xโˆˆRd\mathbf{x} \in \mathbb{R}^{d}Bold lowercase (vector)xโŠคy\mathbf{x}^\top \mathbf{y}TransposeRnร—d\mathbb{R}^{n \times d}Times (cross)In\mathbf{I}_nIdentity matrix

Decode this example โ†’