Skip to content
Science, DecodedContext Jamming

Rosetta Stone · 26 of 30

xTx^{T}

Transpose

Operator: it does something

In plain English

Flip a matrix across its diagonal: rows become columns. A column vector xx becomes a row vector xTx^T. The point is bookkeeping: xTyx^T y multiplies a row by a column and produces a single number (the dot product), while xyTx y^T produces a whole matrix. In QKTQK^T (attention), transposing KK lines up every query with every key. The TT is an operation, not an exponent.

As code

const A = [[1, 2, 3],
           [4, 5, 6]];               // 2×3
const AT = A[0].map((_, j) => A.map((row) => row[j]));
// [[1,4],[2,5],[3,6]]              // 3×2

See it

[123456]\begin{bmatrix}1 & 2 & 3 \\ 4 & 5 & 6\end{bmatrix}
xTx^{T} flips rows and columns. A 2×3 matrix becomes 3×2. This is why QKTQK^{T} works: it lines up every query with every key.

What it means, field by field

Mathematics

Matrix transpose; symmetric matrices satisfy A = Aᵀ.

AI / ML

QKᵀ in attention; Wᵀ in tied embeddings and in backpropagation’s backward pass.

Physics

Rotation matrices satisfy Rᵀ = R⁻¹; the conjugate transpose † in quantum mechanics.

In a research paper

Scaled dot-product attention (Vaswani et al. 2017).
softmax ⁣(QKTdk)V\mathrm{softmax}\!\left(\frac{QK^{T}}{\sqrt{d_k}}\right)V

Kᵀ makes every query-key pair meet in one matrix multiplication, producing an n×n grid of similarity scores.

Common misreadings

  • Reading xᵀ as "x to the power T".

  • Ignoring shapes. Most transpose confusion disappears if you write each matrix’s dimensions next to it.

Connected symbols

Where it appears on this site