are often called inversion vector or Lehmer code. (A list of sources is found here.) This article uses the term inversion vector () like Wolfram. The remaining two vectors are sometimes called left and right inversion vector, but to avoid confusion with the inversion vector this article calls them left inversion count () and right inversion count (). Interpreted as a factorial number the left inversion count gives the permutations reverse colexicographic, and the right inversion count gives the lexicographic index. Inversion vector :With the element-based definition is the number of inversions whose smaller (right) component is . is the number of elements in greater than before . Left inversion count :With the place-based definition is the number of inversions whose bigger (right) component is . is the number of elements in greater than before . Right inversion count , often called Lehmer code:With the place-based definition is the number of inversions whose smaller (left) component is . is the number of elements in smaller than after . Both and can be found with the help of a Rothe diagram, which is a permutation matrix with the 1s represented by dots, and an inversion (often represented by a cross) in every position that has a dot to the right and below it. is the sum of inversions in row of the Rothe diagram, while is the sum of inversions in column . The permutation matrix of the inverse is the transpose, therefore of a permutation is of its inverse, and vice versa. Example: All permutations of four elements The following sortable table shows the 24 permutations of four elements (in the column) with their place-based inversion sets (in the p-b column), inversion related vectors (in the , , and columns), and inversion numbers (in the # column). (The columns with smaller print and no heading are reflections of the columns next to them, and can be used to sort them in colexicographic order.) It can be seen that and always have the same digits, and that and are both related to the place-based inversion set. The nontrivial elements of are the sums of the descending diagonals of the shown triangle, and those of are the sums of the ascending diagonals. (Pairs in descending diagonals have the right components 2, 3, 4 in common, while pairs in ascending diagonals have the left components 1, 2, 3 in common.) The default order