Permutation matrix

Matrices describing the permutations of 3 elements
The product of two permutation matrices is a permutation matrix as well.

These are the positions of the six matrices:

(They are also permutation matrices.)

In mathematics, in matrix theory, a permutation matrix is a square binary matrix that has exactly one entry 1 in each row and each column and 0s elsewhere. Each such matrix represents a specific permutation of m elements and, when used to multiply another matrix, can produce that permutation in the rows or columns of the other matrix.

Definition

Given a permutation π of m elements,

\pi : \lbrace 1, \ldots, m \rbrace \to \lbrace 1, \ldots, m \rbrace

given in two-line form by

\begin{pmatrix} 1 & 2 & \cdots & m \\ \pi(1) & \pi(2) & \cdots & \pi(m) \end{pmatrix},

its permutation matrix is the m × m matrix Pπ whose entries are all 0 except that in row i, the entry π(i) equals 1. We may write

P_\pi = \begin{bmatrix} \mathbf e_{\pi(1)} \\ \mathbf e_{\pi(2)} \\ \vdots \\ \mathbf e_{\pi(m)} \end{bmatrix},

where \mathbf e_j denotes a row vector of length m with 1 in the jth position and 0 in every other position.[1]

Properties

Given two permutations π and σ of m elements and the corresponding permutation matrices Pπ and Pσ

P_{\sigma} P_{\pi}  = P_{\pi\,\circ\,\sigma}

This somewhat unfortunate rule is a consequence of the definitions of multiplication of permutations (composition of bijections) and of matrices, and of the choice of using the vectors \mathbf{e}_{\pi(i)} as rows of the permutation matrix; if one had used columns instead then the product above would have been equal to P_{\sigma\,\circ\,\pi} with the permutations in their original order.

As permutation matrices are orthogonal matrices (i.e., P_{\pi}P_{\pi}^{T} = I), the inverse matrix exists and can be written as

P_{\pi}^{-1} = P_{\pi^{-1}} = P_{\pi}^{T}.

Multiplying P_{\pi} times a column vector g will permute the rows of the vector:

P_\pi \mathbf{g} 
= 
\begin{bmatrix}
\mathbf{e}_{\pi(1)} \\
\mathbf{e}_{\pi(2)} \\
\vdots \\
\mathbf{e}_{\pi(n)}
\end{bmatrix}

\begin{bmatrix}
g_1 \\
g_2 \\
\vdots \\
g_n
\end{bmatrix}
=
\begin{bmatrix}
g_{\pi(1)} \\
g_{\pi(2)} \\
\vdots \\
g_{\pi(n)}
\end{bmatrix}.

Now applying P_\sigma after applying P_\pi gives the same result as applying P_{\pi\circ\sigma} directly, in accordance with the above multiplication rule: call P_\pi\mathbf{g} = \mathbf{g}', in other words

g'_i=g_{\pi(i)}\,

for all i, then

