An Experimental (yet fully rigorous!) Study of a certain “Measure Of Disarray” that 12-year Noga Alon Proved was always Even

Shalosh B. EKHAD and Doron ZEILBERGER

Abstract: We study in depth a certain permutation statistic that was the subject of a brilliant insight by 12-year-old Noga Alon. Our approach is purely empirical and experimental, yet it is fully rigorous, thereby debunking, yet another time, the myth that mathematics is always a deductive science.

Maple package

This article is accompanied by a Maple package, Noga12.txt, available free of charge from

https://sites.math.rutgers.edu/~zeilberg/tokhniot/Noga12.txt .

The front of this article

https://sites.math.rutgers.edu/~zeilberg/mamarim/mamarimhtml/noga12.html ,

contains numerous output files that will be referred to later on.

Preface: How it all started

In a beautiful new “coffee table book”, “Do not Erase” [W], by the very talented artistic photographer Jessica Wynne, there are pictures of more than one hundred blackboards by a very diverse set of mathematicians. One of them is Noga Alon’s blackboard. Each blackboard photo is accompanied by a short essay by the creator of the blackboard, where they often describe how they decided to become mathematicians. According to Noga Alon, the epiphany occurred when he was twelve years old. Here are his exact words ([W], p. 52):

“One aspect of mathematics that always fascinated me is its objectivity. When I was twelve

years old, my parents had friends during the Eurovision song contest. They amused themselves by trying to guess the final results of the contest, which are determined by the votes of the participating countries - they agreed on a formula (which I am not including here) for computing the score for each guest given the end results, and when the results were announced, they found out that all the scores were even integers. This led to a discussion about whether this must always be the case. My mother (who had excellent mathematical intuition) thought that it was indeed the case, but one of the guests, who was an engineer, insisted that this wasn’t so. Since they were unable to agree, my mother suggested asking me. Although I was quite young, she knew that I liked mathematics and believed that I would be able to settle the question. I thought about the problem and realized that, indeed, the score must always be even.

The main reason that I remember the story, however, is not because I was able to find a proof, but because I managed to show the engineer that he was wrong. The fact that a twelve-year-old can convince a grown engineer about such a statement is an impressive demonstration of the objective nature of mathematics.”

We were intrigued, and sent Noga Alon the following email message.

I recently bought a beautiful book ``Do not Erase", by Jessica Wynne, and was pleased
to see that one of the blackboards is yours (btw, my Rutgers colleague, Jeff Kahn,
should be honored that he made it to your blackboard!).
I also liked very much the accompanying essay where you mentioned how, when you were
twelve-year-old, you managed to convince a grown-up engineer that he was wrong re-
garding a certain score related to the Eurovision contest.
What was the actual problem?  What was your proof?

Shortly after, Noga replied:

The details are as follows:  Each participant guessed a ranking of all countries, and
the score of his/her guess was the sum, over all countries, of the absolute value of
the difference between the guessed rank of each country and its final rank.  The ques-
tion the guests of my parents had was whether or not the score must always be even.
To show that indeed the score must be even note that the guessed ranking is a per-
mutation sigma of the numbers from 1 to n, (if there are n countries).  The final rank-
ing is also a permutation pi of these numbers.  The score is
(1) sum over i of | sigma(i)- pi (i)|
But if we forget the absolute values then clearly
sum over i of (sigma (i)-pi (i))=0 (which is even)
and whenever we change a number (sigma (i)-pi (i)) to its absolute value | sigma(i)-
pi (i)| we change the sum by an even number, showing that (1) is also even.
Not very deep, but as far as I remember I was quite happy noticing it, especially since
it has been simple enough and could be explained to pretty much anybody who is will-
ing to listen.

The Eurovision-Alon-Party ‘Measure of Disarray’ was first invented in 1910

This got us intrigued. We first realized that it is natural to make one of the permutations the identity permutation. In other words rename the countries participating in the contest by their ranking, so the natural quantity, that we named na(π) (in honor of Noga Alon), may be defined on a permutation π = [π_{1}, …, π_{n}] of {1, …, n} as follows:

na(π) := ∑_{i=1}^{n} |π_{i} − i| .

Obviously this is a measure of ‘how scrambled’ the permutation is. This is what our dear friend Dominique Foata calls a permutation statistic, a central object in enumerative combinatorics. But we never saw it before! Indeed the annoying absolute value was dissonant to our mathematical ear.

Nevertheless we started to investigate more closely this measure of disarray. In particular we found the first ten moments, as explicit expressions in n, and proved that the scaled moments (see below) tend, as n goes to infinity, to those of the standard normal distribution N (0, 1) (i.e 1, 0, 3, 0, 15, 0, 105, 0, 945), indicating that it is, most probably, asymptotically normal (and we rigorously proved it for the first 10 moments, also see below).

