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.
Definition
Given a permutation π of m elements,
:\pi : \lbrace 1, \ldots, m \rbrace \to \lbrace 1, \ldots, m \rbrace
represented in two-line form by
:\begin{pmatrix} 1 & 2 & \cdots & m \ \pi(1) & \pi(2) & \cdots & \pi(m) \end{pmatrix},
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 π. Both methods of defin