---
title: Stanley Length in Permutations and Modules
url: https://www.emergentmind.com/topics/stanley-length
type: topic
---

# Stanley Length in Permutations and Modules

Stanley length is a term used in more than one mathematical sense. In probabilistic combinatorics, it denotes the length of the largest alternating subsequence of a uniformly random permutation, a statistic attached to Richard Stanley’s work on alternating subsequences and later discussed under the ironic label “Stanley distribution” [1001.3899]. In commutative algebra, a 2025 paper introduced Stanley length as a new invariant of a finitely generated multigraded module, defined as the minimal number of Stanley spaces in a Stanley decomposition and denoted \(\operatorname{slength}(M)\) [2507.17935]. Earlier commutative-algebra papers also used “length-type” language for Stanley decompositions in a different way, namely for the parameter \(\min_i |Z_i|\) that leads to Stanley depth rather than to the number of summands [1508.07540].

## 1. Terminological scope

The expression has no single universal meaning across the literature. The main uses represented in current arXiv work are summarized below.

| Context | Object | Definition |
|---|---|---|
| Random permutations | \(X_n\) | Length of the largest alternating subsequence of a random permutation |
| Multigraded modules | \(\operatorname{slength}(M)\) | Minimal number of Stanley spaces in a Stanley decomposition |
| Older commutative-algebra usage | “length-type” parameter | Usually \(\min_i |Z_i|\), hence Stanley depth |

In the probabilistic setting, the term refers to a concrete random variable on \(\mathfrak S_n\). In the algebraic setting, it is an invariant built from all possible Stanley decompositions of a module. This suggests that context is indispensable: without it, “Stanley length” can denote either a subsequence statistic or a decomposition invariant.

## 2. The random-permutation meaning

Let \(\mathfrak S_n\) be the set of permutations of \(\{1,2,\dots,n\}\) with the uniform distribution. For \(\pi \in \mathfrak S_n\), an alternating, or up–down, subsequence is a subsequence
\[
\pi_{i_1},\pi_{i_2},\dots,\pi_{i_k}\qquad (1\le i_1<\cdots<i_k\le n)
\]
whose inequalities alternate in direction. In the convention used in "A Note on the Stanley Distribution" [1001.3899], the alternation starts with “up”:
\[
\pi_{i_1}<\pi_{i_2}>\pi_{i_3}<\pi_{i_4}>\cdots.
\]
Any fixed choice of starting with \(<\) or \(>\) leads to an equivalent asymptotic theory.

The corresponding Stanley length is the random variable
\[
X_n := \max\{k : \text{there exists an alternating subsequence of }\pi\in\mathfrak S_n\text{ of length }k\}.
\]
For \(n\ge 4\), Stanley’s analysis yields exact formulas for the expectation and variance:
\[
\mu_n=\mathbb E[X_n]=\frac{2n+1}{3},\qquad
\sigma_n^2=\operatorname{Var}(X_n)=\frac{8}{45}n-\frac{13}{180}.
\]
With the normalization
\[
Z_n=\frac{X_n-\mu_n}{\sigma_n},
\]
one has convergence in distribution
\[
Z_n \Rightarrow \mathcal N(0,1)
\]
as \(n\to\infty\). Equivalently, the raw moments
\[
\alpha_k(Z_n):=\mathbb E[Z_n^k]
\]
converge to the moments of the standard normal law:
\[
\alpha_{2r}(Z_n)\to (2r-1)!!=\frac{(2r)!}{2^r r!},\qquad
\alpha_{2r+1}(Z_n)\to 0.
\]

This probabilistic Stanley length is therefore a permutation statistic with linear mean, linear variance, and Gaussian limit. In the note’s terminology, the limiting law of the standardized variable is the “Stanley distribution,” though the note explicitly presents that phrase with intended irony [1001.3899].

## 3. Refined asymptotics and probabilistic interpretation

