A closed formula for maximally inflected permutations
For a permutation \(\pi=(\pi_1,\ldots,\pi_n)\) of \([n]=\{1,\ldots,n\}\), the second difference at centre \(i\) is \(\Delta_i=\pi_{i-1}-2\pi_i+\pi_{i+1}\), for \(2\le i\le n-1\). An inflection is a pair of centres \((p,q)\) with opposite nonzero signs and zero second differences at every centre strictly between them. Rojas Kirby and Smit Vega Garcia show that a permutation has the maximum of \(n-3\) inflections exactly when its second differences alternate strictly in sign. After tabulating the counts for \(n=4,\ldots,11\), they ask for a closed formula for the number \(|\mathcal M_n|\) of such permutations. A finite, nonrecursive sum of explicit matrix powers gives the count for every \(n\ge4\). *Inflection sets of permutations*, §6, Theorem 6.4(c)–(d) and the question immediately before Remark 6.6 PDF, p. 32 For each nonempty subset \(S\subseteq[n]\) and allowed sign set \(U\subseteq\{-1,0,1\}\), define a matrix with rows and columns indexed by ordered pairs in \(S^2\) by \[(P_U(S))_{(a,b),(d,c)}=\mathbf 1_{\{b=d\}}\,\mathbf 1_{\{\operatorname{sgn}(a-2b+c)\in U\}}. \] An indicator \(\mathbf 1_{\{E\}}\) equals one when \(E\) holds and zero otherwise. The sign function takes the values \(-1,0,1\) on negative, zero and positive inputs, respectively. Use the actual integer values in \(S\), including when there are gaps between them. Write \(P_+(S)=P_{\{1\}}(S)\), \(P_-(S)=P_{\{-1\}}(S)\), and let \(\mathbf 1\) be the all-ones column vector of length \(|S|^2\). With \(h=\lfloor(n-2)/2\rfloor\) and \(\varepsilon=n-2-2h\), the closed count is \[|\mathcal M_n|=2\sum_{\varnothing\ne S\subseteq[n]}(-1)^{n-|S|}\,\mathbf 1^{\mathsf T}(P_+(S)P_-(S))^hP_+(S)^\varepsilon\mathbf 1. \] Here \(\mathsf T\) denotes transpose and a zeroth matrix power is the identity. The factor two accounts for the two starting signs, which are exchanged by replacing each value \(x\) with \(n+1-x\). The counts at \(n=12\) and \(n=13\) are 13,401,092 and 119,433,016, respectively. For arbitrary allowed sign sets \(U_i\) at the successive centres, the same construction gives the number of permutations satisfying all the sign restrictions: \[W_n(U_2,\ldots,U_{n-1})=\sum_{\varnothing\ne S\subseteq[n]}(-1)^{n-|S|}\,\mathbf 1^{\mathsf T}\left(\prod_{i=2}^{n-1}P_{U_i}(S)\right)\mathbf 1, \] where the product is in increasing order of \(i\). The matrix product counts length-\(n\) words over \(S\), allowing repeated values. Inclusion–exclusion gives each word with set of values \(T\) total weight \(\sum_{S\supseteq T}(-1)^{n-|S|}\) over subsets of \([n]\). This weight is one when \(T=[n]\) and zero otherwise, so the surviving words use every value exactly once. Both sums can be evaluated in \(O(n^3 2^n)\) integer arithmetic operations using \(O(n^2)\) stored integers of \(O(n\log n)\) bits each. For one matrix factor, keep the pair weights and form prefix sums over the sorted predecessor values \(a\) for each fixed \(b\). At the output pair \((b,c)\), the negative, zero and positive contributions use \(a<2b-c\), \(a=2b-c\) and \(a>2b-c\), respectively. As \(c\) runs through the sorted subset, the cut-offs move monotonically. This gives \(O(|S|^2)\) operations per factor and allows the subsets to be processed one at a time. To count permutations with a given nonempty inflection set at a fixed size \(n\ge4\), order its \(m\) pairs by their first centre. The count is zero unless they satisfy \[2\le p_1<q_1\le p_2<q_2\le\cdots\le p_m<q_m\le n-1. \] Start with current sign \(+1\). At each \(p_j\), require the current sign. Require zero strictly between \(p_j\) and \(q_j\), then reverse the current sign and require it at \(q_j\). At all other centres, allow zero or the current sign. If two consecutive pairs share an endpoint, its two requirements agree. With these choices of \(U_i\), the count is \(2W_n(U_2,\ldots,U_{n-1})\), since complementation exchanges the two possible first nonzero signs. For the empty set, the count is \(2W_n(\{0,1\},\ldots,\{0,1\})-2\), with \(n-2\) identical sign sets. This combines the all-nonnegative and all-nonpositive cases and subtracts the double count of the increasing and decreasing permutations, the only two with every second difference zero. A positive count decides realisability at the specified size. Admissibility in §3 of the original paper quantifies over all ambient sizes.
Authors
- Zixuan He
Institutions
- University of Glasgow (GB)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-12-03
- DOI
- https://doi.org/10.5281/zenodo.24798636
- Primary Topic
- Advanced Combinatorial Mathematics
- Type
- preprint