{
  "id": "permutation-matrix",
  "title": "Permutation Matrix",
  "lang": "en",
  "source_lang": "en",
  "summary": "A permutation matrix is a square matrix that represents a rearrangement of coordinates, with exactly one entry equal to 1 in each row and column and all other entries equal to 0.",
  "category": "mathematics",
  "subcategory": "algebra",
  "type": "concept",
  "aliases": [],
  "generated_at": "2026-11-05",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/permutation-matrix/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/permutation-matrix/",
      "json": "https://aiwiki.page/zh/permutation-matrix.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "A permutation matrix is a square matrix whose entries are all 0 or 1, with exactly one 1 in each row and each column. It represents a permutation of a finite set as a linear transformation that rearranges coordinates. Multiplying a matrix by a permutation matrix reorders its rows or columns without changing their entries. Permutation matrices connect linear algebra with combinatorics and group theory, and are widely used in numerical computation, graph algorithms, and optimization."
    },
    {
      "heading": "Definition and conventions",
      "text": "Let \\(\\sigma\\) be a permutation of \\(\\{1,\\ldots,n\\}\\), and let \\(e_1,\\ldots,e_n\\) be the standard coordinate vectors. Define its permutation matrix \\(P_\\sigma\\) by\n\n\\[P_\\sigma e_j=e_{\\sigma(j)}.\\]\n\nEquivalently,\n\n\\[(P_\\sigma)_{ij}= \\begin{cases} 1,&i=\\sigma(j),\\\\ 0,&i\\ne\\sigma(j). \\end{cases}\\]\n\nThus column \\(j\\) is the vector \\(e_{\\sigma(j)}\\). Every \\(n\\times n\\) permutation matrix determines exactly one permutation, so there are \\(n!\\) such matrices.\n\nFor a column vector \\(x\\),\n\n\\[(P_\\sigma x)_i=x_{\\sigma^{-1}(i)}.\\]\n\nThe inverse permutation appears because the coordinate originally in position \\(j\\) moves to position \\(\\sigma(j)\\).\n\nSome texts instead define the matrix associated with \\(\\sigma\\) by placing the 1 in row \\(i\\), column \\(\\sigma(i)\\). That convention gives the transpose of the matrix defined here. Both conventions describe the same collection of matrices, but formulas involving composition and coordinate movement depend on which convention is chosen.\n\nExample\n\nFor the cycle \\(\\sigma=(1\\,2\\,3)\\), meaning \\(1\\mapsto2\\), \\(2\\mapsto3\\), and \\(3\\mapsto1\\),\n\n\\[P_\\sigma= \\begin{pmatrix} 0&0&1\\\\ 1&0&0\\\\ 0&1&0 \\end{pmatrix}.\\]\n\nConsequently,\n\n\\[P_\\sigma \\begin{pmatrix} x_1\\\\x_2\\\\x_3 \\end{pmatrix} = \\begin{pmatrix} x_3\\\\x_1\\\\x_2 \\end{pmatrix}.\\]\n\nThe identity matrix is the permutation matrix corresponding to the permutation that leaves every position fixed."
    },
    {
      "heading": "Row and column permutations",
      "text": "For an \\(n\\times m\\) matrix \\(A\\), multiplication on the left by an \\(n\\times n\\) permutation matrix gives\n\n\\[(P_\\sigma A)_{ij}=A_{\\sigma^{-1}(i),j}.\\]\n\nThus row \\(j\\) of \\(A\\) moves to row \\(\\sigma(j)\\).\n\nFor an \\(m\\times n\\) matrix \\(A\\), multiplication on the right gives\n\n\\[(AP_\\sigma)_{ij}=A_{i,\\sigma(j)}.\\]\n\nThus column \\(j\\) of \\(AP_\\sigma\\) is column \\(\\sigma(j)\\) of \\(A\\). In terms of movement of the original columns, column \\(k\\) moves to position \\(\\sigma^{-1}(k)\\).\n\nThese formulas distinguish two operations that are sometimes described ambiguously as “applying a permutation.” To move original column \\(j\\) specifically to position \\(\\sigma(j)\\), the appropriate product is \\(AP_\\sigma^T\\).\n\nWhen \\(A\\) is square,\n\n\\[B=P_\\sigma A P_\\sigma^T\\]\n\nreorders rows and columns together:\n\n\\[B_{\\sigma(i),\\sigma(j)}=A_{ij}.\\]\n\nThis is a similarity transformation, corresponding to a relabeling of coordinates."
    },
    {
      "heading": "Algebraic properties",
      "text": "Transpose, inverse, and orthogonality\n\nThe columns of a permutation matrix are distinct standard coordinate vectors, so they form an orthonormal basis. Therefore,\n\n\\[P^TP=PP^T=I.\\]\n\nIn particular, every permutation matrix is an orthogonal matrix, and its inverse is its transpose:\n\n\\[P_\\sigma^{-1}=P_\\sigma^T=P_{\\sigma^{-1}}.\\]\n\nPermutation matrices preserve Euclidean lengths and inner products. More generally, because they only rearrange coordinates, they preserve every standard coordinate \\(\\ell^p\\) norm, including the maximum norm.\n\nA permutation matrix is symmetric precisely when its permutation is its own inverse:\n\n\\[P_\\sigma=P_\\sigma^T \\quad\\Longleftrightarrow\\quad \\sigma^2=\\mathrm{id}.\\]\n\nSuch a permutation consists only of fixed points and disjoint transpositions.\n\nMultiplication and the symmetric group\n\nUsing function composition in the convention\n\\((\\sigma\\circ\\tau)(j)=\\sigma(\\tau(j))\\),\n\n\\[P_\\sigma P_\\tau=P_{\\sigma\\circ\\tau}.\\]\n\nHence the \\(n\\times n\\) permutation matrices form a group under matrix multiplication, isomorphic to the symmetric group \\(S_n\\). This construction is a faithful representation of \\(S_n\\): different permutations give different linear transformations.\n\nIf the disjoint cycles of \\(\\sigma\\) have lengths \\(\\ell_1,\\ldots,\\ell_c\\), then the smallest positive integer \\(r\\) for which \\(P_\\sigma^r=I\\) is\n\n\\[r=\\operatorname{lcm}(\\ell_1,\\ldots,\\ell_c).\\]\n\nDeterminant and trace\n\nThe determinant of a permutation matrix equals the sign of its permutation:\n\n\\[\\det(P_\\sigma)=\\operatorname{sgn}(\\sigma)\\in\\{1,-1\\}.\\]\n\nIf \\(\\sigma\\) has \\(c\\) disjoint cycles, counting fixed points as cycles of length 1, then\n\n\\[\\det(P_\\sigma)=(-1)^{n-c}.\\]\n\nThe trace counts fixed points:\n\n\\[\\operatorname{tr}(P_\\sigma) = \\#\\{i:\\sigma(i)=i\\}.\\]\n\nThese statements concern permutation matrices over the real or complex numbers. The same 0–1 construction works over other fields, although in characteristic 2 the scalars \\(1\\) and \\(-1\\) coincide."
    },
    {
      "heading": "Cycle structure and eigenvalues",
      "text": "Reordering the coordinate basis to group together the elements of each cycle puts a permutation matrix into block-diagonal form, with one block for each cycle.\n\nA cycle of length \\(\\ell\\) has characteristic polynomial\n\n\\[t^\\ell-1.\\]\n\nTherefore, for cycle lengths \\(\\ell_1,\\ldots,\\ell_c\\),\n\n\\[\\det(tI-P_\\sigma) = \\prod_{r=1}^{c}(t^{\\ell_r}-1).\\]\n\nOver the complex numbers, its eigenvalues are roots of unity. Each cycle of length \\(\\ell\\) contributes\n\n\\[e^{2\\pi i k/\\ell}, \\qquad k=0,\\ldots,\\ell-1.\\]\n\nEvery permutation matrix is diagonalizable over the complex numbers. It need not be diagonalizable over the real numbers because some eigenvalues may be nonreal.\n\nThe eigenvalue 1 has multiplicity equal to the number of cycles. Its eigenvectors are precisely the vectors whose coordinates are constant on each cycle. In particular, the all-ones vector always satisfies\n\n\\[P_\\sigma\\mathbf{1}=\\mathbf{1}.\\]"
    },
    {
      "heading": "Doubly stochastic matrices and assignment problems",
      "text": "A doubly stochastic matrix is a square matrix with nonnegative real entries whose rows and columns each sum to 1. Every permutation matrix is doubly stochastic, but a general doubly stochastic matrix can have fractional entries.\n\nThe Birkhoff–von Neumann theorem states that every doubly stochastic matrix is a convex combination of permutation matrices:\n\n\\[D=\\sum_{r=1}^{N}\\alpha_rP_r, \\qquad \\alpha_r\\ge0, \\qquad \\sum_{r=1}^{N}\\alpha_r=1.\\]\n\nEquivalently, the permutation matrices are exactly the extreme points of the set of doubly stochastic matrices.\n\nThis result underlies the assignment problem. Assigning each of \\(n\\) workers to exactly one of \\(n\\) tasks can be encoded by a permutation matrix \\(X\\). For assignment costs \\(c_{ij}\\), the objective is\n\n\\[\\min_X\\sum_{i=1}^{n}\\sum_{j=1}^{n}c_{ij}X_{ij}.\\]\n\nRelaxing the requirement \\(X_{ij}\\in\\{0,1\\}\\) to nonnegativity, while retaining unit row and column sums, gives a linear program with the same optimal value. An optimal permutation matrix always exists, although fractional matrices may also be optimal when there are ties."
    },
    {
      "heading": "Computational applications",
      "text": "Numerical linear algebra\n\nPermutation matrices record pivoting and reordering operations. In Gaussian elimination with row pivoting, a common form of LU decomposition is\n\n\\[PA=LU,\\]\n\nwhere \\(P\\) records row exchanges, \\(L\\) is lower triangular, and \\(U\\) is upper triangular. Conventions differ: a factorization written as \\(A=PLU\\) may use the inverse permutation instead.\n\nFor a sparse matrix, row and column reorderings can substantially affect storage and the number of additional nonzero entries created during factorization. Permutations change the arrangement of entries, not the entries themselves.\n\nSoftware usually stores a permutation as an index array rather than as a dense matrix. Applying it to a vector takes \\(O(n)\\) indexing operations, and applying it to a matrix is implemented by rearranging rows or columns rather than by general matrix multiplication.\n\nGraph relabeling\n\nIf \\(A\\) is the adjacency matrix of a graph, then\n\n\\[B=PAP^T\\]\n\nis the adjacency matrix of the same graph with relabeled vertices. Two finite graphs with the same number of vertices are isomorphic exactly when their adjacency matrices are related in this way for some permutation matrix.\n\nPermutation similarity preserves eigenvalues, but equal adjacency spectra alone do not establish that two graphs are isomorphic."
    },
    {
      "heading": "Related matrix classes",
      "text": "A partial permutation matrix has entries in \\(\\{0,1\\}\\) and at most one 1 in each row and column. It may be rectangular and can describe an incomplete one-to-one assignment.\n\nA signed permutation matrix replaces the 1 entries of a permutation matrix by independently chosen \\(1\\) or \\(-1\\). Such a matrix remains orthogonal but can change coordinate signs as well as positions.\n\nA monomial matrix has exactly one nonzero entry in each row and column, with the nonzero entries not necessarily equal to 1. It combines a coordinate permutation with independent nonzero coordinate scalings. Unlike a permutation matrix, a general monomial matrix need not preserve lengths."
    }
  ],
  "links": [
    "matrix",
    "permutation",
    "linear-algebra",
    "identity-matrix",
    "matrix-similarity",
    "orthonormal-basis",
    "orthogonal-matrix",
    "inverse-matrix",
    "matrix-transpose",
    "function-composition",
    "symmetric-group",
    "representation-theory",
    "determinant",
    "matrix-trace",
    "characteristic-polynomial",
    "complex-number",
    "eigenvalues-and-eigenvectors",
    "convex-combination",
    "linear-programming",
    "gaussian-elimination",
    "lu-decomposition",
    "sparse-matrix",
    "adjacency-matrix"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}