The expected variation of random bounded integer sequences of finite length

From the enumerative generating function of an abstract adjacency statistic, we deduce the mean and variance of the variation on random permutations, rearrangements, compositions, and bounded integer sequences of finite length.


Introduction
When the finite sequence of integers w = 1, 3, 2, 2, 4, 3 is sketched as below, its most compelling aspect is its vertical variation, that is, the sum of the vertical distances between its adjacent terms. Denoted by var w, the vertical variation of the sequence in Diagram 1 is var w = 2 + 1 + 0 + 2 + 1 = 6. Our purpose here is to compute the mean and variance of var on four classical sets of combinatorial sequences.
To formalize matters and place our problem in the context of other work, let [m] n denote the set of sequences w = x 1 x 2 . . . x n of length n with each  Some specializations of the f -adjacency number have been considered elsewhere. For instance, if f (xy) is 1 when x < y and 0 otherwise, then adf w is known as the rise number of w [1,3,4]. For the selection f (xy) = |y − x|, adf w = var w. In a sorting problem of computer science, Levcopoulos and Petersson [5] introduced the related notion of oscillation (var w − n + 1) as a measure of the presortedness of a sequence of n distinct numbers. In [6], compositions were enumerated by their ascent variation, the f -adjacency statistic induced by f (xy) = y − x if x < y and 0 otherwise. For the case f (xy) = h(|y − x|) where h is a linear, convex, or concave increasing realvalued function, Chao and Liang [2] described the arrangements of n distinct integers for which adf achieves its extreme values.
Besides considering the distribution of var on the set [m] n , we also consider it on the set of rearrangements R n (i 1 , i 2 , . . . , i m ) consisting of sequences of length n = i 1 + i 2 + · · · + i m which contain l exactly i l times, on the set of permutations S n = R n (1, 1, . . . , 1) of {1, 2, . . . , n}, and on the set of compositions of m into n parts C n (m) = {x 1 x 2 . . . x n ∈ [m] n : x 1 +x 2 +. . .+x n = m}. For m, n ≥ 2, Table 1 displays the mean and variance of var on these four sets. The k th falling factorial of n is n k = n(n−1) · · · (n−k+1), i = (i 1 , i 2 , . . . , i m ), and, for r a real number, r denotes the greatest integer less than or equal to r. The results in Table 1 are new. David and Barton [3, ch. 10] present the distributions of several statistics (some f -adjacency numbers, some not) primarily on permutations. We also note that Tiefenbruck [7] derived a generating function for compositions with bounded parts by a close relative of var. We leave open questions concerning the asymptotic behavior of var.

Enumerative factorial moments for f -adjacencies
Before working specifically with var, we discuss the enumerative generating function for adf on sequences as developed by Fedou and Rawlings [4]. Let [m] * denote the set of sequences of 1, 2, . . . , m of finite length (including the empty sequence of length 0).
By manipulating G(p), we will obtain all of the information in Table 1 (and more). As a brief outline of our approach, note that the coefficient of . . z im m in G (1) by the cardinality of R n ( i), we will obtain the mean of adf. So, in general, we compute the dth enumerative factorial moment From the work of Fedou and Rawlings [4], it follows that where Examples are presented in [4,6] for which D has a closed form. We do not know of a closed form for D when adf = var (that is, when f (x, y) = |y − x|). Nevertheless, (1) is still useful in computing the mean and variance of var. Although the formula for taking the d-fold derivative with respect to p of a function of the form in (1) is known, we provide a short derivation. To avoid the quotient and chain rule, rewrite (1) as GD = 1. Differentiating the latter d times, d ≥ 1, and dividing by d! gives To solve for G (d) , consider the system where the top d equations arise from repeated application of (3). Cramer's rule applied to the above system yields which, when expanded, implies To determine the enumerative factorial moment G (d) (1), we see from (2) that For instance, Further setting j = (j 1 , . . . , j ν ), s( j) = j 1 + · · · + j ν , it follows from (4) and (5) that As D(1) = 1 − (z 1 + · · · + z m ), extracting the contributions made by all w ∈ [m] n from both sides of (7) gives the dth enumerative factorial moment of adf over [m] n as valid for d ≥ 1. When d = 1, 2, (6) and (8) imply that and that (10) 3 Discussion of Table 1 The entries in Table 1 are consequences of (9) and (10)   Then, subbing the last result into and simplifying gives the variance of var as recorded in Table 1.
For R n ( i), extracting the coefficient of z i 1 1 z i 2 2 · · · z im m from (9) leads to As the cardinality of R n ( i) is it follows that the mean of var on R n ( i) is Let i \r = (i 1 , . . . , i r − 1, . . . , i n ). For example, (3, 2, 1, 4) \3\2\3 = (3, 1, −1, 4). The variance on R n ( i) is then where, upon extraction of the coefficient of z i 1 1 z i 2 2 · · · z im m from (10), we have The permutation entries in Table 1 follow from (11) and (12). Selecting m = n and i k = 1 for 1 ≤ k ≤ n in (11) reveals the mean of var on S n as From (13)  So the variance of var on S n is 90 .
For w = x 1 . . . x n ∈ [m] n , let ||w|| = x 1 + · · · + x n . For the composition results in Table 1, set z k = q k for 1 ≤ k ≤ m. Then (9) implies that and (10) leads to 1≤v,x,y≤m |x − v||y − x| q v+x+y Extracting the coefficient of q m from (14) to obtain and then dividing by the cardinality m−1 n−1 of C n (m) gives the mean of var as stated in Table 1 The sums in (17)  As a part of the second sum on the righthand side of (17), we note that The four-fold sums arising in the last sum in (17) reduce to double sums.