Tutorials › Linear Algebra › Permutation Matrices And Row Reordering

Properties of Determinants · Tutorial 244 of 1000

Permutation Matrices And Row Reordering

Use permutation matrices to reorder rows or columns and determine the resulting determinant without recomputing it from scratch.

Intermediate 10 min read

What You'll Learn

  • Define a permutation matrix from a permutation of the row or column indices.
  • Track the exact row order produced by left multiplication.
  • Track the exact column order produced by right multiplication.
  • Determine a permutation’s sign using inversions or transpositions.
  • Prove how row and column reordering changes a determinant.
  • Recognize and correct common indexing and sign errors.

Permutations as Matrix Operations

Reordering rows or columns is a familiar operation, but it is important to specify exactly which order a matrix records. A permutation matrix turns a reordering into a matrix product. Its determinant records whether the permutation preserves or reverses the sign of the determinant: an even permutation contributes \(1\), while an odd permutation contributes \(-1\).

Throughout, matrices are square of size \(n\times n\) when a determinant is taken, and scalars are in \(\mathbb{R}\). A permutation \(\sigma\) of \(\{1,\dots,n\}\) is a bijection from this set to itself. Its one-line notation is the list \(\sigma(1),\dots,\sigma(n)\). An inversion is a pair \(i<j\) for which \(\sigma(i)>\sigma(j)\). The sign \(\operatorname{sgn}(\sigma)\) is \(1\) if the number of inversions is even and \(-1\) if it is odd. Equivalently, it is \(1\) for a permutation expressible as an even number of transpositions, and \(-1\) for one expressible as an odd number. The standard sign rules are \(\operatorname{sgn}(\alpha\circ\beta)=\operatorname{sgn}(\alpha)\operatorname{sgn}(\beta)\) and \(\operatorname{sgn}(\sigma^{-1})=\operatorname{sgn}(\sigma)\).

Definition: For a permutation \(\sigma\) of \(\{1,\dots,n\}\), its permutation matrix \(\mathbf{P}_{\sigma}\) is the \(n\times n\) matrix defined by \(\mathbf{P}_{\sigma}\mathbf{e}_j=\mathbf{e}_{\sigma(j)}\) for every standard basis vector \(\mathbf{e}_j\). Equivalently, its entry in row \(i\), column \(j\) is \(1\) if \(i=\sigma(j)\), and \(0\) otherwise. Thus column \(j\) has its \(1\) in row \(\sigma(j)\).

This convention determines the order of the rows and columns. If \(\mathbf{A}\) has rows \(\mathbf{r}_1,\dots,\mathbf{r}_n\) and columns \(\mathbf{a}_1,\dots,\mathbf{a}_n\), then left multiplication gives row \(i\) of \(\mathbf{P}_{\sigma}\mathbf{A}\) from row \(\sigma^{-1}(i)\) of \(\mathbf{A}\). Right multiplication gives column \(j\) of \(\mathbf{A}\mathbf{P}_{\sigma}\) as \(\mathbf{a}_{\sigma(j)}\). The inverse appears in the left-multiplication rule because the \(1\) in row \(i\) of \(\mathbf{P}_{\sigma}\) is in column \(\sigma^{-1}(i)\).

Two Basic Identities

Theorem: Let \(\sigma\) and \(\tau\) be permutations of \(\{1,\dots,n\}\). With the convention above, \(\mathbf{P}_{\sigma}\mathbf{P}_{\tau}=\mathbf{P}_{\sigma\circ\tau}\).

Proof. For each standard basis vector \(\mathbf{e}_j\), the definition gives \(\mathbf{P}_{\sigma}\mathbf{P}_{\tau}\mathbf{e}_j=\mathbf{P}_{\sigma}\mathbf{e}_{\tau(j)}=\mathbf{e}_{\sigma(\tau(j))}\). This is also \(\mathbf{P}_{\sigma\circ\tau}\mathbf{e}_j\). The two matrices therefore agree on every standard basis vector. Each column of a matrix is its product with the corresponding standard basis vector, so the matrices have the same columns and are equal. \(\square\)

