Vectors and matrices

x⊤y\mathbf{x}^\top \mathbf{y} Transpose

Swap rows and columns. xᵀy is a dot product; xyᵀ is an outer product.

In ML papers

A⊤A^\top is AA flipped over its diagonal: row ii becomes column ii, so an m×nm \times n matrix becomes n×mn \times m. For column vectors, x⊤y\mathbf{x}^\top \mathbf{y} is a 1×11 \times 1 result, the dot product, while xy⊤\mathbf{x}\mathbf{y}^\top is a full matrix, the outer product. In attention, QK⊤QK^\top dots every query with every key.

How to type it

LaTeXShows
^\top⊤^\top
^\intercal⊺^\intercal
^T common but ambiguousT^T
^\mathsf{T}T^\mathsf{T}

A worked example

(1234) ⁣⊤=(1324),(1,2)(34)=11\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}^{\!\top} = \begin{pmatrix} 1 & 3 \\ 2 & 4 \end{pmatrix}, \quad (1, 2)\begin{pmatrix} 3 \\ 4 \end{pmatrix} = 11

Row vector times column vector: a single number.

Common confusions

Equations that use it

Related

W∈Rm×n\mathbf{W} \in \mathbb{R}^{m \times n}Bold uppercase (matrix)A−1A^{-1}Inversea⋅b\mathbf{a} \cdot \mathbf{b}Centre dotx2,  βt,  WQx^2,\; \beta^t,\; W^QSuperscript (power or label)

Decode this example →