Let . The pair gives an
inversion of if
and .
(This should not be confused with the inverse permutation discussed above.)
The total number of inversions of is denoted by
.
The identity permutation has no inversions because for every pair
with , .
For example, one can see that there are no inversions of the identity
permuation from :
.
Consider
.
The pair is an inversion of because
with and , we have
and
.
The remaining inversion is given by the pair .
Thus .
Let be such that there exist
, such that
, , and
for all
In other words, only swaps and .
We want to determine .
Note that for each ,
is an inversion because
and
.
Also, for each ,
is an inversion because
and
.
Finally, the remaining inversion is .
Thus, , which is always odd.
For example, the inversions of
are , , and .
For each of the following permutations, give the number of
inversions and the inverse permutation.