Tutorials › Linear Algebra › Computing Determinants From Permutations

Properties of Determinants · Tutorial 232 of 1000

Computing Determinants From Permutations

Learn to organize determinant calculations by even and odd permutations, simplify sparse cases, and check the result independently.

Intermediate 9 min read

What You'll Learn

  • Write the Leibniz formula for a determinant of any square size
  • Find a permutation’s sign by counting inversions
  • Group the six terms of a 3×3 determinant by sign
  • Identify the nonzero terms in a sparse 4×4 determinant
  • Compute a symbolic 3×3 determinant by collecting terms
  • Judge when the number of permutation terms makes direct evaluation practical

From Permutations to Determinant Terms

The Leibniz formula evaluates a determinant by considering every way to choose one entry from each row and one from each column. Each choice is encoded by a permutation: the value \(\sigma(i)\) tells us which column to choose in row \(i\). The resulting product is included with a sign determined by the permutation. For small matrices, especially when many entries are zero, this gives a direct way to organize a computation without expanding along a row or column.

For a permutation written as a tuple \((\sigma(1),\dots,\sigma(n))\), an inversion is a pair of positions \(i<j\) for which \(\sigma(i)>\sigma(j)\). A permutation is even if it has an even number of inversions, and odd if it has an odd number. Its sign, written \(\operatorname{sgn}(\sigma)\), is \(1\) when it is even and \(-1\) when it is odd.

Formula: For \(\mathbf{A}=[a_{ij}]\in\mathbb{R}^{n\times n}\), the Leibniz formula is $$ \det\mathbf{A}=\sum_{\sigma\in S_n}\operatorname{sgn}(\sigma)\prod_{i=1}^{n}a_{i,\sigma(i)}, $$ where \(S_n\) is the set of all permutations of \(\{1,\dots,n\}\). Thus each permutation contributes one product, formed by choosing one entry in each row and each column.

The calculation has two distinct tasks. First, determine which permutations contribute nonzero products; a product is zero if even one of its selected entries is zero. Second, assign the correct sign to each surviving product. Keeping these tasks separate helps prevent sign errors. When there are few zero entries, all the products may need to be calculated; when the matrix is sparse, it is often possible to discard most permutations quickly.

Counting and Grouping the Signs

For a \(3\times3\) matrix there are \(3!=6\) permutations: three even and three odd. For a \(4\times4\) matrix there are \(4!=24\): twelve even and twelve odd. The equality of the two sign counts is not a coincidence.

Theorem: For every \(n\ge2\), exactly half of the permutations in \(S_n\) are even and half are odd.

Proof. Fix the transposition \(\tau\) that swaps \(1\) and \(2\) and leaves all other numbers unchanged. Pair each permutation \(\sigma\) with \(\tau\circ\sigma\). Composing with a transposition reverses the sign of a permutation, so one member of each pair is even and the other is odd. No permutation is paired with itself: if \(\tau\circ\sigma=\sigma\), then composing on the right with \(\sigma^{-1}\) would give \(\tau\) equal to the identity, which it is not. The pairing covers all of \(S_n\), since applying \(\tau\) a second time returns \(\sigma\). Hence the permutations split into pairs with opposite signs, and the two sign counts are equal. \(\square\)

This count is useful for checking an organized list: for \(3\times3\), each sign group must contain three permutations; for \(4\times4\), each must contain twelve. It does not mean that the positive and negative numerical contributions have equal totals. Their products depend on the entries of the matrix, and their difference is the determinant.

The Six Terms for a \(3\times3\) Matrix

For three rows, the even permutations are \((1,2,3)\), \((2,3,1)\), and \((3,1,2)\). The odd permutations are \((3,2,1)\), \((2,1,3)\), and \((1,3,2)\). Substituting their products into the formula gives the familiar six-term expression, with the positive and negative groups kept visibly separate.