The main refinement in Ekhad’s note is an explicit asymptotic expansion for the standardized moments of \(X_n\) [1001.3899]. For each integer \(r\ge 1\), the even moments satisfy
\[
\alpha_{2r}(Z_n)=\frac{(2r)!}{2^r r!}
\left(
1+\frac{1}{1764}\,\frac{r(r-1)(10r-713)}{n}
+O\!\left(\frac{1}{n^2}\right)
\right).
\]
Thus the Gaussian value \((2r-1)!!\) is approached with an explicit first-order correction of order \(1/n\).

For odd moments, the paper gives an expression with explicit leading constants and higher corrections, but the typed display is noted to be somewhat garbled. The structural content is clear: the leading term is of order \(n^{-1/2}\), the next correction is of order \(n^{-3/2}\), and overall
\[
\alpha_{2r+1}(Z_n)=O(n^{-1/2}).
\]
In summary,
\[
\alpha_{2r}(Z_n)=(2r-1)!!+O\!\left(\frac{r^3}{n}\right),\qquad
\alpha_{2r+1}(Z_n)=O\!\left(\frac{(2r)!}{\sqrt n}\right).
\]

Methodologically, the note sits on top of Stanley’s explicit bivariate generating function
\[
F(z,u)=\sum_{n\ge 0}\sum_k a_{n,k}u^k z^n,
\]
where \(a_{n,k}\) counts permutations of \([n]\) whose largest alternating subsequence has length \(k\). Differentiation in \(u\) yields generating functions for moments,
\[
M_r(z)=\frac{\partial^r}{\partial u^r}F(z,u)\Big|_{u=1}
=\sum_{n\ge 0}\mathbb E[X_n^r]\,n!\,z^n.
\]
Stanley’s asymptotic normality uses the Pemantle–Wilf generic normality theorem, while Ekhad’s refinements are produced with Zeilberger’s Maple package HISTABRUT, which automates coefficient asymptotics and the re-normalization needed for standardized moments. The note states that these formulas are not presented with full rigorous proofs but are “certainly rigorizable.”

A comparison emphasized in the note is with the longest increasing subsequence of a random permutation. For LIS, the Baik–Deift–Johansson theorem gives a Tracy–Widom limit, whereas the largest alternating subsequence has a Gaussian limit [1001.3899]. This places the probabilistic Stanley length in a markedly different universality class from LIS.

## 4. Stanley length as an invariant of multigraded modules

A distinct definition appears in "On the Stanley length of monomial ideals" [2507.17935]. Let
\[
S=K[x_1,\dots,x_n]
\]
with its standard \(\mathbb Z^n\)-grading, and let \(M\) be a finitely generated multigraded \(S\)-module. A Stanley space of \(M\) is a submodule of the form
\[
uK[Z],
\]
where \(u\in M\) is homogeneous, \(Z\subset\{x_1,\dots,x_n\}\), and \(uK[Z]\) is a free \(K[Z]\)-module. A Stanley decomposition is a direct sum
\[
\mathcal D:\quad M=\bigoplus_{i=1}^r u_iK[Z_i].
\]

For such a decomposition, the paper distinguishes two numerical parameters:
\[
\operatorname{slength}(\mathcal D):=r,\qquad
\operatorname{sdepth}(\mathcal D):=\min_{1\le i\le r}|Z_i|.
\]
The Stanley depth of \(M\) is the familiar maximal value of \(\operatorname{sdepth}(\mathcal D)\), while the new invariant is
\[
\operatorname{slength}(M):=\min\{\operatorname{slength}(\mathcal D):\mathcal D\text{ is a Stanley decomposition of }M\}.
\]
The paper explicitly describes the contrast as follows: \(\operatorname{sdepth}(M)\) is a “quality” invariant, whereas \(\operatorname{slength}(M)\) is a “quantity” invariant. A decomposition realizing one need not realize the other.

