Permutation Matrix

ianmcloughlin.github.io linkedin github

Matrix

\(\begin{bmatrix} 0 & 0 & 1 & 0 \\ 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ \end{bmatrix}\)

Exactly one 1 in every row

Exactly one 1 in every column.

Everywhere else is 0.

Swapping Rows

\(\begin{bmatrix} 0 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1 \\ \end{bmatrix}\) \(\begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \\ \end{bmatrix}=\) \(\begin{bmatrix} d & e & f \\ a & b & c \\ g & h & i \\ \end{bmatrix}\)

Swapping Columns

\(\begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \\ \end{bmatrix}\) \(\begin{bmatrix} 0 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1 \\ \end{bmatrix}^\intercal=\) \(\begin{bmatrix} b & a & c \\ e & d & f \\ h & g & i \\ \end{bmatrix}\)

Swapping Both

\(\begin{bmatrix} 0 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1 \\ \end{bmatrix}\) \(\begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \\ \end{bmatrix}\) \(\begin{bmatrix} 0 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1 \\ \end{bmatrix}^\intercal\) \(=\begin{bmatrix} e & d & f \\ b & a & c \\ h & g & i \\ \end{bmatrix}\)

Full Example

\(\begin{bmatrix} 0 & 0 & 1 & 0 \\ 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ \end{bmatrix}\) \(\begin{bmatrix} 0 & 1 & 1 & 1 \\ 1 & 0 & 0 & 0 \\ 1 & 0 & 0 & 1 \\ 1 & 0 & 1 & 0 \\ \end{bmatrix}\) \(\begin{bmatrix} 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ \end{bmatrix}\) \(= \begin{bmatrix} 0 & 1 & 0 & 1 \\ 1 & 0 & 1 & 1 \\ 0 & 1 & 0 & 0 \\ 1 & 1 & 0 & 0 \\ \end{bmatrix}\)