Strang §2.7 · Permutations
Permutation matrices shuffle rows.
A permutation matrix is the identity with its rows in a new order. Multiply A by it and the rows of A move into that order.
P = 001100010 PA = rows 3, 1, 2 of A
Think: a playlist
A permutation is a new running order for a playlist. Row 1 of P says which song plays first, row 2 which plays second, and so on.
Each row of P has a single 1. A 1 in column 3 of row 1 means "the first slot gets row 3".
Undo by transposing
To put the playlist back, read the instructions the other way: "row 3 came from slot 1". That is Pᵀ. So for every permutation, P⁻¹ = Pᵀ.
Worked example
Use A with rows full of 1s, 2s and 3s, so you can see where each row goes.
P = 001100010 PA = 333111222
PᵀP = I ✓
Counting and the plane
- There are n! orders of n rows, so 3 by 3 has 6 permutation matrices, including I.
- In the plane, the only swap is 0110. It is the mirror on the line y = x from lesson 1, with det = −1.
Back to elimination
When lesson 2 hit a zero pivot, we swapped rows. Doing all the swaps first gives PA = LU. That is the form NumPy and every real solver use, with swaps chosen for the largest pivots.