Several structural properties are established for \(\operatorname{slength}\). If
\[
0\to U\to M\to N\to 0
\]
is a short exact sequence of finitely generated multigraded modules, then
\[
\operatorname{slength}(M)\le \operatorname{slength}(U)+\operatorname{slength}(N).
\]
For a monomial \(u\in S\) and a monomial ideal \(I\subset S\),
\[
\operatorname{slength}(uI)=\operatorname{slength}(I).
\]
For a monomial ideal \(I\) and a monomial \(v\),
\[
\operatorname{slength}(I:v)\le \operatorname{slength}(I),
\]
with equality if \(I=v(I:v)\). Ring extension by a new variable does not change Stanley length:
\[
\operatorname{slength}(IS[x_{n+1}])=\operatorname{slength}(I).
\]

For monomial ideals \(I,J\subset S\), if
\[
r=\operatorname{slength}(I),\quad \bar r=\operatorname{slength}(S/I),\quad
s=\operatorname{slength}(J),\quad \bar s=\operatorname{slength}(S/J),
\]
then the paper proves
\[
\operatorname{slength}(I\cap J)\le rs,
\]
\[
\operatorname{slength}(I+J)\le \min\{r+s\bar r,\; s+r\bar s\},
\]
\[
\operatorname{slength}(S/(I+J))\le \bar r\bar s,
\]
and
\[
\operatorname{slength}(S/(I\cap J))\le \min\{\bar r+r\bar s,\; \bar s+s\bar r\}.
\]

The most basic lower bound is generator-counting. For any monomial ideal \(I\),
\[
\operatorname{slength}(I)\ge |G(I)|,
\]
where \(G(I)\) is the minimal monomial generating set. In particular,
\[
\operatorname{slength}(I)=1 \Longleftrightarrow I\text{ is principal.}
\]
If \(I=(u)\) is principal, then
\[
\operatorname{slength}(I)=1,
\qquad
\operatorname{slength}(S/(u))=\deg(u).
\]

The paper also gives an explicit two-variable formula. If
\[
I\subset K[x_1,x_2],\qquad
G(I)=\{x_1^{a_1}x_2^{b_1},\dots,x_1^{a_m}x_2^{b_m}\},
\]
with
\[
a_1>a_2>\cdots>a_m\ge 0,\qquad
0\le b_1<b_2<\cdots<b_m,
\]
then
\[
\operatorname{slength}(I)=
\min_{1\le i\le m}\{a_i+b_i-a_m-b_1\}+1.
\]

Finally, a general upper bound is obtained from Janet decomposition. Writing
\[
\alpha_k(I)=\max\{j:\; x_k^j\mid u\text{ for all }u\in G(I)\},\qquad
\beta_k(I)=\max\{j:\; x_k^j\mid u\text{ for some }u\in G(I)\},
\]
one has
\[
\operatorname{slength}(I)\le
\prod_{k=2}^n\bigl(\beta_k(I)-\alpha_k(I)+1\bigr).
\]

## 5. Linear quotients, squarefree interpretations, and structural results

One of the sharpest results in the 2025 framework concerns ideals with linear quotients [2507.17935]. A monomial ideal \(I\subset S\) has linear quotients if its minimal generators can be ordered
\[
u_1\le \cdots \le u_m
\]
so that each colon ideal
\[
(u_1,\dots,u_{j-1}):u_j
\]
is generated by variables. In that situation, there is a canonical Stanley decomposition
\[
I=u_1K[Z_1]\oplus u_2K[Z_2]\oplus\cdots\oplus u_mK[Z_m],
\]
and therefore
\[
\operatorname{slength}(I)=m=|G(I)|.
\]
Thus linear quotients imply minimal possible Stanley length.

The paper also proves a characterization via partial ideals. If \(I\) is minimally generated by \(\{u_1,\dots,u_m\}\), then the following are equivalent: there exists an order \(u_1\le\cdots\le u_m\) giving linear quotients, and for each \(j\) the partial ideal
\[
I_j=(u_1,\dots,u_j)
\]
admits a Stanley decomposition
\[
I_j=u_1K[Z_1]\oplus\cdots\oplus u_jK[Z_j].
\]
This gives a stepwise interpretation of minimal-length decompositions.

