permutatiematrix
Permutatiematrix, or permutation matrix in English, is a square binary matrix with exactly one 1 in each row and each column and 0s elsewhere. It represents a permutation of the coordinates of a vector or the rows and columns of a matrix. Given a permutation π on {1, ..., n}, the corresponding permutation matrix P has entries P_{i,j} = 1 if j = π(i) and 0 otherwise. Then (Px)_i = x_{π(i)}, so P permutes the components of a vector x according to π.
Permutation matrices are orthogonal: P^T = P^{-1}, and det(P) equals the sign of π (either +1 or -1).
Left-multiplication by P permutes the rows of a matrix; right-multiplication by P permutes the columns (more
Example: for n = 3, take the permutation π with 1 → 2, 2 → 3, 3 → 1 (the cycle
Applications include reordering data, implementing pivot strategies in algorithms, and rearranging components in linear algebra computations