Parity of a permutation


In mathematics, when X is a finite set with at least two elements, the permutations of X fall into two classes of equal size: the even permutations and the odd permutations. If any total ordering of X is fixed, the parity of a permutation of X can be defined as the parity of the number of inversions for σ, i.e., of pairs of elements x, y of X such that and.
The sign, signature, or signum of a permutation σ is denoted sgn and defined as +1 if σ is even and −1 if σ is odd. The signature defines the alternating character of the symmetric group Sn. Another notation for the sign of a permutation is given by the more general Levi-Civita symbol, which is defined for all maps from X to X, and has value zero for non-bijective maps.
The sign of a permutation can be explicitly expressed as
where N is the number of inversions in σ.
Alternatively, the sign of a permutation σ can be defined from its decomposition into the product of transpositions as
where m is the number of transpositions in the decomposition. Although such a decomposition is not unique, the parity of the number of transpositions in all decompositions is the same, implying that the sign of a permutation is well-defined.

Example

Consider the permutation σ of the set which turns the initial arrangement 12345 into 34521.
It can be obtained by three transpositions: first exchange the numbers 2 and 4, then exchange 1 and 3, and finally exchange 1 and 5. This shows that the given permutation σ is odd. Following the method of the cycle notation article, this could be written as
There are many other ways of writing σ as a composition of transpositions, for instance
but it is impossible to write it as a product of an even number of transpositions.

Properties

The identity permutation is an even permutation. An even permutation can be obtained as the composition of an even number and only an even number of exchanges of two elements, while an odd permutation can be obtained by an odd number of transpositions.
The following rules follow directly from the corresponding rules about addition of integers:
From these it follows that
Considering the symmetric group Sn of all permutations of the set, we can conclude that the map
that assigns to every permutation its signature is a group homomorphism.
Furthermore, we see that the even permutations form a subgroup of Sn. This is the alternating group on n letters, denoted by An. It is the kernel of the homomorphism sgn. The odd permutations cannot form a subgroup, since the composite of two odd permutations is even, but they form a coset of An.
If, then there are just as many even permutations in Sn as there are odd ones; consequently, An contains n!/2 permutations.
A cycle is even if and only if its length is odd. This follows from formulas like
In practice, in order to determine whether a given permutation is even or odd, one writes the permutation as a product of disjoint cycles. The permutation is odd if and only if this factorization contains an odd number of even-length cycles.
Another method for determining whether a given permutation is even or odd is to construct the corresponding permutation matrix and compute its determinant. The value of the determinant is the same as the parity of the permutation.
Every permutation of odd order must be even. The permutation in A4 shows that the converse is not true in general.

Equivalence of the two definitions

Proof 1

Every permutation can be produced by a sequence of transpositions : with the first transposition we put the first element of the permutation in its proper place, the second transposition puts the second element right etc. Since we cannot be left with just a single element in an incorrect position, we must achieve the permutation with our last transposition. Given a permutation σ, we can write it as a product of transpositions in many different ways. We want to show that either all of those decompositions have an even number of transpositions, or all have an odd number.
Suppose we have two such decompositions:
We want to show that k and m are either both even, or both odd.
Every transposition can be written as a product of an odd number of transpositions of adjacent elements, e.g.
To see this, note that if we have the transposition on an n-element set, one way to decompose it is as . The right block of transpositions first frees up the j space by moving j over to the j − 1 space; then, j − 1 goes into the j − 2 space with j − 2 in the j space, j − 2 goes into the j − 3 space with j − 3 in the j space, etc., until i + 1 ends up in the i space and i in the j space. Thus, each element from i + 1 to j − 1 is in a space one to the left from where it ought to be. In the left block, each of those elements is restored one at a time to its original space, after resting in the i space for the duration of one permutation. j ends up in the i space, and i in the j space, with nothing else altered, as desired. The number of transpositions is + , which is odd.
If we decompose in this way each of the transpositions T1 ... Tk and Q1 ... Qm above
into an odd number of adjacent transpositions, we get the new decompositions:
where all of the T*1...T*k′ Q*1...Q*m′ are adjacent, is even, and is even.
Now compose the inverse of T*k′ with σ. T*k′ is the transposition of two adjacent numbers, so, compared to σ, the new permutation will have exactly one inversion pair less or more. Then apply the inverses of T*k′−1, T*k′−2,..., T*1 in the same way, "unraveling" the permutation σ. At the end we get the identity permutation, whose number of inversions is zero. This means that the original number of inversions N less k' is even and also N less k is even.
We can do the same thing with the other decomposition, Q*m...Q*1, and it will turn out that the original N less m is even. Therefore, is even, as we wanted to show.
We can thus define the parity of σ to be that of its number of constituent transpositions, because we see that this can have only one value. And this must agree with the parity of the number of inversions under any ordering, as seen above, so the definitions are indeed well-defined and equivalent.