The converse “\(\operatorname{slength}(I)=|G(I)|\) implies linear quotients” is only partially valid. It holds when \(m\le 3\), and it also holds for monomial ideals in two variables. It fails in general: the paper gives the counterexample
\[
I=(x_1^2x_2,\; x_1^2x_3,\; x_1^2x_4,\; x_2x_3x_4)\subset K[x_1,x_2,x_3,x_4],
\]
for which
\[
\operatorname{slength}(I)=4=|G(I)|,
\]
but \(I\) does not have linear quotients.

In the squarefree setting, Stanley length admits a simplicial-combinatorial interpretation. For squarefree monomial ideals \(0\subset I\subsetneq J\subset S\), let
\[
\Delta(J/I)=\Delta(I)\setminus \Delta(J)
\]
be the associated relative simplicial complex. If
\[
\mathcal P:\quad \Delta(J/I)=\bigcup_{i=1}^r [F_i,G_i]
\]
is an interval partition, define \(\operatorname{slength}(\mathcal P)=r\). Then
\[
\operatorname{slength}(J/I)=\operatorname{slength}(\Delta(J/I)).
\]
Consequences include the trivial upper bound
\[
\operatorname{slength}(J/I)\le |\Delta(J/I)|
\]
and the lower bound that \(\operatorname{slength}(S/I)\) is at least the number of facets of \(\Delta(I)\).

The squarefree theory also interacts well with standard operations. Polarization cannot increase Stanley length:
\[
\operatorname{slength}(J/I)\ge \operatorname{slength}(J^p/I^p),
\]
and passing to radicals cannot increase it:
\[
\operatorname{slength}(J/I)\ge \operatorname{slength}(\sqrt J/\sqrt I).
\]
For symbolic powers of squarefree ideals,
\[
\operatorname{slength}(J^{(s)}/I^{(s)})\le \operatorname{slength}(J^{(ks)}/I^{(ks)})
\qquad (k,s\ge 1).
\]

## 6. Relation to Stanley depth and earlier commutative-algebra usage

Before \(\operatorname{slength}(M)\) was introduced as a separate invariant, commutative-algebra papers usually attached the word “length” to Stanley decompositions in a different way. For a decomposition
\[
\mathcal D:\quad M=\bigoplus_{i=1}^r m_iK[Z_i],
\]
the natural “length-type” parameter was
\[
\operatorname{sdepth}(\mathcal D)=\min_i |Z_i|,
\]
and the corresponding module invariant was
\[
\operatorname{sdepth}(M)=\max\{\operatorname{sdepth}(\mathcal D)\}.
\]
One paper states explicitly that this is “not usually called ‘Stanley length’ in the literature,” but that it is the basic size parameter of a decomposition [1508.07540]. Other papers likewise refer to Stanley depth as “Stanley length” in an older or alternative terminology [1401.1057].

This older usage is visible in explicit families. For the path ideal \(I_{n,m}\) of length \(m\) in the line graph \(L_n\), one has
\[
\operatorname{sdepth}(S/I_{n,m})=\operatorname{depth}(S/I_{n,m})
= n+1-\left\lfloor\frac{n+1}{m+1}\right\rfloor-\left\lceil\frac{n+1}{m+1}\right\rceil
\]
for all \(n\ge m\ge 1\) [1508.07540]. In the same older framework, quotients of complete intersection monomial ideals satisfy sharp lower and upper bounds for Stanley depth, and in important cases exact formulas, again treating \(\operatorname{sdepth}\) as the relevant Stanley-type length parameter [1210.2214].

The modern 2025 invariant therefore does not replace Stanley depth; it complements it. The distinction is sharp:
\[
\operatorname{sdepth}(M)\quad\text{maximizes a minimum dimension,}
\]
whereas
\[
\operatorname{slength}(M)\quad\text{minimizes the number of summands.}
\]
This terminological split suggests a stable conceptual division. In current usage, Stanley length either denotes the permutation statistic \(X_n\) of alternating subsequences [1001.3899] or the summand-count invariant \(\operatorname{slength}(M)\) [2507.17935], while older commutative-algebra usage often employed the phrase informally for Stanley depth or for the size parameter \(\min_i |Z_i|\) attached to a decomposition [1508.07540].

Source: https://www.emergentmind.com/topics/stanley-length