$$ \det\begin{bmatrix}a_{11}&a_{12}&a_{13}\\a_{21}&a_{22}&a_{23}\\a_{31}&a_{32}&a_{33}\end{bmatrix} = \left(a_{11}a_{22}a_{33}+a_{12}a_{23}a_{31}+a_{13}a_{21}a_{32}\right) - \left(a_{13}a_{22}a_{31}+a_{12}a_{21}a_{33}+a_{11}a_{23}a_{32}\right). $$

For example, \((2,3,1)\) has two inversions, since \(2>1\) and \(3>1\), so its term is positive. The tuple \((3,2,1)\) has three inversions, so its term is negative. Counting inversions directly is a dependable method when a permutation is not immediately recognizable.

Worked Example: A \(3\times3\) Determinant by Sign Groups

Evaluate the determinant, grouping the terms by permutation sign.

$$ \det\begin{bmatrix}1&2&3\\0&1&4\\5&6&0\end{bmatrix}. $$

The three even permutations contribute \(1\cdot1\cdot0=0\), \(2\cdot4\cdot5=40\), and \(3\cdot0\cdot6=0\). The three odd permutations contribute \(3\cdot1\cdot5=15\), \(2\cdot0\cdot0=0\), and \(1\cdot4\cdot6=24\). Therefore

$$ \det\begin{bmatrix}1&2&3\\0&1&4\\5&6&0\end{bmatrix} =(0+40+0)-(15+0+24)=40-39=1. $$

Check: Expanding along the first row, using the cofactor expansion method, gives \(1(1\cdot0-4\cdot6)-2(0\cdot0-4\cdot5)+3(0\cdot6-1\cdot5)=-24+40-15=1\), in agreement.

Finding the Surviving Terms for a \(4\times4\) Matrix

A direct \(4\times4\) calculation has 24 possible products, but zeros can rule out most of them. In a permutation tuple, every column number must appear exactly once. To find the nonzero terms, list the available columns in each row, then retain only the tuples that make a valid permutation. For each surviving tuple, count its inversions before evaluating the product.

Worked Example: A Sparse \(4\times4\) Determinant

Evaluate

$$ \det\begin{bmatrix}1&2&0&1\\0&1&3&0\\2&0&1&1\\1&0&0&2\end{bmatrix}. $$

Row 1 can use columns \(1,2,4\); row 2 can use columns \(2,3\); row 3 can use columns \(1,3,4\); and row 4 can use columns \(1,4\). Requiring each column to occur exactly once leaves only four tuples: \((1,2,3,4)\), \((4,2,3,1)\), \((2,3,1,4)\), and \((2,3,4,1)\). Every other permutation selects a zero entry in at least one row.

The tuple \((1,2,3,4)\) has no inversions, so its contribution is \(1\cdot1\cdot1\cdot2=2\). The tuple \((4,2,3,1)\) has five inversions: the \(4\) precedes three smaller entries, and both \(2\) and \(3\) precede the final \(1\). Its contribution is therefore negative: \(-\bigl(1\cdot1\cdot1\cdot1\bigr)=-1\). The tuple \((2,3,1,4)\) has two inversions, so its contribution is \(2\cdot3\cdot2\cdot2=24\). The tuple \((2,3,4,1)\) has three inversions, so its contribution is \(-\bigl(2\cdot3\cdot1\cdot1\bigr)=-6\). Summing these contributions gives

$$ \det\begin{bmatrix}1&2&0&1\\0&1&3&0\\2&0&1&1\\1&0&0&2\end{bmatrix} =2-1+24-6=19. $$

Check: Expanding along row 2, whose entries are \(0,1,3,0\), gives the \(3\times3\) determinants \(\det\begin{bmatrix}1&0&1\\2&1&1\\1&0&2\end{bmatrix}=2-1=1\) and \(\det\begin{bmatrix}1&2&1\\2&0&1\\1&0&2\end{bmatrix}=-6\). The row-2 signs are positive for column 2 and negative for column 3, so the result is \(1-3(-6)=19\), as calculated from permutations.