The order of composition matters: the matrix on the right acts first. This identity also shows how to combine successive reorderings without guessing their order.

Theorem: Let \(\mathbf{A}\in\mathbb{R}^{n\times n}\), and let \(\sigma\) be a permutation of \(\{1,\dots,n\}\). Then \(\mathbf{P}_{\sigma}\mathbf{A}\) has row \(i\) equal to row \(\sigma^{-1}(i)\) of \(\mathbf{A}\), \(\mathbf{A}\mathbf{P}_{\sigma}\) has column \(j\) equal to column \(\sigma(j)\) of \(\mathbf{A}\), and \(\det(\mathbf{P}_{\sigma}\mathbf{A})=\operatorname{sgn}(\sigma)\det(\mathbf{A})\), \(\det(\mathbf{A}\mathbf{P}_{\sigma})=\operatorname{sgn}(\sigma)\det(\mathbf{A})\), and \(\det(\mathbf{P}_{\sigma})=\operatorname{sgn}(\sigma)\).

Proof. The entry of \(\mathbf{P}_{\sigma}\mathbf{A}\) in row \(i\), column \(j\) is \(\sum_{k=1}^{n}p_{ik}a_{kj}=a_{\sigma^{-1}(i),j}\), since row \(i\) of \(\mathbf{P}_{\sigma}\) has its only \(1\) in column \(\sigma^{-1}(i)\). The entry of \(\mathbf{A}\mathbf{P}_{\sigma}\) in row \(i\), column \(j\) is \(\sum_{k=1}^{n}a_{ik}p_{kj}=a_{i,\sigma(j)}\), since column \(j\) of \(\mathbf{P}_{\sigma}\) has its only \(1\) in row \(\sigma(j)\). These establish the stated row and column orders.

To prove the determinant identities, use the Leibniz formula \(\det(\mathbf{A})=\sum_{\tau}\operatorname{sgn}(\tau)\prod_{i=1}^{n}a_{i,\tau(i)}\), where the sum is over all permutations \(\tau\) of \(\{1,\dots,n\}\). Write \(\mathbf{B}=\mathbf{P}_{\sigma}\mathbf{A}\). Substituting \(b_{ij}=a_{\sigma^{-1}(i),j}\) gives \(\det(\mathbf{B})=\sum_{\tau}\operatorname{sgn}(\tau)\prod_i a_{\sigma^{-1}(i),\tau(i)}\). Set \(k=\sigma^{-1}(i)\), so \(i=\sigma(k)\), and define \(\rho=\tau\circ\sigma\). The product becomes \(\prod_k a_{k,\rho(k)}\). As \(\tau\) ranges over all permutations, so does \(\rho\), and \(\operatorname{sgn}(\tau)=\operatorname{sgn}(\rho)\operatorname{sgn}(\sigma)\). Therefore \(\det(\mathbf{B})=\operatorname{sgn}(\sigma)\det(\mathbf{A})\).

For \(\mathbf{C}=\mathbf{A}\mathbf{P}_{\sigma}\), use \(c_{ij}=a_{i,\sigma(j)}\) in the same formula: \(\det(\mathbf{C})=\sum_{\tau}\operatorname{sgn}(\tau)\prod_i a_{i,\sigma(\tau(i))}\). Set \(\rho=\sigma\circ\tau\). Then \(\operatorname{sgn}(\tau)=\operatorname{sgn}(\sigma)\operatorname{sgn}(\rho)\), and the products are \(\prod_i a_{i,\rho(i)}\). Summing over all \(\rho\) proves \(\det(\mathbf{C})=\operatorname{sgn}(\sigma)\det(\mathbf{A})\).

