Let G be the set of all permutations of the set { 1, 2, . . . ,
n }, and let n be an integer ≥ 2. For each σ ∈ G, let X(σ) be
the number of inversions for σ, i.e., the number of pairs (i, j)
with 1 ≤ i < j ≤ n such that σ(i) > σ(j). Calculate the
average value of X: