Explore modules

Inversions of a Random Permutation

Build the exact inversion-count distribution and compare its symmetry and moments.

Free theory article

Build the exact inversion-count distribution and compare its symmetry and moments.

Concept & interpretation

The number of inversions in a random permutation measures how out of order its elements are relative to the sorted identity permutation.

Interactive Experiment

You can interact with the module to inspect the exact probability mass function for the number of inversions.

  1. Open the Inversions of a Random Permutation module.
  2. Set Permutation size to 4 and Inversions probe to 3.
  3. Observe that the Mean is 3, Variance is 13/6, and Probe Probability is 1/4 = 0.25.
  4. Check the boundary cases n = 0 and n = 1, where the only possible inversion count is 0 with probability 1.
Read the full free theory article