Subfield: Combinatorics


Question: An $\boldsymbol{n}$-label is a permutation of the numbers 1 through $n$. For example, $J=35214$ is a 5 -label and $K=132$ is a 3 -label. For a fixed positive integer $p$, where $p \leq n$, consider consecutive blocks of $p$ numbers in an $n$-label. For example, when $p=3$ and $L=263415$, the blocks are 263,634,341, and 415. We can associate to each of these blocks a $p$-label that corresponds to the relative order of the numbers in that block. For $L=263415$, we get the following:

$$
\underline{263} 415 \rightarrow 132 ; \quad 2 \underline{63415} \rightarrow 312 ; \quad 26 \underline{341} 5 \rightarrow 231 ; \quad 263 \underline{415} \rightarrow 213
$$

Moving from left to right in the $n$-label, there are $n-p+1$ such blocks, which means we obtain an $(n-p+1)$-tuple of $p$-labels. For $L=263415$, we get the 4 -tuple $(132,312,231,213)$. We will call this $(n-p+1)$-tuple the $\boldsymbol{p}$-signature of $L$ (or signature, if $p$ is clear from the context) and denote it by $S_{p}[L]$; the $p$-labels in the signature are called windows. For $L=263415$, the windows are $132,312,231$, and 213 , and we write

$$
S_{3}[263415]=(132,312,231,213)
$$

More generally, we will call any $(n-p+1)$-tuple of $p$-labels a $p$-signature, even if we do not know of an $n$-label to which it corresponds (and even if no such label exists). A signature that occurs for exactly one $n$-label is called unique, and a signature that doesn't occur for any $n$-labels is called impossible. A possible signature is one that occurs for at least one $n$-label.

In this power question, you will be asked to analyze some of the properties of labels and signatures.


We can associate a shape to a given 2-signature: a diagram of up and down steps that indicates the relative order of adjacent numbers. For example, the following shape corresponds to the 2-signature $(12,12,12,21,12,21)$ :

<img_3144>



A 7-label with this 2-signature corresponds to placing the numbers 1 through 7 at the nodes above so that numbers increase with each up step and decrease with each down step. The 7-label 2347165 is shown below:

<img_3777>
For a general $n$, determine the number of distinct possible $p$-signatures.

Solution:
The answer is $p ! \cdot p^{n-p}$.

Call two consecutive windows in a $p$-signature compatible if the last $p-1$ numbers in the first label and the first $p-1$ numbers in the second label (their "overlap") describe the same ordering. For example, in the $p$-signature $(. ., 2143,2431, \ldots), 2143$ and 2431 are compatible. Notice that the last three digits of 2143 and the first three digits of 2431 can be described by the same 3-label, 132 .

Theorem: A signature $\sigma$ is possible if and only if every pair of consecutive windows is compatible.

Proof: $(\Rightarrow)$ Consider a signature $\sigma$ describing a $p$-label $L$. If some pair in $\sigma$ is not compatible, then there is some string of $p-1$ numbers in our label $L$ that has two different $(p-1)$-signatures. This is impossible, since the $p$-signature is well-defined.

$(\Leftarrow)$ Now suppose $\sigma$ is a $p$-signature such that that every pair of consecutive windows is compatible. We need to show that there is at least one label $L$ with $S_{p}[L]=\sigma$. We do so by induction on the number of windows in $\sigma$, using the results from $5(\mathrm{~b})$.

Let $\sigma=\left\{\omega_{1}, \omega_{2}, \ldots, \omega_{k+1}\right\}$, and suppose $\omega_{1}=a_{1}, a_{2}, \ldots, a_{p}$. Set $L_{1}=\omega_{1}$.

Suppose that $L_{k}$ is a $(p+k-1)$-label such that $S_{p}\left[L_{k}\right]=\left\{\omega_{1}, \ldots, \omega_{k}\right\}$. We will construct $L_{k+1}$ for which $S_{p}\left[L_{k+1}\right]=\left\{\omega_{1}, \ldots, \omega_{k+1}\right\}$.

As in $5(\mathrm{~b})$, denote by $L_{k}^{(j)}$ the label $L_{k}$ with a $j+0.5$ appended; we will eventually renumber the elements in the label to make them all integers. Appending $j+0.5$ does not affect any of the non-terminal windows of $S_{p}\left[L_{k}\right]$, and as $j$ varies from 0 to $p-k+1$ the final window of $S_{p}\left[L_{k}^{(j)}\right]$ varies over each of the $p$ windows compatible with $\omega_{k}$. Since $\omega_{k+1}$ is compatible with $\omega_{k}$, there exists some $j$ for which $S_{p}\left[L_{k}^{(j)}\right]=\left\{\omega_{1}, \ldots, \omega_{k+1}\right\}$. Now we renumber as follows: set $L_{k+1}=S_{k+p}\left[L_{k}^{(j)}\right]$, which replaces $L_{k}^{(j)}$ with the integers 1 through $k+p$ and preserves the relative order of all integers in the label.

By continuing this process, we conclude that the $n$-label $L_{n-p+1}$ has $p$-signature $\sigma$, so $\sigma$ is possible.

To count the number of possible $p$-signatures, we choose the first window ( $p$ ! choices), then choose each of the remaining $n-p$ compatible windows ( $p$ choices each). In all, there are $p ! \cdot p^{n-p}$ possible $p$-signatures.

Final answer: $p ! \cdot p^{n-p}$