Permutation matrix explained

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] An permutation matrix can represent a permutation of elements. Pre-multiplying an -row matrix by a permutation matrix, forming, results in permuting the rows of, while post-multiplying an -column matrix, forming, permutes the columns of .

Every permutation matrix P is orthogonal, with its inverse equal to its transpose:

P-1=PT

. 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:

\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] \updownarrow&&\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}

The row-based correspondence takes the permutation to the matrix

R\pi

at the upper right. The first row of

R\pi

has its 1 in the third column because

\pi(1)=3

. More generally, we have

R\pi=(rij)

where

rij=1

when

j=\pi(i)

and

rij=0

otherwise.

The column-based correspondence takes to the matrix

C\pi

at the lower left. The first column of

C\pi

has its 1 in the third row because

\pi(1)=3

. More generally, we have

C\pi=(cij)

where

cij

is 1 when

i=\pi(j)

and 0 otherwise. Since the two recipes differ only by swapping i with j, the matrix

C\pi

is the transpose of

R\pi

; and, since

R\pi

is a permutation matrix, we have

C\pi=R

-1
\pi
. Tracing the other two sides of the big square, we have
R
\pi-1

=C\pi=R

-1
\pi
and
C
\pi-1

=R\pi

.[3]

Permutation matrices permute rows or columns

Multiplying a matrix M by either

R\pi

or

C\pi

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

(v1,\ldots,vn)

by some permutation, we move the

ith

entry

vi

of the input vector into the

\pi(i)th

slot of the output vector. Which entry then ends up in, say, the first slot of the output? Answer: The entry

vj

for which

\pi(j)=1

, and hence

j=\pi-1(1)

. Arguing similarly about each of the slots, we find that the output vector is
(v
\pi-1(1)
,v
\pi-1(2)
,\ldots,v
\pi-1(n)

),

even though we are permuting by

\pi

, not by

\pi-1

. Thus, in order to permute the entries by

\pi

, we must permute the indices by

\pi-1

. (Permuting the entries by

\pi

is sometimes called taking the alibi viewpoint, while permuting the indices by

\pi

would take the alias viewpoint.[4])

Now, suppose that we pre-multiply some n-row matrix

M=(mi,j)

by the permutation matrix

C\pi

. By the rule for matrix multiplication, the

(i,j)th

entry in the product

C\piM

is

\sum_^n c_m_,where

ci,k

is 0 except when

i=\pi(k)

, when it is 1. Thus, the only term in the sum that survives is the term in which

k=\pi-1(i)

, and the sum reduces to
m
\pi-1(i),j
. Since we have permuted the row index by

\pi-1

, we have permuted the rows of M themselves by . A similar argument shows that post-multiplying an n-column matrix M by

R\pi

permutes its columns by .

The other two options are pre-multiplying by

R\pi

or post-multiplying by

C\pi

, 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, which we here solve.) If

P=(pi,j)

, then the

(i,j)th

entry of its transpose

PT

is

pj,i

. The

(i,j)th

entry of the product

PPT

is then

\sum_^n p_p_.Whenever

i\nej

, the

kth

term in this sum is the product of two different entries in the

kth

column of P; so all terms are 0, and the sum is 0. When

i=j

, we are summing the squares of the entries in the

ith

row of P, so the sum is 1. The product

PPT

is thus the identity matrix. A symmetric argument shows the same for

PTP

, implying that P is invertible with

P-1=PT

.

Multiplying permutation matrices

Given two permutations of elements and, the product of the corresponding column-based permutation matrices and is given, as you might expect, byC_ C_ = C_, where the composed permutation

\sigma\circ\tau

applies first and then, working from right to left:(\sigma\circ\tau) (k) = \sigma \left(\tau (k) \right).This follows because pre-multiplying some matrix by and then pre-multiplying the resulting product by gives the same result as pre-multiplying just once by the combined

C\sigma\circ\tau

.

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