Theorem: To compute a determinant by the Leibniz formula, it is valid to omit exactly those permutations whose selected product contains a zero, and then sum the remaining products with their permutation signs.

Proof. The Leibniz formula includes one term for every permutation in \(S_n\). Each permutation chooses exactly one column in each row, and because it is a permutation, the chosen columns are all distinct and together use every column exactly once. Thus the formula accounts for every allowed selection once and only once. If a selected product contains a zero entry, the product is zero and contributes nothing to the sum. Every other term must be included with the sign specified by that permutation. Removing only zero terms therefore leaves the determinant unchanged, which justifies the procedure. \(\square\)

Symbolic Entries and Cancellation

Permutation terms can also be useful when entries contain a parameter. In that setting, careful grouping matters because terms may cancel. The calculation still follows the same rule: write each product, assign its sign, and only then collect like terms.

Worked Example: A Parameter in a \(3\times3\) Matrix

Evaluate the determinant as a function of \(t\in\mathbb{R}\).

$$ \det\begin{bmatrix}1&1&1\\1&1+t&1\\1&1&1+t\end{bmatrix}. $$

The even-permutation terms are \(1\cdot(1+t)\cdot(1+t)=(1+t)^2\), \(1\cdot1\cdot1=1\), and \(1\cdot1\cdot1=1\). The odd-permutation terms are \(1\cdot(1+t)\cdot1=1+t\), \(1\cdot1\cdot(1+t)=1+t\), and \(1\cdot1\cdot1=1\). Hence

$$ \det\begin{bmatrix}1&1&1\\1&1+t&1\\1&1&1+t\end{bmatrix} =(1+t)^2+1+1-(1+t)-(1+t)-1. $$

Expanding \((1+t)^2=1+2t+t^2\), the expression becomes \(1+2t+t^2+2-2-2t-1=t^2\). Check: Expansion along the first row gives \(\bigl((1+t)^2-1\bigr)-\bigl((1+t)-1\bigr)+\bigl(1-(1+t)\bigr) =(2t+t^2)-t-t=t^2\).

When Is the Formula Practical?

The number of terms grows as \(n!\): there are \(6\) terms for a \(3\times3\) matrix, \(24\) for a \(4\times4\) matrix, and \(120\) for a \(5\times5\) matrix. This rapid growth limits the usefulness of listing every term for larger matrices. Even for a \(4\times4\) matrix, writing out all 24 products can be cumbersome when most entries are nonzero.

Direct permutation evaluation is most practical when the matrix is small or when zeros leave only a few possible nonzero products. For a \(3\times3\) matrix, all six terms are usually manageable. For a sparse \(4\times4\) matrix, first identifying the feasible permutations can make the calculation shorter and easier to audit. When a row or column has few nonzero entries, cofactor expansion—studied earlier—may be more efficient. The key is to choose a method that reduces the work without losing track of the signs.

Common mistake: assigning a sign by appearance. In the first worked example, the permutation \((3,2,1)\) has three inversions, so its term \(3\cdot1\cdot5=15\) must be subtracted. If it is mistakenly added, the calculation becomes \(40+15-24=31\), not \(1\). Counting the inversions gives the correction: three is odd, so the term has sign \(-1\). A useful check is to group all terms first and then verify that each permutation’s sign agrees with its inversion count.

Check Your Understanding

Use the Leibniz formula in each question, keeping the permutation signs visible.

  1. For the permutation \((3,1,2)\), count the inversions and state its sign.
  2. Write the six signed terms in the Leibniz formula for a general \(3\times3\) matrix.
  3. For the matrix in the sparse \(4\times4\) worked example, explain why \((1,2,3,4)\) contributes a nonzero term.
  4. How many even and odd permutations are there in \(S_4\)?
  5. For which matrix sizes is direct listing of every permutation term most practical, and why does sparsity help?

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