Finally, apply the Leibniz formula to \(\mathbf{P}_{\sigma}\). A product \(\prod_i p_{i,\tau(i)}\) is nonzero exactly when \(\tau(i)=\sigma^{-1}(i)\) for every \(i\). There is one such permutation, \(\tau=\sigma^{-1}\), and its product is \(1\). Thus \(\det(\mathbf{P}_{\sigma})=\operatorname{sgn}(\sigma^{-1})=\operatorname{sgn}(\sigma)\). \(\square\)

This argument uses the Leibniz formula directly; it does not assume the multiplicative determinant law. In particular, it proves the effect of these specific matrix products without relying on a general formula for the determinant of a product.

Worked Row and Column Reorderings

Worked Example: A Three-Cycle Reorders Rows

Let \(\sigma(1)=2,\ \sigma(2)=3,\ \sigma(3)=1\). Its one-line notation is \((2,3,1)\), which has two inversions: \(2>1\) and \(3>1\). Thus \(\operatorname{sgn}(\sigma)=1\). Form \(\mathbf{P}_{\sigma}\) by placing the columns \(\mathbf{e}_2,\mathbf{e}_3,\mathbf{e}_1\) in order:

$$ \mathbf{P}_{\sigma}= \begin{bmatrix}0&0&1\\1&0&0\\0&1&0\end{bmatrix}. $$

Take \(\mathbf{A}=\begin{bmatrix}1&2&0\\0&1&1\\2&0&1\end{bmatrix}\). The rows of \(\mathbf{P}_{\sigma}\mathbf{A}\) are old rows \(\sigma^{-1}(1)=3,\ \sigma^{-1}(2)=1,\ \sigma^{-1}(3)=2\), so direct multiplication gives

$$ \mathbf{P}_{\sigma}\mathbf{A} = \begin{bmatrix}2&0&1\\1&2&0\\0&1&1\end{bmatrix}. $$

Expand along the first row of \(\mathbf{A}\): \(\det(\mathbf{A})=1(1\cdot1-1\cdot0)-2(0\cdot1-1\cdot2)=1-2(-2)=5\). For the reordered matrix, expansion along its first row gives \(\det(\mathbf{P}_{\sigma}\mathbf{A})=2(2\cdot1-0\cdot1)+1(1\cdot1-2\cdot0)=4+1=5\).

Check: the two determinants agree, as required by \(\operatorname{sgn}(\sigma)=1\). Expanding \(\det(\mathbf{P}_{\sigma})\) along its first row gives \(1\), also the predicted sign.

Worked Example: A Transposition Reorders Columns

Let \(\sigma\) swap \(1\) and \(3\) and leave \(2\) fixed. Its one-line notation \((3,2,1)\) has three inversions, so its sign is \(-1\). Its permutation matrix and a matrix to reorder are

$$ \mathbf{P}_{\sigma}= \begin{bmatrix}0&0&1\\0&1&0\\1&0&0\end{bmatrix}, \qquad \mathbf{A}= \begin{bmatrix}1&0&2\\0&1&1\\1&1&0\end{bmatrix}. $$

Right multiplication makes the new columns old columns \(3,2,1\), respectively. Hence \(\mathbf{A}\mathbf{P}_{\sigma}=\begin{bmatrix}2&0&1\\1&1&0\\0&1&1\end{bmatrix}\). Expanding the original determinant along row \(1\) gives \(\det(\mathbf{A})=1(0\cdot0-1\cdot1)+2(0\cdot1-1\cdot1)=-1-2=-3\). For the reordered matrix, expansion along row \(1\) gives \(\det(\mathbf{A}\mathbf{P}_{\sigma})=2(1\cdot1-0\cdot1)+1(1\cdot1-1\cdot0)=2+1=3\).

Check: \(3=(-1)(-3)=\operatorname{sgn}(\sigma)\det(\mathbf{A})\). Also, expansion along row \(2\) of \(\mathbf{P}_{\sigma}\) gives \(-1\), confirming its determinant.

Worked Example: A Four-Index Permutation Matrix

