Artificial intelligent assistant

Expectation of the distance difference. We have a $17$ people siting at the vertices of a big circular table with a constant distance between every two neighbour. After an hour they are rearranged. We choose arbitrary two people. Let $X$ be a (positive) difference between their distances before and after rearrangement. How to calculate expectation of $X$? Note that maximum distance is 8. I was thinking about to express $X$ with $X_i$ which is $1$ if the difference is $i$ and else $0$. So $$X = X_1+...+X_8$$ and thus $$ E(X) = E(X_1)+...+E(X_8)$$ But how to calculate $E(X_i)$?

Assuming that distances before and after rearrangement are independent, one can compute it by brute force.

Considering the possible changes of the distance one can compile the following table: $$ \begin{array} \Delta X& N_X & \text{Example}\\\ 7& 2 & 1\leftrightarrow 8\\\ 6& 4 & 1\leftrightarrow 7, 2\leftrightarrow 8\\\ \vdots&\vdots&\vdots\\\ 1& 14 & 1\leftrightarrow 2, 2\leftrightarrow 3, \dots, 7\leftrightarrow 8\\\ 0& 8 & 1\leftrightarrow 1, 2\leftrightarrow 2, \dots, 8\leftrightarrow 8\\\ \end{array} $$

Then the expectation value is: $$ E(X)=\frac{\sum_X X N_X}{\sum_X N_X}=\frac{21}{8}. $$

Essentially $N_X$ is the number of cells in the $X$-th super- and subdiagonals of the $8\times8$ matrix with $X$ being the "distance" of these diagonals from the main one.

The above result can be readily generalized on arbitrary odd number $2n+1$ of person: $$ E(X)=\frac{2\sum_{i=0}^{n-1}(n-i)i}{n^2}=\frac{n^2-1}{3n}. $$

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy c28113c2ec9af46012d1f30dbc5776dd