# Descent sets of a permutation and its inverse: almost every pair occurs, f(n) ~ 4^(n-1)

iis:2612.00867 · by devsingh-lab · https://isitsolved.com/journal/58750ef9901f

**Abstract.** MathOverflow 486548 (Stanley; IIS-L-27146): f(n) counts pairs (S,T) of subsets of {1..n-1} with D(w) = S and D(w^-1) = T for some w in S_n. An answer in the thread shows every pair with |S| = |T| occurs, giving f(n) >= 4^(n-1)/n^2 and L = lim f(n)^(1/n) = 4. We prove more: if 1 <= |S| <= |T|, d = |T| - |S|, T has at least d+1 runs of consecutive integers and S has at least 2d+1, then the pair occurs. Both sets are realised by standard Young tableaux of the common shape (n-|T|, d+1, 1^(|S|-1)), written down explicitly as lattice words, and Robinson-Schensted gives w. Consequently all but an exponentially small fraction of the 4^(n-1) pairs occur, so f(n) ~ 4^(n-1). The construction is verified by direct computation for every qualifying pair with n <= 9 and for random pairs up to n = 400. Open: an exact description of the pairs that occur.

# Descent sets of a permutation and its inverse: almost every pair occurs

**Result.** $f(n)=4^{n-1}(1-O(e^{-cn}))$, via an explicit sufficient condition on $(S,T)$. Strengthens the known $f(n)\ge 4^{n-1}/n^2$. Written proof with an exhaustive computer check for $n\le 9$; not machine-checked in Lean.


On [MathOverflow question 486548](https://mathoverflow.net/questions/486548) (Richard Stanley,
2025).

For a permutation $w=a_1a_2\cdots a_n$ let $D(w)=\{i : a_i>a_{i+1}\}$ be its descent set. Let
$f(n)$ be the number of pairs $(S,T)$ of subsets of $\{1,\dots,n-1\}$ such that some $w\in S_n$
has $D(w)=S$ and $D(w^{-1})=T$. Stanley asks what can be said about $f(n)$, and in particular
for $L=\lim f(n)^{1/n}$. Trivially $f(n)\le 4^{n-1}$.

**Already known.** An answer in the thread shows that every pair with $|S|=|T|$ occurs, which
gives $4^{n-1}/n^2\le f(n)$ and so $L=4$.

**Result here.** Almost every pair occurs:

$$f(n)=4^{n-1}\bigl(1-O(e^{-cn})\bigr)\quad\text{for some } c>0,\qquad\text{so } f(n)\sim 4^{n-1}.$$

This follows from an explicit sufficient condition. A *run* of a set is a maximal block of
consecutive integers in it; write $r(S)$ for the number of runs.

**Theorem.** Let $S,T\subseteq\{1,\dots,n-1\}$ with $1\le |S|\le |T|$ and put $d=|T|-|S|$. If

$$r(T)\ \ge\ d+1\qquad\text{and}\qquad r(S)\ \ge\ 2d+1,$$

then there is a $w\in S_n$ with $D(w)=S$ and $D(w^{-1})=T$. (By passing to $w^{-1}$ the same
holds with $S$ and $T$ exchanged.) For $d=0$ this is the known case $|S|=|T|$.

## Proof

**Reduction to tableaux.** Under the Robinson–Schensted correspondence $w\mapsto(P,Q)$ one has
$D(w)=D(Q)$ and $D(w^{-1})=D(P)$, where a descent of a standard Young tableau is an $i$ such
that $i+1$ lies in a lower row than $i$ (Stanley, *Enumerative Combinatorics* vol. 2,
Lemma 7.23.1 and Theorem 7.13.1). Since every pair of standard tableaux of the same shape
arises, it is enough to find two standard tableaux of one shape with descent sets $S$ and $T$.

**Tableaux as words.** A standard tableau is the same thing as a word
$\rho(1)\rho(2)\cdots\rho(n)$, where $\rho(k)$ is the row containing $k$, in which every prefix
has at least as many $j$'s as $(j+1)$'s. Then $i$ is a descent exactly when
$\rho(i+1)>\rho(i)$.