Proof 2

An alternative proof uses the polynomial
So for instance in the case, we have
Now for a given permutation σ of the numbers, we define
Since the polynomial has the same factors as except for their signs, if follows that sgn is either +1 or −1. Furthermore, if σ and τ are two permutations, we see that
Since with this definition it is furthermore clear that any transposition of two elements has signature −1, we do indeed recover the signature as defined earlier.

Proof 3

A third approach uses the presentation of the group Sn in terms of generators τ1,..., τn−1 and relations
All relations keep the length of a word the same or change it by two. Starting with an even-length word will thus always result in an even-length word after using the relations, and similarly for odd-length words. It is therefore unambiguous to call the elements of Sn represented by even-length words "even", and the elements represented by odd-length words "odd".

Proof 4

Recall that a pair x, y such that and is called an inversion. We want to show that the count of inversions has the same parity as the count of 2-element swaps. To do that, we can show that every swap changes the parity of the count of inversions, no matter which two elements are being swapped and what permutation has already been applied.
Suppose we want to swap the ith and the jth element. Clearly, inversions formed by i or j with an element outside of will not be affected.
For the elements within the interval, assume vi of them form inversions with i and vj of them form inversions with j. If i and j are swapped, those vi inversions with i are gone, but inversions are formed. The count of inversions i gained is thus, which has the same parity as n.
Similarly, the count of inversions j gained also has the same parity as n. Therefore, the count of inversions gained by both combined has the same parity as 2n or 0. Now if we count the inversions gained by swapping the ith and the jth element, we can see that this swap changes the parity of the count of inversions, since we also add 1 to the number of inversions gained for the pair .
Note that initially when no swap is applied, the count of inversions is 0. Now we obtain equivalence of the two definitions of parity of a permutation.

Other definitions and proofs

The parity of a permutation of points is also encoded in its cycle structure.
Let σ =... be the unique decomposition of σ into disjoint cycles, which can be composed in any order because they commute. A cycle involving points can always be obtained by composing k transpositions :
so call k the size of the cycle, and observe that, under this definition, transpositions are cycles of size 1. From a decomposition into m disjoint cycles we can obtain a decomposition of σ into transpositions, where ki is the size of the ith cycle. The number is called the discriminant of σ, and can also be computed as
if we take care to include the fixed points of σ as 1-cycles.
Suppose a transposition is applied after a permutation σ. When a and b are in different cycles of σ then
and if a and b are in the same cycle of σ then
In either case, it can be seen that, so the parity of N will be different from the parity of N.
If is an arbitrary decomposition of a permutation σ into transpositions, by applying the r transpositions after t2 after... after tr after the identity observe that N and r have the same parity. By defining the parity of σ as the parity of N, a permutation that has an even length decomposition is an even permutation and a permutation that has one odd length decomposition is an odd permutation.
Remarks:
Parity can be generalized to Coxeter groups: one defines a length function ℓ, which depends on a choice of generators, and then the function gives a generalized sign map.