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 and 0s elsewhere. Each such matrix, say P, represents a permutation of m elements and, when used to multiply another matrix, say A, results in permuting the rows (when pre-multiplying, to form PA) or columns (when post-multiplying, to form AP) of the matrix A.
Given a permutation pi of m elements,
represented in two-line form by
there are two natural ways to associate the permutation with a permutation matrix; namely, starting with the m × m identity matrix, Im, either permute the columns or permute the rows, according to pi. Both methods of defining permutation matrices appear in the literature and the properties expressed in one representation can be easily converted to the other representation. This article will primarily deal with just one of these representations and the other will only be mentioned when there is a difference to be aware of.
The m × m permutation matrix Ppi = (pij) obtained by permuting the columns of the identity matrix Im, that is, for each i, pij = 1 if j = pi(i) and pij = 0 otherwise, will be referred to as the column representation in this article. Since the entries in row i are all 0 except that a 1 appears in column pi(i), we may write
where , a standard basis vector, denotes a row vector of length m with 1 in the jth position and 0 in every other position.
For example, the permutation matrix Ppi corresponding to the permutation is
Observe that the jth column of the I5 identity matrix now appears as the pi(j)th column of Ppi.
The other representation, obtained by permuting the rows of the identity matrix Im, that is, for each j, pij = 1 if i = pi(j) and pij = 0 otherwise, will be referred to as the row representation.
The column representation of a permutation matrix is used throughout this section, except when otherwise indicated.
Multiplying times a column vector g will permute the rows of the vector:
Repeated use of this result shows that if M is an appropriately sized matrix, the product, is just a permutation of the rows of M.