We use the shape with first row $n-|T|$, second row $d+1$, and then $|S|-1$ rows of length
one. In a word of this shape the letters $3,4,5,\dots$ each occur once, in increasing order;
call them *leg letters*.

**The word for $T$.** Let $X$ be the set of first elements of the first $d+1$ runs of $T$. Put
$\rho(1)=1$, and for $1\le i<n$:

- $\rho(i+1)=2$ if $i\in X$;
- $\rho(i+1)=$ the next unused leg letter if $i\in T\setminus X$;
- $\rho(i+1)=1$ if $i\notin T$.

If $i\in X$ then $i-1\notin T$, so $\rho(i)=1$ and the step $1\to2$ goes up. A leg letter is
larger than everything before it, so those steps go up. Steps to $1$ do not go up. So the
descent set is $T$. Each $2$ is directly preceded by its own $1$, and the first leg letter comes
after the first $2$, so the prefix condition holds. There are $d+1$ twos and
$|T|-d-1=|S|-1$ leg letters.

**The word for $S$.** Let $i_1$ be the least element of $S$. For each run of $S$ with last
element $e\le n-2$, call the position $e+2$ a *slot*. There are at least $r(S)-1\ge 2d$ slots;
mark the last $d$ of them. Put $\rho(1)=1$, and for $1\le i<n$:

- $\rho(i+1)=2$ if $i=i_1$;
- $\rho(i+1)=$ the next unused leg letter if $i\in S$, $i\ne i_1$;
- $\rho(i+1)=2$ if $i\notin S$ and $i+1$ is a marked slot;
- $\rho(i+1)=1$ otherwise.

Steps from $i\in S$ go up as before. For a marked slot $e+2$: the letter at $e+1$ is a $2$ or
a leg letter (because $e\in S$), so the step $e+1\to e+2$ does not go up, as required since
$e+1\notin S$. The step out of a slot goes to a leg letter if the slot is in $S$ and to $1$
otherwise (two slots are never adjacent), which is correct in both cases. So the descent set
is $S$. Prefix condition: before any marked slot there is the $1$ at position $1$ and at
least $d$ unmarked slots, each carrying a $1$, while the word contains only $d+1$ twos in
total. The first leg letter comes after the $2$ at position $i_1+1$. There are $d+1$ twos and
$|S|-1$ leg letters, the same shape as for $T$. ∎

## Why almost every pair occurs

Choose $S,T$ independently and uniformly. Then $|S|,|T|$ are binomial with mean $(n-1)/2$,
so $d\le n/20$ outside an event of probability $e^{-cn}$. The number of runs is
$r(S)=\#\{i: i\in S,\ i-1\notin S\}$; the indicators for odd $i$ are independent with mean
$1/4$, and likewise for even $i$, so $r(S)\ge n/8$ and $r(T)\ge n/8$ outside an event of
probability $e^{-cn}$. For $n\ge 40$ these give $r\ge 2d+1$, so the theorem applies. Hence
all but an exponentially small fraction of the $4^{n-1}$ pairs occur.

## Check it

    python construct.py 9

For every pair meeting the hypotheses with $n\le 9$ (16,749 pairs at $n=9$), the script builds
the two words, turns them into tableaux, applies the inverse Robinson–Schensted map, and
checks $D(w)=S$ and $D(w^{-1})=T$ directly. It then does the same for random pairs with
$n=30, 100, 400$; at $n=400$, 299 of 300 random pairs meet the hypotheses.

## Scope and prior work

- The condition is sufficient, not necessary: at $n=9$ it accounts for 20,630 of the
  $f(9)=38{,}724$ pairs. An exact description of the pairs that occur is still open, as is
  the exact size of $4^{n-1}-f(n)$.
- $L=4$ and the case $|S|=|T|$ are from the existing answer in the thread (posted with AI
  assistance, by user jvvk). The values $f(1),\dots,f(13)$ are in
  [OEIS A380394](https://oeis.org/A380394). We found no earlier statement that
  $f(n)\sim 4^{n-1}$ (thread, OEIS entry, 4 Dec 2026).
- Checked by the exhaustive computation above; the proof has not had a second reader and is
  not formalised in Lean.

Produced with an AI assistant: Claude (Anthropic) found the construction and wrote the proof
and the check.

