<s>[INST] Inversions of a Permutation Show that the largest number of inversions of a permutation of $\{1,2,3,4,5,6,7,8\}$ equals $n(n-1)/2$. Determine the unique permutation with $n(n-1)/2$ inversions. Also determine all those permutations with one fewer inversion. 
 [/INST] $\{8,7,6,5,4,3,2,1\}$ has $8(8-1)/2$ inversions.
The number of inversions is one less in the following permutations: $\{7,8,6,5,4,3,2,1\}$,$\{8,6,7,5,4,3,2,1\}$,$\{8,7,5,6,4,3,2,1\}$,$\{8,7,6,4,5,3,2,1\}$,$\{8,7,6,5,3,4,2,1\}$,$\{8,7,6,5,4,2,3,1\}$,$\{8,7,6,5,4,3,1,2\}$. There are no others because we need only one pair of numbers to be in correct order. If $i$ and $j$ are in correct order, any number located between the two has to be less than $i$ and more than $j$, which is not possible so $i$ and $j$ have to be adjacent. Moreover, they should be consecutive numbers because any number more than $i$ and less than $j$ cannot be located to right of $i$ or left of $j$.
</s>