Let \(\sigma\) have one-line notation \((2,4,1,3)\). The inversions are \((2,1),(4,1),(4,3)\), so \(\operatorname{sgn}(\sigma)=-1\). Its permutation matrix has a \(1\) in row \(\sigma(j)\) of column \(j\):

$$ \mathbf{P}_{\sigma}= \begin{bmatrix}0&0&1&0\\1&0&0&0\\0&0&0&1\\0&1&0&0\end{bmatrix}. $$

Let \(\mathbf{D}=\begin{bmatrix}1&0&0&0\\0&2&0&0\\0&0&3&0\\0&0&0&4\end{bmatrix}\). Left multiplication gives the row order \(\sigma^{-1}(1),\dots,\sigma^{-1}(4)=(3,1,4,2)\), so

$$ \mathbf{P}_{\sigma}\mathbf{D} = \begin{bmatrix}0&0&3&0\\1&0&0&0\\0&0&0&4\\0&2&0&0\end{bmatrix}. $$

In the Leibniz formula for this matrix, the only nonzero product selects columns \((3,1,4,2)\) in rows \(1,2,3,4\). This permutation has three inversions, and the product of the selected entries is \(3\cdot1\cdot4\cdot2=24\). Therefore \(\det(\mathbf{P}_{\sigma}\mathbf{D})=-24\). The diagonal matrix has determinant \(1\cdot2\cdot3\cdot4=24\), and the same unique-term calculation gives \(\det(\mathbf{P}_{\sigma})=-1\).

Check: \(\det(\mathbf{P}_{\sigma}\mathbf{D})=(-1)(24)=\operatorname{sgn}(\sigma)\det(\mathbf{D})\), consistent with the theorem.

Common Sign and Indexing Errors

Do not confuse the permutation with its inverse when reading rows. For the three-cycle in the first example, \(\sigma=(2,3,1)\), but left multiplication puts the old rows in the order \((3,1,2)\), not \((2,3,1)\). The latter list describes where the columns of the permutation matrix’s standard basis vectors go; the row order of the product is indexed by \(\sigma^{-1}\). Checking the entries of \(\mathbf{P}_{\sigma}\mathbf{A}\) resolves the ambiguity.

Do not assign a three-cycle the sign of a single swap. A common wrong calculation is to say that a cycle of length three must have sign \(-1\), and therefore to predict \(\det(\mathbf{P}_{\sigma}\mathbf{A})=-5\) in the first example. The one-line notation \((2,3,1)\) has two inversions, so the sign is \(1\); equivalently, a three-cycle can be written using two transpositions. The corrected determinant is \(5\), as direct expansion confirms.

The practical rule is to count inversions or transpositions before changing a determinant. A row or column permutation changes its value only by the sign of that permutation; it does not change the magnitude. If several reorderings are made, compose their permutations in the order the corresponding matrices act, or keep track of each sign separately.

Check Your Understanding

Use the convention \(\mathbf{P}_{\sigma}\mathbf{e}_j=\mathbf{e}_{\sigma(j)}\) throughout.

  1. For \(\sigma=(3,1,2)\), write \(\mathbf{P}_{\sigma}\) and state the row order of \(\mathbf{P}_{\sigma}\mathbf{A}\).
  2. Find the sign of the permutation with one-line notation \((2,4,1,3)\) by counting inversions.
  3. If \(\sigma\) swaps \(1\) and \(2\), what is the column order of \(\mathbf{A}\mathbf{P}_{\sigma}\), and how does its determinant compare with \(\det(\mathbf{A})\)?
  4. Explain why the nonzero term in the Leibniz formula for \(\det(\mathbf{P}_{\sigma})\) corresponds to \(\sigma^{-1}\).
  5. For two permutations \(\sigma,\tau\), which permutation is represented by \(\mathbf{P}_{\sigma}\mathbf{P}_{\tau}\)?

Test yourself: Linear Algebra final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon