R⊤R=IR^\top R = I

Orthogonal matrix

A matrix that only rotates (or mirrors) vectors: it keeps every length and every angle, and its transpose undoes it. R^⊤R = I says exactly that.

Because R⊤=R−1R^\top = R^{-1} (the transpose is the inverse), the RoPE identity Rm⊤Rn=Rn−mR_m^\top R_n = R_{n-m} follows in one line: undo a rotation by mm, then apply a rotation by nn, and the net rotation is by n−mn - m. And because rotations keep lengths, RoPE cannot make a query or key longer or shorter. It only turns it, so position is encoded without changing the vector's size.

Example

R=[0−110]:  R[3,4]⊤=[−4,3]⊤R = \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}: \; R[3, 4]^\top = [-4, 3]^\top

A 90° rotation. Both vectors have length 5.

Where the course uses it

Related terms