Problem (Combinatorics):
A permutation of a list of numbers is an ordered arrangement of the numbers in that list. For example, $3,2,4,1,6,5$ is a permutation of $1,2,3,4,5,6$. We can write this permutation as $a_{1}, a_{2}, a_{3}, a_{4}, a_{5}, a_{6}$, where $a_{1}=3, a_{2}=2, a_{3}=4, a_{4}=1, a_{5}=6$, and $a_{6}=5$.
Determine the average value of

$$
\left|a_{1}-a_{2}\right|+\left|a_{3}-a_{4}\right|+\cdots+\left|a_{197}-a_{198}\right|+\left|a_{199}-a_{200}\right|
$$

over all permutations $a_{1}, a_{2}, a_{3}, \ldots, a_{199}, a_{200}$ of $1,2,3,4, \ldots, 199,200$. (The sum labelled (*) contains 100 terms of the form $\left|a_{2 k-1}-a_{2 k}\right|$.)

Solution:
There are 200! permutations of $1,2,3, \ldots, 198,199,200$.

We determine the average value of

$$
\left|a_{1}-a_{2}\right|+\left|a_{3}-a_{4}\right|+\cdots+\left|a_{197}-a_{198}\right|+\left|a_{199}-a_{200}\right|
$$

over all of these permutations by determining the sum of all 200! values of this expression and dividing by $200 !$.

Then, we let $s_{1}$ be the sum of the values of $\left|a_{1}-a_{2}\right|$ in each of these expressions, $s_{2}$ be the sum of the values of $\left|a_{3}-a_{4}\right|$, and so on.

The sum of the 200 ! values of $(*)$ equals $s_{1}+s_{2}+\cdots+s_{99}+s_{100}$.

By symmetry, $s_{1}=s_{2}=\cdots=s_{99}=s_{100}$.

Therefore, the average value of $(*)$ equals $\frac{100 s_{1}}{200 !}$. So we need to determine the value of $s_{1}$.

Suppose that $a_{1}=i$ and $a_{2}=j$ for some integers $i$ and $j$ between 1 and 200, inclusive.

There are 198! permutations with $a_{1}=i$ and $a_{2}=j$ because there are still 198 choices for $a_{3}, 197$ choices for $a_{4}$, and so on.

Similarly, there are 198! permutations with $a_{1}=j$ and $a_{2}=i$.

Since $|i-j|=|j-i|$, then there are 2(198!) permutations with $\left|a_{1}-a_{2}\right|=|i-j|$ that come from $a_{1}$ and $a_{2}$ equalling $i$ and $j$ in some order.

Therefore, we may assume that $i>j$ and note that $s_{1}$ equals 2(198!) times the sum of $i-j$ over all possible pairs $i>j$.

(Note that there are $\left(\begin{array}{c}200 \\ 2\end{array}\right)=\frac{200(199)}{2}$ choices for the pair of integers $(i, j)$ with $i>j$. For each of these choices, there are 2(198!) choices for the remaining entries in the permutation, which gives $\frac{200(199)}{2} \cdot 2(198 !)=200(199)(198 !)=200$ ! permutations, as expected.)

So to determine $s_{1}$, we need to determine the sum of the values of $i-j$.

We calculate this sum, which we call $D$, by letting $j=1,2,3, \ldots, 198,199$ and for each of these, we let $i$ be the possible integers with $j<i \leq 200$ :

$$
\begin{aligned}
D & =(2-1)+(3-1)+(4-1)+\cdots+(197-1)+(198-1)+(199-1)+(200-1) \\
& +(3-2)+(4-2)+(5-2)+\cdots+(198-2)+(199-2)+(200-2) \\
& +(4-3)+(5-3)+(6-3)+\cdots+(199-3)+(200-3) \\
& \vdots \\
& +(199-198)+(200-198) \\
& +(200-199) \\
& =199(1)+198(2)+197(3)+\cdots+2(198)+1(199) \quad \quad \quad \text { grouping by columns }) \\
& =199(200-199)+198(200-198)+197(200-197)+\cdots+2(200-2)+1(200-1) \\
& =200(199+198+197+\cdots+3+2+1)-\left(199^{2}+198^{2}+197^{2}+\cdots+3^{2}+2^{2}+1^{2}\right) \\
& =200 \cdot \frac{1}{2}(199)(200)-\frac{1}{6}(199)(199+1)(2(199)+1) \\
& =100(199)(200)-\frac{1}{6}(199)(200)(399) \\
& =199(200)\left(100-\frac{133}{2}\right) \\
& =199(200) \frac{67}{2}
\end{aligned}
$$

Therefore, $s_{1}=2(198 !) D=2(198 !) \cdot \frac{199(200)(67)}{2}=67(198 !)(199)(200)=67(200 !)$.

Finally, this means that the average value of $(*)$ is $\frac{100 s_{1}}{200 !}=\frac{100(67)(200 !)}{200 !}=6700$.



We note that we have used the facts that, if $n$ is a positive integer, then

- $1+2+\cdots+(n-1)+n=\frac{1}{2} n(n+1)$
- $1^{2}+2^{2}+\cdots+(n-1)^{2}+n^{2}=\frac{1}{6} n(n+1)(2 n+1)$

Using sigma notation, we could have calculated $D$ as follows:

$$
\begin{aligned}
D & =\sum_{i=2}^{200} \sum_{j=1}^{i-1}(i-j) \\
& =\left(\sum_{i=2}^{200} \sum_{j=1}^{i-1} i\right)-\left(\sum_{i=2}^{200} \sum_{j=1}^{i-1} j\right) \\
& =\left(\sum_{i=2}^{200} i(i-1)\right)-\left(\sum_{i=2}^{200} \frac{1}{2}(i-1) i\right) \\
& =\left(\sum_{i=2}^{200} i(i-1)\right)-\frac{1}{2}\left(\sum_{i=2}^{200}(i-1) i\right) \\
& =\frac{1}{2}\left(\sum_{i=2}^{200}(i-1) i\right) \\
& =\frac{1}{2}\left(\sum_{i=1}^{200}(i-1) i\right) \\
& =\frac{1}{2}\left(\sum_{i=1}^{200}\left(i^{2}-i\right)\right) \\
& =\frac{1}{2}\left(\sum_{i=1}^{200} i^{2}-\sum_{i=1}^{200} i\right) \\
& =\frac{1}{2}\left(\frac{1}{6}(200)(200+1)(2(200)+1)-\frac{1}{2}(200)(200+1)\right) \\
& =\frac{1}{2}(200)(201)\left(\frac{1}{6}(401)-\frac{1}{2}\right) \\
& =100(201) \cdot \frac{398}{6} \\
& =100(201) \cdot \frac{199}{3} \\
& =100(67)(199)
\end{aligned}
$$

which equals $199(200) \frac{67}{2}$, as expected.

Final answer: 6700