Skip to main content

MA 415G course notes

Section 2.7 Permutations: Inversions and Descents

A fundamental question about a permutation is to ask how much the permutation is "out of order" from the identity \(1234\cdots n\text{.}\) One of the approaches to answering this question is to consider when a pair of entries in the one-line notation for the permutation are reversed in order. This leads to the idea of an inversion.

Definition 2.7.1.

Let \(\pi=\pi_1\pi_2\cdots\pi_n\) be a permutation. If \(i \lt j\) and \(\pi_i \gt \pi_j\text{,}\) then we say that \((\pi_i,\pi_j)\) is an inversion in \(\pi\text{.}\) Let \(\Inv(\pi)\) denote the set of inversions in \(\pi\text{.}\)

Checkpoint 2.7.2.

List all the inversions in \(\pi=38162745\text{.}\) How many inversions are there?

Checkpoint 2.7.3.

What is the largest possible number of inversions for a permutation in \(\ss_n\text{?}\)
The number of permutations in \(\ss_n\) with \(k\) inversions can be computed recursively as follows.

Checkpoint 2.7.5.

Proof.

The base cases \(I(0,0)\) is defined to be \(1\text{,}\) and \(I(n,0)=1\text{,}\) and \(I(n,k)=0\) for \(k\lt 0\) and \(k\gt \binom{n}{2}\) follow directly from the definition of inversion. To prove the recurrence, observe that every permutation in \(\ss_n\) is obtainable from a permutation \(\pi\in\ss_{n-1}\) by inserting \(n\) at some point in the one-line representation of \(\pi\text{.}\) Inserting \(n\) at the end of \(\pi\) adds \(0\) inversions. Inserting \(n\) one place from the end adds \(1\) inversion. Similarly, inserting \(n\) to the position \(i\) places from the end adds \(i\) inversions. In order to obtain a permutation with \(k\) inversions, one must insert \(n\) to the position \(i\) places from the end in a permutation \(\pi\in\ss_{n-1}\) with \(k-i\) inversions. The recursion counts the number of such permutations for each \(i\text{.}\)

Checkpoint 2.7.6.

Discuss this proof. What makes sense? Why? What are points of confusion? What is the source of the confusion?
Using inversions, we can encode a permutation in a new way as a vector in
\begin{equation*} T_n:= [0,n-1]\times [0,n-2]\times \cdots \times [0,1]\times \{0\} \, . \end{equation*}

Definition 2.7.7.

Let \(I:\ss_n \to T_n\) be the map that sets \(I(\pi):=a\) where \(a_i\) is the number of entries to the left of \(i\) that are greater than \(i\text{,}\) when using the one-line notation for \(\pi\) . Equivalently, \(a_i\) is the number of pairs in \(\Inv(\pi)\) with second entry \(i\text{.}\) We call \(I(\pi)\) the inversion table for \(\pi\text{.}\)

Checkpoint 2.7.8.

Verify that the inversion table for \(\pi=2413\) is \((2,0,1,0)\text{.}\)

Checkpoint 2.7.9.

What is the inversion table for \(\pi=38162745\text{?}\) Remember that the inversion table is a vector.

Proof.

We first show that \(I^{-1}\) exists. Given a vector \((a_i,a_2,\ldots,a_n)\in T_n\text{,}\) we first write \(n\) by itself. Second, we place \(n-1\text{,}\) where if \(a_{n-1}=0\) then we place it before \(n\text{,}\) and if \(a_{n-1}=1\) then we place it after \(n\text{.}\) Continue in this way, where we inductively assume that \(n,n-1,n-2,n-3,\ldots,n-i+1\) have all been placed in such a way that the partially constructed word has inversions counted by \(a_{n-i+1},\ldots,a_n\text{.}\) Next, insert \(n-i\) so that there are \(a_{n-i}\) elements in the word (so far) to its left.
By construction, we have that this map sends \(a\) to a permutation \(\pi\) with \(I(\pi)=a\text{.}\) To see that \(I^{-1}\) is one-to-one, note that if \(a\neq b\text{,}\) then some \(a_i\neq b_i\text{.}\) Thus, \(n-i\) is placed in a different order relative to \(n,n-1,n-2,n-3,\ldots,n-i+1\) for the two corresponding permutations. Thus, those permutations are different, and hence \(I^{-1}\) is one-to-one and well-defined. Since \(|T_n|=n!=|\ss_n|\text{,}\) it follows that \(I\) is a bijection.

Checkpoint 2.7.11.

Apply the algorithm described in the proof above to the inversion table \((0,3,3,3,2,1,0)\text{.}\) (You should get the permutation \(1765234\text{.}\))

Checkpoint 2.7.12.

Discuss the proof above. What are points of confusion? What does or does not make sense in the proof?
A special type of inversion occurs when the entries of the permutation are next to each other.

Definition 2.7.13.

For a permutation \(\pi\in \ss_n\text{,}\) if \(\pi_i\gt \pi_{i+1}\text{,}\) then we say there is a descent in position \(i\text{.}\) The set of descent positions is denoted \(\Des(\pi)\text{.}\) The number of descents in \(\pi\) is denoted \(\des(\pi):=|\Des(\pi)|\text{.}\)
The number of permutations in \(\ss_n\) with \(k\) descents is called the \((n,k)\)-Eulerian number and is denoted \(A(n,k)\text{.}\)

Checkpoint 2.7.14.

Find \(\Des(\pi)\) and \(\des(\pi)\) for \(\pi=38162745\text{.}\)

Checkpoint 2.7.15.

Find the following Eulerian numbers: \(A(3,0), A(3,1), A(3,2)\text{.}\)

Proof.

It is immediate that \(A(n,0)=1=A(n,n-1)\) for \(n\geq 1\) because the only permutation with \(0\) descents is the identity and the only permutation with \(n-1\) descents is the reverse of the identity, i.e., the identity permutation written backwards.
To see that the recurrence holds, we consider what happens when we start with a permutation \(\pi\in \ss_n\) with \(k\) descents and remove \(n\) from the permutation. If \(\pi_i=n\text{,}\) then one of three situations can occur. The first possibility is that \(\pi_{i-1}\gt \pi_{i+1}\text{,}\) in which case removing \(n\) results in a permutation \(\pi'\in \ss_{n-1}\) with \(k\) descents. The second possibility is that \(\pi_{i-1}\lt \pi_{i+1}\text{,}\) in which case removing \(n\) results in a permutation \(\pi'\in \ss_{n-1}\) with \(k-1\) descents. The third possibility is that \(n\) occurs at either the beginning or end of the word, in which case removing \(n\) either decreases the number of descents by one or leaves it the same, respectively.
The proof proceeds by reversing this observation. For each permutation in \(\ss_{n-1}\) with \(k\) descents, inserting \(n\) in the "middle" of a descent or at the end of the permutation creates a permutation in \(\ss_n\) with \(k\) descents, and there are \(k+1\) ways to insert \(n\) into such a permutation. For each permutation in \(\ss_{n-1}\) with \(k-1\) descents, inserting \(n\) either at the beginning of the word or in the middle of an ascending pair adds a new descent, creating a permutation in \(\ss_n\) with \(k\) descents. The recurrence follows.

Checkpoint 2.7.17.