P_\sigma(P_\pi(\mathbf{g})) = P_\sigma(\mathbf{g}')
=
\begin{bmatrix}
g'_{\sigma(1)} \\
g'_{\sigma(2)} \\
\vdots \\
g'_{\sigma(n)}
\end{bmatrix}
=
\begin{bmatrix}
g_{\pi(\sigma(1))} \\
g_{\pi(\sigma(2))} \\
\vdots \\
g_{\pi(\sigma(n))}
\end{bmatrix}.

Multiplying a row vector h times P_{\pi} will permute the columns of the vector by the inverse of P_{\pi}:

\mathbf{h}P_\pi
= 
\begin{bmatrix} h_1 \; h_2 \; \dots \; h_n \end{bmatrix}

\begin{bmatrix}
\mathbf{e}_{\pi(1)} \\
\mathbf{e}_{\pi(2)} \\
\vdots \\
\mathbf{e}_{\pi(n)}
\end{bmatrix}
=
\begin{bmatrix} h_{\pi^{-1}(1)} \; h_{\pi^{-1}(2)} \; \dots \; h_{\pi^{-1}(n)} \end{bmatrix}

Again it can be checked that (\mathbf{h}P_\sigma)P_\pi = \mathbf{h}P_{\pi\circ\sigma}.

Notes

Let Sn denote the symmetric group, or group of permutations, on {1,2,...,n}. Since there are n! permutations, there are n! permutation matrices. By the formulas above, the n × n permutation matrices form a group under matrix multiplication with the identity matrix as the identity element.

If (1) denotes the identity permutation, then P(1) is the identity matrix.

One can view the permutation matrix of a permutation σ as the permutation σ of the columns of the identity matrix I, or as the permutation σ1 of the rows of I.

A permutation matrix is a doubly stochastic matrix. The Birkhoff–von Neumann theorem says that every doubly stochastic real matrix is a convex combination of permutation matrices of the same order and the permutation matrices are precisely the extreme points of the set of doubly stochastic matrices. That is, the Birkhoff polytope, the set of doubly stochastic matrices, is the convex hull of the set of permutation matrices.[2]

The product PM, premultiplying a matrix M by a permutation matrix P, permutes the rows of M; row i moves to row π(i). Likewise, MP permutes the columns of M.

The map Sn A GL(n, Z2) is a faithful representation. Thus, |A| = n!.

The trace of a permutation matrix is the number of fixed points of the permutation. If the permutation has fixed points, so it can be written in cycle form as π = (a1)(a2)...(ak)σ where σ has no fixed points, then ea1,ea2,...,eak are eigenvectors of the permutation matrix.

From group theory we know that any permutation may be written as a product of transpositions. Therefore, any permutation matrix P factors as a product of row-interchanging elementary matrices, each having determinant 1. Thus the determinant of a permutation matrix P is just the signature of the corresponding permutation.

Examples

Permutation of rows and columns

When a permutation matrix P is multiplied with a matrix M from the left PM it will permute the rows of M (here the elements of a column vector),
when P is multiplied with M from the right MP it will permute the columns of M (here the elements of a row vector):

P * (1,2,3,4)T = (4,1,3,2)T
(1,2,3,4) * P = (2,4,3,1)

Permutations of rows and columns are for example reflections (see below) and cyclic permutations (see cyclic permutation matrix).

Permutation of rows

The permutation matrix Pπ corresponding to the permutation :\pi=\begin{pmatrix} 1 & 2 & 3 & 4 & 5 \\ 1 & 4 & 2 & 5 & 3 \end{pmatrix}, is

P_\pi 
= 
\begin{bmatrix}
\mathbf{e}_{\pi(1)} \\
\mathbf{e}_{\pi(2)} \\
\mathbf{e}_{\pi(3)} \\
\mathbf{e}_{\pi(4)} \\
\mathbf{e}_{\pi(5)} 
\end{bmatrix}
=
\begin{bmatrix}
\mathbf{e}_{1} \\
\mathbf{e}_{4} \\
\mathbf{e}_{2} \\
\mathbf{e}_{5} \\
\mathbf{e}_{3} 
\end{bmatrix}
=
\begin{bmatrix} 
1 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 1 & 0 \\
0 & 1 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 1 \\
0 & 0 & 1 & 0 & 0 
\end{bmatrix}.

Given a vector g,

P_\pi \mathbf{g}
=
\begin{bmatrix}
\mathbf{e}_{\pi(1)} \\
\mathbf{e}_{\pi(2)} \\
\mathbf{e}_{\pi(3)} \\
\mathbf{e}_{\pi(4)} \\
\mathbf{e}_{\pi(5)} 
\end{bmatrix}

\begin{bmatrix}
g_1 \\
g_2 \\
g_3 \\
g_4 \\
g_5
\end{bmatrix}
=
\begin{bmatrix}
g_1 \\
g_4 \\
g_2 \\
g_5 \\
g_3
\end{bmatrix}.

Explanation

A permutation matrix will always be in the form

\begin{bmatrix}
\mathbf{e}_{a_1} \\
\mathbf{e}_{a_2} \\
\vdots \\
\mathbf{e}_{a_j} \\
\end{bmatrix}

where eai represents the ith basis vector (as a row) for Rj, and where

\begin{bmatrix} 
1   & 2   & \ldots & j \\
a_1 & a_2 & \ldots & a_j\end{bmatrix}

is the permutation form of the permutation matrix.

Now, in performing matrix multiplication, one essentially forms the dot product of each row of the first matrix with each column of the second. In this instance, we will be forming the dot product of each row of this matrix with the vector of elements we want to permute. That is, for example, v= (g0,...,g5)T,

eai·v=gai

So, the product of the permutation matrix with the vector v above, will be a vector in the form (ga1, ga2, ..., gaj), and that this then is a permutation of v since we have said that the permutation form is

\begin{pmatrix} 
1   & 2   & \ldots & j \\
a_1 & a_2 & \ldots & a_j\end{pmatrix}.

So, permutation matrices do indeed permute the order of elements in vectors multiplied with them.

See also

References

  1. Brualdi (2006) p.2
  2. Brualdi (2006) p.19