Permutation matrix

From HandWiki
Short description: Matrix with exactly one 1 per row and column


In mathematics, particularly in matrix theory, a permutation matrix is a square binary matrix that has exactly one entry of 1 in each row and each column with all other entries 0.[1](p26) An n × n permutation matrix can represent a permutation of n elements. Pre-multiplying an n-row matrix M by a permutation matrix P, forming PM, results in permuting the rows of M, while post-multiplying an n-column matrix M, forming MP, permutes the columns of M.

Every permutation matrix P is orthogonal, with its inverse equal to its transpose: [math]\displaystyle{ P^{-1}=P^\mathsf{T} }[/math].[1](p26) Indeed, permutation matrices can be characterized as the orthogonal matrices whose entries are all non-negative.[2]

The two permutation/matrix correspondences

There are two natural one-to-one correspondences between permutations and permutation matrices, one of which works along the rows of the matrix, the other along its columns. Here is an example, starting with a permutation π in two-line form at the upper left:

[math]\displaystyle{ \begin{matrix} \pi\colon\begin{pmatrix}1&2&3&4\\3&2&4&1\end{pmatrix} & \longleftrightarrow & R_\pi\colon\begin{pmatrix} 0&0&1&0\\ 0&1&0&0\\ 0&0&0&1\\ 1&0&0&0\end{pmatrix}\\[5pt] \Big\updownarrow && \Big\updownarrow\\[5pt] C_\pi\colon\begin{pmatrix} 0&0&0&1\\ 0&1&0&0\\ 1&0&0&0\\ 0&0&1&0\end{pmatrix} & \longleftrightarrow & \pi^{-1}\colon\begin{pmatrix}1&2&3&4\\4&2&1&3\end{pmatrix}\end{matrix} }[/math]

The row-based correspondence takes the permutation π to the matrix [math]\displaystyle{ R_\pi }[/math] at the upper right. The first row of [math]\displaystyle{ R_\pi }[/math] has its 1 in the third column because [math]\displaystyle{ \pi(1)=3 }[/math]. More generally, we have [math]\displaystyle{ R_\pi=(r_{ij}) }[/math] where [math]\displaystyle{ r_{ij}=1 }[/math] when [math]\displaystyle{ j=\pi(i) }[/math] and [math]\displaystyle{ r_{ij}=0 }[/math] otherwise.

The column-based correspondence takes π to the matrix [math]\displaystyle{ C_\pi }[/math] at the lower left. The first column of [math]\displaystyle{ C_\pi }[/math] has its 1 in the third row because [math]\displaystyle{ \pi(1)=3 }[/math]. More generally, we have [math]\displaystyle{ C_\pi=(c_{ij}) }[/math] where [math]\displaystyle{ c_{ij} }[/math] is 1 when [math]\displaystyle{ i=\pi(j) }[/math] and 0 otherwise. Since the two recipes differ only by swapping i with j, the matrix [math]\displaystyle{ C_\pi }[/math] is the transpose of [math]\displaystyle{ R_\pi }[/math]; and, since [math]\displaystyle{ R_\pi }[/math] is a permutation matrix, we have [math]\displaystyle{ C_\pi=R_\pi^\mathsf{T}=R_\pi^{-1} }[/math]. Tracing the other two sides of the big square, we have [math]\displaystyle{ R_{\pi^{-1}}=C_\pi=R_\pi^{-1} }[/math] and [math]\displaystyle{ C_{\pi^{-1}}=R_\pi }[/math].[3]

Permutation matrices permute rows or columns

Multiplying a matrix M by either [math]\displaystyle{ R_\pi }[/math] or [math]\displaystyle{ C_\pi }[/math] on either the left or the right will permute either the rows or columns of M by either π or π−1. The details are a bit tricky.

To begin with, when we permute the entries of a vector [math]\displaystyle{ (v_1,\ldots,v_n) }[/math] by some permutation π, we move the [math]\displaystyle{ i^\text{th} }[/math] entry [math]\displaystyle{ v_i }[/math] of the input vector into the [math]\displaystyle{ \pi(i)^\text{th} }[/math] slot of the output vector. Which entry then ends up in, say, the first slot of the output? Answer: The entry [math]\displaystyle{ v_j }[/math] for which [math]\displaystyle{ \pi(j)=1 }[/math], and hence [math]\displaystyle{ j=\pi^{-1}(1) }[/math]. Arguing similarly about each of the slots, we find that the output vector is

[math]\displaystyle{ \big(v_{\pi^{-1}(1)},v_{\pi^{-1}(2)},\ldots,v_{\pi^{-1}(n)}\big), }[/math]

