What is the value of $$\underset{\pi \in S_n}{\max} \biggl( \underset{1\leq i\leq n}{\sum} \big|i-\pi(i)\big|\biggr)\,,$$ where $S_n$ is the set of permutations of $(1,2,\ldots,n)$?
I can see that if $n$ is even,then we can achieve the sum to be $\frac{n^2}{2}$ by considering the following permutation:
Switch the following pairs $(1,\frac{n}{2}+1),(2,\frac{n}{2}+2),.......,(\frac{n}{2},n)$.
Can we go above $\frac{n^2}{2}$?
I am trying to decompose $\pi\in S_n$ as composition of transpositions or cycles and to observe how a particular transposition affects the sum.
Any help would be appreciated.Thanks in advance.
Start with your setup for even $n$ of two lists $$1: (1,n/2+1),(2,n/2+2),...,(n/2,n) \\ 2: (n/2+1,1),(n/2+2,2),...,(n,n/2)$$ for which the corresponding sum equals $n^2/2$. Any permutation within either list will lead to the same value $n^2/2$. For example in list 1 interchange $n/2+i$ and $n/2+j$ for some distinct $i,j=1,2,...,n/2$ which doesn't change $|n/2+i-j|+|n/2+j-i|=n$ while the other terms don't change. Permuting $n/2+i$ with $i=1,...,n/2$ from list 1 with $j=1,...,n/2$ from list 2 gives $|i-j|+|n/2+j-n/2-i|=2|i-j|<n$.
For odd $n$ you have the three lists $$1: (1,(n+1)/2+1),(2,(n+1)/2+2),...,((n-1)/2,n) \\ 2: ((n+1)/2,(n+1)/2) \\ 3: ((n+1)/2+1,1),((n+1)/2+2,2),...,(n,(n-1)/2)$$ which gives the sum $(n^2-1)/2$. As before permuting distinct elements $i,j=1,...,(n-1)/2$ within each list doesn't change the value. E.g. for list 1 we have: $|(n+1)/2+j-i|+|(n+1)/2+i-j|=n+1 \, .$ Permuting element $(n+1)/2+i$ from list 1 with $j$ from list 3 gives $|i-j|+|(n+1)/2+j-(n+1)/2-i|=2|i-j|<n+1 \, .$ Finally you can check that permuting elements from list 1 or 3 with the element of list 2 doesn't change the value e.g. take $(n+1)/2+i$ from list 1 reduces the sum of list 1 by $i$, but the value in list 2 increases to $i$.
Overall the maximum sum is $\left \lfloor \frac{n^2}{2} \right \rfloor$.