Before going public, we thought it prudent to email the great maven, Persi Diaconis. On Aug 26, 2021, 12:42 PM, one of us (DZ) sent him an email that included the following questions (regarding Noga Alon parents’ permutation statistic):

(i) Have this permutation statistic been considered before by statisticians?
(ii) Is it known, or easily follows from general theorems, that it is asymptotically
normal?
(Shalosh can prove that the scaled moments converge to those of N(0,1) up to the tenth
moment).

25 minutes later (Aug 26, 2021, 1:07 PM), we got the following reply:

Hi Doron,
Statisticians call this statistic `spearman's footrule'.  Spearman was a psycholo-
gist who used it around 1910.  And indeed I (personally) proved the limiting normal-
ity in a paper with Ron Graham (metrics on permutations).  I think that someone like
Hausdorff (or Hurwitz) figured out the first two moments for Spearman.  You might take
a look at chapter 6 of my book which discusses other metrics and their limiting nor-
mality.  It would be interesting to know the higher moments since one can use them
to get 'Edgeworth corrections' to the CLT ...
Best wishes, Hope this helps.
Persi Diaconis

We immediately looked up the paper that Persi Diaconis wrote with Ron Graham [DG], and found out that they used human ingenuity to figure out the expectation and variance. They also applied a general deep theorem of Hoeffding to prove asymptotic normality.

In this paper we do the following two feats.

• Derive experimentally (yet rigorously) explicit expressions for the first ten moments (about the mean), thereby giving a partial (but fully elementary) proof of the asymptotic normality (proving that the scaled moments of Spearman’s footrule converge to those of the standard normal distribution, \frac{1}{\sqrt{2π}} ∫_{−∞}^{∞} x^{r} e^{−x^{2}/2} dx, for 3 ≤ r ≤ 10).

• Derive experimentally (yet rigorously) explicit expressions for many mixed moments with the more famous (and much more user-friendly) ‘measure if disarray’, Netto’s number of inversions, and partially prove (by the method of moments) that these two permutation statistics are jointly normal, but, not surprisingly, not independently so (unlike the pair (Number of Inversions, Major Index), see [BZ]). In fact we will prove that the asymptotic correlation between these two permutation statistics is \frac{3}{\sqrt{10}}, and partially prove (by the method of moments) that the limiting distribution is bi-normal with that correlation, in other words, that the bi-variate pdf is

\frac{1}{2 \sqrt{10} π} · e^{− \frac{x^{2}}{2} − \frac{y^{2}}{2} + \frac{3}{\sqrt{10}} xy} .

A Quick Reminder about Weight-Enumerators and Probability Generating Functions of Discrete Random Variables Defined on Finite Sets, and how to Extract moments from them

Let A be a finite set and f(a) some numerical attribute, called random variable (a very bad name!). We are interested in the average, variance, and higher moments of f(a) over the population A, assuming that we draw an element of A uniformly at random. The weight-enumerator according to f(a) is the polynomial

∑_{a∈A} q^{f(a)} ,

and to get the probability generating function, we simply divide by the number of elements of A. Calling that polynomial F_{A}(q), we have:

F_{A}(q) := \frac{1}{|A|} ∑_{a∈A} q^{f(a)} .

It is called the probability generating function since the coefficient of q^{i} is the probability that the value of f(a), where a is drawn uniformly-at-random from A, happens to be i.

In terms of F_{A}(q) we can easily get the expectation, μ := E[f], variance, m_{2}(f) := E[(f − μ)^{2}], and, more generally, for r > 2, the so-called r^{th} moment (about the mean), m_{r}(f) := E[(f − μ)^{r}], as follows.

μ = F′_{A}(1) ,

and

m_{r}(A) = (q \frac{d}{dq} )^{r} \frac{F_{A}(q)}{q^{μ}} |_{q=1} .

Often we have an infinite family of natural sets, parameterized by positive integer n (in this paper, the set of permutations on {1, …, n}) and then we are interested in explicit expressions, in n, for the expectation, variance, and as many higher moments that we can get. See [Z], [BZ], and [CJZ] for nice examples.

How to get Explicit expressions to as many as possible moments of Spearman’s Footrule?

For the much more user-friendly permutation statistic inv, defined by

inv(π) := ∑_{1≤i<j≤n}[π_{i} > π_{j}] ,

where [statement] is 1 or 0 according to whether it is true or false, respectively, we have a beautiful, closed-form expression for the weight-enumerator, that goes back (at least) to Netto:

∑_{π∈S_{n}} q^{inv(π)} = 1 · (1 + q) ⋯ (1 + q + … + q^{n−1}) = ∏_{i=1}^{n} \frac{1 − q^{i}}{1 − q} .

This was treated (in the more general context of words) in [CJZ], but later we found out, thanks to Persi Diaconis, (see the erratum to [CJZ]) that this was ‘old hat’. Nevertheless the approach in [CJZ], of using symbolic computation to find explicit expressions for many moments, was novel, and gave a new, alternative, elementary proof of this classical theorem.

We don’t have this luxury for Spearman’s footrule, since the weight-enumerator does not seem to have a nice formula. Nevertheless, it is easy to see that for any r, the moment (and hence moment about the mean), is some polynomial, and it is also easy to bound its degree. So if we can compute many terms of the sequence of generating functions, let’s call it N_{n}(q)

N_{n}(q) := ∑_{π∈S_{n}} q^{na(π)} ,

we can use the above process to get the moments numerically for sufficiently many n, and finally fit them with the appropriate polynomial.

If we had unlimited computer time and space, we can go as far as we wish by pure brute force. For example for finding the covariance (and hence correlation) of the pair of permutation statistics (inv, maj) (where maj is the so-called major index), it worked very well. See [E], [K1], and [K2], Ex. 5.1.1.26).

Indeed, for any given n, there are only finitely many permutations of length n, so we can find N_{n}(q) directly for any n. Alas, this is not very feasible starting at n = 11. So we need to be more clever.

Let’s write the permutation π in two-line-notation.

( \begin{matrix}1 & 2 & 3 & … & n \\ π_{1} & π_{2} & π_{3} & … & π_{n} \end{matrix} ) .

Obviously

na ( \begin{matrix}1 & 2 & 3 & … & n \\ π_{1} & π_{2} & π_{3} & … & π_{n} \end{matrix} ) = |π_{1} − 1| + na ( \begin{matrix}2 & 3 & … & n \\ π_{2} & π_{3} & … & π_{n} \end{matrix} ) .

So, in order to use dynamical programming, we are forced to consider a more general creature

N(S_{1}, S_{2})(q) := ∑_{π∈F UN(S_{1},S_{2})} q^{na(π)} ,

where S_{1} is a set of consecutive integers, and S_{2} is an arbitrary set of integers of the same cardinality, and F UN(S1, S2) is the set of all one-to-one functions from S_{1} to S_{2}.

The dynamical programming natural recurrence is

N ({r, r + 1, r + 2, ..., r + k − 1} , {a_{1}, …, a_{k}}) =

∑_{i=1}^{k} q^{|r−a_{i}|} · N({r + 1, r + 2, ..., r + k − 1}, {a_{1}, …, a_{k}}\{a_{i}}) .

This is implemented in procedure NPg in the Maple package Noga12.txt. Of course, at the end of the day, we only care about

N({1, 2, 3, ..., n}, {1, 2, 3, ..., n}) ,

alias N_{n}(q). This is procedure NPc(n,q). Procedure NP(n,q) does the same thing, straight from the definition, and of course should only be used for small n (up to n = 9) in order to check the correctness of the ‘clever’ procedure NPc. Note that it still uses exponential time and memory, but 2^{n} is much smaller than n!, and we were able to compute the first 25 terms of N_{n}(q). See the output file

https://sites.math.rutgers.edu/~zeilberg/tokhniot/oNoga12c.txt .

It is easy to see that the expectation, variance, and higher moments (about the mean) , are polynomials in n. In fact that r-th moment about the mean has degree ⌊\frac{3r}{2} ⌋ in the variable n. Diaconis and Graham used human ingenuity to prove that

μ = \frac{(n − 1)(n + 1)}{3}

σ^{2} = \frac{(n + 1) (2n^{2} + 7)}{45} ,

but did not derive higher moments. Using our experimental-yet-rigorous method, we derived explicit expressions for all the moments up to the 10^{th}.

m_{3} = −\frac{2 (n + 2) (n + 1) (2n^{2} + 31)}{945}

m_{4} = \frac{(n + 1) (28n^{5} + 180n^{3} + 160n^{2} + 887n + 1265)}{4725}

m_{5} = −\frac{4 (n + 2) (n + 1) (44n^{5} − 10n^{4} + 788n^{3} + 86n^{2} + 3587n + 8555)}{93555}

m_{6} = \frac{(n + 1)}{127702575}·

(168168n^{8} − 145288n^{7} + 1800148n^{6} + 2180892n^{5} + 18508182n^{4} + 32547228n^{3}
+112117257n^{2} + 385870348n + 368963105) .

For explicit expressions for m_{7}, m_{8}, m_{9} and m_{10} see the output file

https://sites.math.rutgers.edu/~zeilberg/tokhniot/oNoga12a.txt .

From these expressions, Maple (and even you!) can compute the limits of the scaled moments about the mean, _{\frac{m_{r}}{m_{2}^{r/2}}} , and see that for 3 ≤ r ≤ 10 they coincide with those of the standard normal distribution N (0, 1) (namely 0, 3, 0, 15, 0, 105, 0, 945), giving ample evidence that Spearman’s footrule is asymptotically normal, and rigorously proving it up to the 10^{th} moment. Of course, as mentioned above this was already proved, fully, by Persi Diaconis in his joint paper with Ron Graham [DG], but he used ‘fancy stuff’.

How does Spearman’s Footrule “interact” with Netto’s number of inversions

The dynamical programming recurrence that enabled us to compute the first 25 terms of the sequence of weight-enumerators N_{n}(q) can be easily modified to compute many terms of the bivariate polynomial, let’s call it S_{n}(p, q)

S_{n}(p, q) := ∑_{π∈S_{n}} p^{inv(π)}q^{na(π)} ,

see procedure NPcJ(n,p,q) in our Maple package. This enabled us to compute the first 22 terms, that can be viewed in the following output file

https://sites.math.rutgers.edu/~zeilberg/tokhniot/oNoga12d.txt .

From these we immediately derived, by the same empirical method, the covariance

\frac{(n + 1) · (n^{2} + 1)}{30} ,

from which followed that the asymptotic correlation is \frac{3}{\sqrt{10}}, and we derived the mixed moments, m_{r,s} := E[(inv − μ_{inv})^{r}(na − μ_{na})^{s}] for all r + s ≤ 8.

To see them for 1 ≤ r, s ≤ 4 see the output file

https://sites.math.rutgers.edu/~zeilberg/tokhniot/oNoga12b.txt ,

from which it followed that the scaled mixed moments (at least for r + s ≤ 8) tend to those of the bi-variate normal distribution with the above-mentioned correlation, namely the one whose joint pdf (probability density function) is

\frac{1}{2 \sqrt{10} π} · e^{− \frac{x^{2}}{2} − \frac{y^{2}}{2} + \frac{3}{\sqrt{10}} xy} .

This gives ample evidence that it is true for all mixed moments, and that, in turn, would conclusively prove (using the method of moments) that the pair (inv, na) is jointly asymptotically normal with correlation \frac{3}{\sqrt{10}}. We are wondering whether Persi Diaconis, or any of his disciples, can prove this fact with their heavy machinery.

Postscript (written Oct. 4, 2021). After the first version was posted, and one of (DZ) gave a talk about it at the Rutgers Experimental Mathematics Zoom seminar, Stoyan Dimitrov pointed our attention to a very interesting paper

“The generating function for total displacement” by T. Kyle Petersen and Mathieu Guay-Paquet (Elec. J. Combinatorics 21 (2014))

https://arxiv.org/pdf/1404.4674.pdf ,

that enables a much faster computation of the weight-enumerators N_{n}(q). Their approach enables a fast computation of what we called N_{n}(q) for 1 ≤ n ≤ 50, that can be gotten by typing

SeqF(n,50),

in the new version of our Maple package, where we added a new procedure, SeqF, implementing their nice approach (using weighed Motzkin paths, and the implied ‘infinite’ continued fraction). Using this more extensive data set, we were able to find the first 19 moments, see the new output file:

https://sites.math.rutgers.edu/~zeilberg/tokhniot/oNoga12e.txt .

We also learned, thanks to that paper, that Spearman’s footrule is mentioned in Knuth’s magnumopus [K2], as exercise 5.1.1.28. Also Martin Rubey pointed out that nowadays one does not have to bother Persi Diaconis, all one has to do is consult the wonderful website https://www.findstat.org/ . See his following insightful message:

https://sites.math.rutgers.edu/~zeilberg/mamarim/mamarimhtml/MartinRubeyComments.pdf

Of related interest is the following interesting paper: ‘Moments of permutation statistics and central limit theorems’, by Stoyan Dimitrov and Niraj Khare, available from

https://arxiv.org/abs/2109.09183 .

PostPostscript (written Oct. 7, 2021): We now read the above mentioned lovely article by T. Kyle Petersen and Mathieu Guay-Paquet more carefully, and realized that using the continued fraction, while very elegant, is not the most efficient way to generated many terms of {N_{n}(q)}. What we called before SeqF(q,N) (to generate the first N terms of that sequence) has been now renamed SeqFcf(q,N), and the new procedure, SeqF(q,N), uses the fact that N_{n}(q) = F (n, 0) where F (a, b) is the weight enumerators of truncated Motzkin paths (with their weight), that terminate at the point (a, b).

It is easy to see (once Petersen and Guay-Paquet introduced their beautiful approach) that, F (a, b) satisfies the dynamical programming recurrence (but no longer exponential time and memory, but only quadratic time and memory):

F (a, b) = q^{2b} ( (b + 1)F (a − 1, b + 1) + bF (a − 1, b − 1) + (2b + 1)F (a − 1, b) ) ,

subject to the initial condition F (0, 0) = 1 and the boundary condition F (a, b) = 0 if b < 0.

PostPostPostscript (written Oct. 14, 2021): T. Kyle Petersen kindly told us (private communication) how to q-analogize (but we use p for inversions here) the above recurrence to efficiently compute what we call above S_{n}(n, p, q). Definte G(a, b) to be the polynomials in (p, q) satisfying the recurrence

G(a, b) = (pq^{2})^{b} ( [b + 1]G(a − 1, b + 1) + [b]G(a − 1, b − 1) + ([b] + [b + 1])F (a − 1, b) ) ,

subject to the initial condition G(0, 0) = 1 and the boundary condition G(a, b) = 0 if b < 0.

Here (as usual) [b] = 1 + p + … + p^{b−1}. Then S_{n}(p, q) = G(n, 0).

This is now implemented in procedure SeqFg. For example to get the first 22 terms, type Se-

qFg(p,q,22);.

References

[BZ] Andrew Baxter and Doron Zeilberger, The Number of Inversions and the Major Index of Permutations are Asymptotically Joint-Independently-Normal (Second Edition), The Personal Journal of Shalosh B. Ekhad and Doron Zeilberger. Feb. 4, 2011.

https://sites.math.rutgers.edu/~zeilberg/mamarim/mamarimhtml/invmaj.html . Also pub-
lished in https://arxiv.org/abs/1004.1160.

[CJZ] E. Rodney Canfield, Svante Janson, and Doron Zeilberger, The Mahonian probability distribution on words IS asymptotically normal, Adv. Appl. Math. 46 (2011), 109-124.

https://sites.math.rutgers.edu/~zeilberg/mamarim/mamarimhtml/mahon.html .

Erratum:

https://sites.math.rutgers.edu/~zeilberg/mamarim/mamarimPDF/mahonerratum.pdf .

[DG] Persi Diaconis and Ron Graham, Spearman’s Footrule as a Measure of Disarray,Journal of the Royal Statistical Society: Series B (Methodological) 39 (1977), 262-268.

[E] Shalosh B. Ekhad, The joy of brute force: the covariance of the major index and the number of inversions, Personal Journal of S. B. Ekhad and D. Zeilberger, , ca. 1995.

https://sites.math.rutgers.edu/~zeilberg/mamarim/mamarimhtml/brute.html

[K1] Donald E. Knuth, Letter to Doron Zeilberger, May 16, 1995.

https://sites.math.rutgers.edu/~zeilberg/mamarim/mamarimhtml/dkMay95.pdf .

[K2] Donald E. Knuth, The Art of Computer Programming, Volume 3, Sorting and Searching, Second Edition, Addison-Wesley, 1998.

[W] Jessica Wynne, “Do Not Erase, Mathematicians and their chalkboard”, Princeton University Press, 2021.

[Z] Doron Zeilberger, HISTABRUT: A Maple Package for Symbol-Crunching in Probability theory, The Personal Journal of Shalosh B. Ekhad and Doron Zeilberger, Aug. 25, 2010.

https://sites.math.rutgers.edu/~zeilberg/mamarim/mamarimhtml/histabrut.html . Also
published in: https://arxiv.org/abs/1009.2984 .

Shalosh B. Ekhad and Doron Zeilberger, Department of Mathematics, Rutgers University (New Brunswick), Hill Center-Busch Campus, 110 Frelinghuysen Rd., Piscataway, NJ 08854-8019, USA.

Email: [ShaloshBEkhad, DoronZeil] at gmail dot com .

Exclusively published in the Personal Journal of Shalosh B. Ekhad and Doron Zeilberger and arxiv.org

First Written: Sept. 29, 2021. Second version: (thanks to Stoyan Dimitrov and Martin Rubey): Oct. 4, 2021. Third version: Oct. 7, 2021 . This version (thanks to T. Kyle Petersen): Oct. 14, 2021 .