R\sigmaR\tau=R\tau\circ\sigma,

with applied before 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 and then by .

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

\sigma;\tau

is defined either by

(\sigma;\tau)(k)=\tau\left(\sigma(k)\right),

or, more elegantly, by

(k)(\sigma;\tau)=\left((k)\sigma\right)\tau,

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

R\sigmaR\tau=R\sigma;\tau.

Matrix group

When is the identity permutation, which has

\pi(i)=i

for all i, both and are the identity matrix.

There are permutation matrices, since there are permutations and the map

C\colon\pi\mapstoC\pi

is a one-to-one correspondence between permutations and permutation matrices. (The map

R

is another such correspondence.) By the formulas above, those permutation matrices form a group of order under matrix multiplication, with the identity matrix as its identity element, a group that we denote

l{P}n

. The group

l{P}n

is a subgroup of the general linear group

GLn(R)

of invertible matrices of real numbers. Indeed, for any field F, the group

l{P}n

is also a subgroup of the group

GLn(F)

, where the matrix entries belong to F. (Every field contains 0 and 1 with

0+0=0,

0+1=1,

0*0=0,

0*1=0,

and

1*1=1;

and that's all we need to multiply permutation matrices. Different fields disagree about whether

1+1=0

, but that sum doesn't arise.)

Let

\leftarrow
S
n
denote the symmetric group, or group of permutations, on where the group operation is the standard, right-to-left composition "

\circ

"; and let
S
n
denote the opposite group, which uses the left-to-right composition "

;

". The map

C\colon

\leftarrow\to
S
n

GLn(R)

that takes to its column-based matrix

C\pi

is a faithful representation, and similarly for the map

R\colon

\to
S
n

GLn(R)

that takes to

R\pi

.

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:

\begin{matrix}\rhoP\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] \updownarrow&&\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& \kappaP\colon\begin{pmatrix}1&2&3&4\\4&2&1&3\end{pmatrix}\end{matrix}

So we are here denoting the inverse of C as

\kappa

and the inverse of R as

\rho

. We can then compute the linear-algebraic properties of P from some combinatorial properties that are shared by the two permutations

\kappaP

and

\rhoP=\kappa

-1
P
.

A point is fixed by

\kappaP

just when it is fixed by

\rhoP

, and the trace of P is the number of such shared fixed points. If the integer k is one of them, then the standard basis vector is an eigenvector of P.

To calculate the complex eigenvalues of P, write the permutation

\kappaP

as a composition of disjoint cycles, say

\kappaP=c1c2ct

. (Permutations of disjoint subsets commute, so it doesn't matter here whether we are composing right-to-left or left-to-right.) For

1\lei\let

, let the length of the cycle

ci

be

\elli

, and let

Li

be the set of complex solutions of
\elli
x

=1

, those solutions being the
th
\ell
i
roots of unity. The multiset union of the

Li

is then the multiset of eigenvalues of P. Since writing

\rhoP

as a product of cycles would give the same number of cycles of the same lengths, analyzing

\rhop

would give the same result. The multiplicity of any eigenvalue v is the number of i for which

Li

contains v.[6] (Since any permutation matrix is normal and any normal matrix is diagonalizable over the complex numbers, 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

\kappaP

, which is also the sign of

\rhoP

.

Restricted forms

See also

References

Notes and References

  1. Book: Artin . Michael . 1991 . Algebra . Prentice Hall . 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 . 10.1016/j.automatica.2008.04.009 . 834305 . 21 August 2022 . Let

    On

    denote the set of

    n x n

    orthogonal matrices and

    Nn

    denote the set of

    n x n

    element-wise non-negative matrices. Then,

    Pn=On\capNn

    , where

    Pn

    is the set of

    n x n

    permutation matrices.. 10.1.1.128.6870 .
  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. Book: Conway . John H. . Burgiel . Heidi . Goodman-Strauss . Chaim . 2008 . The Symmetries of Things . A K Peters . 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