Euler Hall — free maths guides

Apply a permutation matrix to reorder rows

Build the permutation matrix for a stated row order, one 1 per row and column. The idea in plain words, a worked example, and a check with the answers shown — part of the free Linear Algebra guides.

The one sentence that makes this easy

A permutation matrix is the identity with its rows put in a different order. That is the whole definition. Nothing is added, nothing is scaled, no entry changes value — the rows simply arrive in a new sequence.

SoPP for the row order2,3,12,3,1 is

P=[010001100].P=\begin{bmatrix}0&1&0\\0&0&1\\1&0&0\end{bmatrix}.

Read the 1's across the rows: column 2, then column 3, then column 1. That list is the order. Row 1 ofPP has its 1 in column 2, so row 1 ofPAPA is row 2 ofAA. Row 2 picks row 3, row 3 picks row 1.

There aren!n! of them for sizenn: three choices for the first row's 1, two for the second, one for the third.

WhyP−1=PTP^{-1}=P^{T}

Rowii ofPP has its single 1 in some columnjj. Transposing puts rowii ofPP into columnii ofPTP^{T}, so columnii ofPTP^{T} still has that same 1 in positionjj.

Now dot rowii ofPP with columnkk ofPTP^{T}. Both are the vector with a single 1, and they share a position only wheni=ki=k. So the product is11 on the diagonal and00 everywhere else —PPT=IPP^{T}=I.

Two consequences worth holding on to. First, undoing a reordering is another reordering, so you never need elimination to invert a permutation. Second,det⁡P=±1\det P=\pm1, becausedet⁡(P)det⁡(PT)=det⁡I=1\det(P)\det(P^{T})=\det I=1 anddet⁡PT=det⁡P\det P^{T}=\det P.

Worked example, in the shape the question asks

TakePP for the order3,1,23,1,2 and a3×23\times2 matrixAA:

Row 1 ofPP has its 1 in column 3, so row 1 ofPAPA is row 3 ofAA, which is(3,6)(3,6). Row 2 picks row 1:(1,4)(1,4). Row 3 picks row 2:(2,5)(2,5).

PA=[361425].PA=\begin{bmatrix}3&6\\1&4\\2&5\end{bmatrix}.

Check by counting: three rows in, three rows out, every original row present exactly once. That is the property the column condition buys you.

By the end you can
  • Build the permutation matrix for a stated row order, one 1 per row and column
  • Read the row order of PA off the columns holding the 1's of P
  • Tell a permutation matrix from a 0/1 matrix that loses or duplicates an entry
Test yourself

Which of these is a permutation matrix?

Then say what each one does to(4,7)(4,7) when it multiplies from the left.

Answers

OnlyM1M_1.

M1M_1 passes all three tests — entries are 0 and 1, every row sums to 1, every column sums to 1 — and it swaps the entries, sending(4,7)(4,7) to(7,4)(7,4).

M2M_2 fails the column test: column 1 holds two 1's and column 2 holds none. It sends(4,7)(4,7) to(4,4)(4,4), losing the 7.

M3M_3 fails the entry test: a 2 is not allowed. If you accepted it you would get(7,4)(7,4) again, which looks right — a reminder that a plausible output does not prove a valid input. The definition is about the entries, not about the result.

Work out where to start — free, no accountAnswer six real questions — free, no account