even though we are permuting by [math]\displaystyle{ \pi }[/math], not by [math]\displaystyle{ \pi^{-1} }[/math]. Thus, in order to permute the entries by [math]\displaystyle{ \pi }[/math], we must permute the indices by [math]\displaystyle{ \pi^{-1} }[/math].[1](p25) (Permuting the entries by [math]\displaystyle{ \pi }[/math] is sometimes called taking the alibi viewpoint, while permuting the indices by [math]\displaystyle{ \pi }[/math] would take the alias viewpoint.[4])

Now, suppose that we pre-multiply some n-row matrix [math]\displaystyle{ M=(m_{i,j}) }[/math] by the permutation matrix [math]\displaystyle{ C_\pi }[/math]. By the rule for matrix multiplication, the [math]\displaystyle{ (i,j)^\text{th} }[/math] entry in the product [math]\displaystyle{ C_\pi M }[/math] is

[math]\displaystyle{ \sum_{k=1}^n c_{i,k}m_{k,j}, }[/math]

where [math]\displaystyle{ c_{i,k} }[/math] is 0 except when [math]\displaystyle{ i=\pi(k) }[/math], when it is 1. Thus, the only term in the sum that survives is the term in which [math]\displaystyle{ k=\pi^{-1}(i) }[/math], and the sum reduces to [math]\displaystyle{ m_{\pi^{-1}(i),j} }[/math]. Since we have permuted the row index by [math]\displaystyle{ \pi^{-1} }[/math], we have permuted the rows of M themselves by π.[1](p25) A similar argument shows that post-multiplying an n-column matrix M by [math]\displaystyle{ R_\pi }[/math] permutes its columns by π.

The other two options are pre-multiplying by [math]\displaystyle{ R_\pi }[/math] or post-multiplying by [math]\displaystyle{ C_\pi }[/math], and they permute the rows or columns respectively by π−1, instead of by π.

The transpose is also the inverse

A related argument proves that, as we claimed above, the transpose of any permutation matrix P also acts as its inverse, which implies that P is invertible. (Artin leaves that proof as an exercise,[1](p26) which we here solve.) If [math]\displaystyle{ P=(p_{i,j}) }[/math], then the [math]\displaystyle{ (i,j)^\text{th} }[/math] entry of its transpose [math]\displaystyle{ P^\mathsf{T} }[/math] is [math]\displaystyle{ p_{j,i} }[/math]. The [math]\displaystyle{ (i,j)^\text{th} }[/math] entry of the product [math]\displaystyle{ PP^\mathsf{T} }[/math] is then

[math]\displaystyle{ \sum_{k=1}^n p_{i,k}p_{j,k}. }[/math]

Whenever [math]\displaystyle{ i\ne j }[/math], the [math]\displaystyle{ k^\text{th} }[/math] term in this sum is the product of two different entries in the [math]\displaystyle{ k^\text{th} }[/math] column of P; so all terms are 0, and the sum is 0. When [math]\displaystyle{ i=j }[/math], we are summing the squares of the entries in the [math]\displaystyle{ i^\text{th} }[/math] row of P, so the sum is 1. The product [math]\displaystyle{ PP^\mathsf{T} }[/math] is thus the identity matrix. A symmetric argument shows the same for [math]\displaystyle{ P^\mathsf{T}P }[/math], implying that P is invertible with [math]\displaystyle{ P^{-1}=P^\mathsf{T} }[/math].

Multiplying permutation matrices

Given two permutations of n elements 𝜎 and Template:Tau, the product of the corresponding column-based permutation matrices Cσ and Cτ is given,[1](p25) as you might expect, by [math]\displaystyle{ C_{\sigma} C_{\tau} = C_{\sigma\,\circ\,\tau}, }[/math] where the composed permutation [math]\displaystyle{ \sigma\circ\tau }[/math] applies first Template:Tau and then 𝜎, working from right to left: [math]\displaystyle{ (\sigma\circ\tau) (k) = \sigma \left(\tau (k) \right). }[/math] This follows because pre-multiplying some matrix by Cτ and then pre-multiplying the resulting product by Cσ gives the same result as pre-multiplying just once by the combined [math]\displaystyle{ C_{\sigma\,\circ\,\tau} }[/math].

For the row-based matrices, there is a twist: The product of Rσ and Rτ is given by

[math]\displaystyle{ R_{\sigma} R_{\tau} = R_{\tau\,\circ\,\sigma}, }[/math]

with 𝜎 applied before Template:Tau in the composed permutation. This happens because we must post-multiply to avoid inversions under the row-based option, so we would post-multiply first by Rσ and then by Rτ.

Some people, when applying a function to an argument, write the function after the argument (postfix notation), rather than before it. When doing linear algebra, they work with linear spaces of row vectors, and they apply a linear map to an argument by using the map's matrix to post-multiply the argument's row vector. They often use a left-to-right composition operator, which we here denote using a semicolon; so the composition [math]\displaystyle{ \sigma\,;\,\tau }[/math] is defined either by

[math]\displaystyle{ (\sigma\,;\,\tau)(k) = \tau\left(\sigma(k)\right), }[/math]

or, more elegantly, by

[math]\displaystyle{ (k)(\sigma\,;\,\tau) = \left((k)\sigma \right)\tau, }[/math]

with 𝜎 applied first. That notation gives us a simpler rule for multiplying row-based permutation matrices:

[math]\displaystyle{ R_{\sigma} R_{\tau} = R_{\sigma\,;\,\tau}. }[/math]

Matrix group

When π is the identity permutation, which has [math]\displaystyle{ \pi(i)=i }[/math] for all i, both Cπ and Rπ are the identity matrix.

There are n! permutation matrices, since there are n! permutations and the map [math]\displaystyle{ C\colon\pi\mapsto C_\pi }[/math] is a one-to-one correspondence between permutations and permutation matrices. (The map [math]\displaystyle{ R }[/math] is another such correspondence.) By the formulas above, those n × n permutation matrices form a group of order n! under matrix multiplication, with the identity matrix as its identity element, a group that we denote [math]\displaystyle{ \mathcal{P}_n }[/math]. The group [math]\displaystyle{ \mathcal{P}_n }[/math] is a subgroup of the general linear group [math]\displaystyle{ GL_n(\mathbb{R}) }[/math] of invertible n × n matrices of real numbers. Indeed, for any field F, the group [math]\displaystyle{ \mathcal{P}_n }[/math] is also a subgroup of the group [math]\displaystyle{ GL_n(F) }[/math], where the matrix entries belong to F. (Every field contains 0 and 1 with [math]\displaystyle{ 0+0=0, }[/math] [math]\displaystyle{ 0+1=1, }[/math] [math]\displaystyle{ 0*0=0, }[/math] [math]\displaystyle{ 0*1=0, }[/math] and [math]\displaystyle{ 1*1=1; }[/math] and that's all we need to multiply permutation matrices. Different fields disagree about whether [math]\displaystyle{ 1+1=0 }[/math], but that sum doesn't arise.)

Let [math]\displaystyle{ S_n^\leftarrow }[/math] denote the symmetric group, or group of permutations, on {1,2,...,n} where the group operation is the standard, right-to-left composition "[math]\displaystyle{ \circ }[/math]"; and let [math]\displaystyle{ S_n^\rightarrow }[/math] denote the opposite group, which uses the left-to-right composition "[math]\displaystyle{ \,;\, }[/math]". The map [math]\displaystyle{ C\colon S_n^\leftarrow\to GL_n(\mathbb{R}) }[/math] that takes π to its column-based matrix [math]\displaystyle{ C_\pi }[/math] is a faithful representation, and similarly for the map [math]\displaystyle{ R\colon S_n^\rightarrow\to GL_n(\mathbb{R}) }[/math] that takes π to [math]\displaystyle{ R_\pi }[/math].

Doubly stochastic matrices

Every permutation matrix is doubly stochastic. The set of all doubly stochastic matrices is called the Birkhoff polytope, and the permutation matrices play a special role in that polytope. The Birkhoff–von Neumann theorem says that every doubly stochastic real matrix is a convex combination of permutation matrices of the same order, with the permutation matrices being precisely the extreme points (the vertices) of the Birkhoff polytope. The Birkhoff polytope is thus the convex hull of the permutation matrices.[5]

Linear-algebraic properties

Just as each permutation is associated with two permutation matrices, each permutation matrix is associated with two permutations, as we can see by relabeling the example in the big square above starting with the matrix P at the upper right:

[math]\displaystyle{ \begin{matrix} \rho_P\colon\begin{pmatrix}1&2&3&4\\3&2&4&1\end{pmatrix} & \longleftrightarrow & P\colon\begin{pmatrix} 0&0&1&0\\ 0&1&0&0\\ 0&0&0&1\\ 1&0&0&0\end{pmatrix}\\[5pt] \Big\updownarrow && \Big\updownarrow\\[5pt] P^{-1}\colon\begin{pmatrix} 0&0&0&1\\ 0&1&0&0\\ 1&0&0&0\\ 0&0&1&0\end{pmatrix} & \longleftrightarrow & \kappa_P\colon\begin{pmatrix}1&2&3&4\\4&2&1&3\end{pmatrix}\end{matrix} }[/math]

So we are here denoting the inverse of C as [math]\displaystyle{ \kappa }[/math] and the inverse of R as [math]\displaystyle{ \rho }[/math]. We can then compute the linear-algebraic properties of P from some combinatorial properties that are shared by the two permutations [math]\displaystyle{ \kappa_P }[/math] and [math]\displaystyle{ \rho_P=\kappa_P^{-1} }[/math].

A point is fixed by [math]\displaystyle{ \kappa_P }[/math] just when it is fixed by [math]\displaystyle{ \rho_P }[/math], and the trace of P is the number of such shared fixed points.[1](p322) If the integer k is one of them, then the standard basis vector ek is an eigenvector of P.[1](p118)

To calculate the complex eigenvalues of P, write the permutation [math]\displaystyle{ \kappa_P }[/math] as a composition of disjoint cycles, say [math]\displaystyle{ \kappa_P= c_{1}c_{2} \cdots c_{t} }[/math]. (Permutations of disjoint subsets commute, so it doesn't matter here whether we are composing right-to-left or left-to-right.) For [math]\displaystyle{ 1 \le i \le t }[/math], let the length of the cycle [math]\displaystyle{ c_i }[/math] be [math]\displaystyle{ \ell_i }[/math], and let [math]\displaystyle{ L_{i} }[/math] be the set of complex solutions of [math]\displaystyle{ x^{\ell_{i}}=1 }[/math], those solutions being the [math]\displaystyle{ \ell_i^{\,\text{th}} }[/math] roots of unity. The multiset union of the [math]\displaystyle{ L_{i} }[/math] is then the multiset of eigenvalues of P. Since writing [math]\displaystyle{ \rho_P }[/math] as a product of cycles would give the same number of cycles of the same lengths, analyzing [math]\displaystyle{ \rho_p }[/math] would give the same result. The multiplicity of any eigenvalue v is the number of i for which [math]\displaystyle{ L_i }[/math] contains v.[6] (Since any permutation matrix is normal and any normal matrix is diagonalizable over the complex numbers,[1](p259) the algebraic and geometric multiplicities of an eigenvalue v are the same.)

From group theory we know that any permutation may be written as a composition of transpositions. Therefore, any permutation matrix factors as a product of row-switching elementary matrices, each of which has determinant −1. Thus, the determinant of the permutation matrix P is the sign of the permutation [math]\displaystyle{ \kappa_P }[/math], which is also the sign of [math]\displaystyle{ \rho_P }[/math].

Restricted forms

  • Costas array, a permutation matrix in which the displacement vectors between the entries are all distinct
  • n-queens puzzle, a permutation matrix in which there is at most one entry in each diagonal and antidiagonal

See also

References

  1. 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 Artin, Michael (1991). Algebra. Prentice Hall. pp. 24–26,118,259,322. 
  2. Zavlanos, Michael M.; Pappas, George J. (November 2008). "A dynamical systems approach to weighted graph matching". Automatica 44 (11): 2817–2824. doi:10.1016/j.automatica.2008.04.009. https://www.sciencedirect.com/science/article/abs/pii/S0005109808002616. Retrieved 21 August 2022. "Let [math]\displaystyle{ O_n }[/math] denote the set of [math]\displaystyle{ n \times n }[/math] orthogonal matrices and [math]\displaystyle{ N_n }[/math] denote the set of [math]\displaystyle{ n \times n }[/math] element-wise non-negative matrices. Then, [math]\displaystyle{ P_n = O_n \cap N_n }[/math], where [math]\displaystyle{ P_n }[/math] is the set of [math]\displaystyle{ n \times n }[/math] permutation matrices.". 
  3. This terminology is not standard. Most authors use just one of the two correspondences, choosing which to be consistent with their other conventions. For example, Artin uses the column-based correspondence. We have here invented two names in order to discuss both options.
  4. Conway, John H.; Burgiel, Heidi; Goodman-Strauss, Chaim (2008). The Symmetries of Things. A K Peters. p. 179. "A permutation---say, of the names of a number of people---can be thought of as moving either the names or the people. The alias viewpoint regards the permutation as assigning a new name or alias to each person (from the Latin alias = otherwise). Alternatively, from the alibi viewoint we move the people to the places corresponding to their new names (from the Latin alibi = in another place.)" 
  5. Brualdi (2006) p.19
  6. J Najnudel, A Nikeghbali 2010 p.4