Even and odd permutations
From Academic Kids

In mathematics, the permutations of a finite set (i.e. the bijective maps from the set to itself) fall into two equal classes: the even permutations and the odd permutations. An even permutation is one that can be produced by an even number of exchanges of two elements (these exchanges are called transpositions). An odd permutation is one that can be produced by an odd number of transpositions. It is a remarkable and nontrivial fact that every permutation is either even or odd, but not both. The signature of a permutation is defined to be +1 if the permutation is even and 1 if it is odd.
Contents 
Example
Consider the permutation σ of the set {1,2,3,4,5} which turns the initial arrangement 12345 into 34521. It can be obtained by three transpositions: first exchange the places of 1 and 3, then exchange 2 and 4, and finally exchange 1 and 5. This shows that the given permutation σ is odd. Using the notation explained in the permutation article, we can write <math>\sigma=\begin{bmatrix}1&2&3&4&5\\ 3&4&5&2&1\end{bmatrix} = (1 5) (2 4) (1 3)<math> There are (infinitely) many other ways of writing σ as a composition of transpositions, for instance
 <math>\sigma=(2 3) (1 2) (2 4) (3 5) (4 5)\;<math>,
but it is impossible to write it as a product of an even number of transpositions.
Facts
The identity permutation is an even permutation since it can be written as (1 2)(1 2).
The following rules follow directly from the corresponding rules about addition of integers:
 the composition of two even permutations is even
 the composition of two odd permutations is even
 the composition of an odd and an even permutation is odd
From these it follows that
 the inverse of every even permutation is even
 the inverse of every odd permutation is odd
Considering the symmetric group S_{n} of all permutations of the set {1,...,n}, we can conclude that the map
 <math>\operatorname{sgn} : S_n \to \{1,1\}<math>
that assigns to every permutation its signature is a group homomorphism.
Furthermore, we see that the even permutations form a subgroup of S_{n}. This is the alternating group on n letters, denoted by A_{n}. It is the kernel of the homomorphism sgn.
If n>1, then there are just as many even permutations in S_{n} as there odd ones; consequently, A_{n} contains n!/2 permutations. [The reason: if σ is even, then (12)σ is odd; if σ is odd, then (12)σ is even; the two maps are inverse to each other.]
A cycle is even if and only if its length is odd. This follows from formulas like
 (a b c d e) = (a b) (a c) (a d) (a e)
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 evenlength cycles.
Every permutation of odd order must be even; the converse is not true in general.
Proofs that every permutation is either even or odd
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.
Every transposition can be written as a product of an odd number of transpositions of adjacent elements, e.g.
 (2 5) = (2 3)(3 4)(4 5)(4 3)(3 2)
If σ is a given permutation, we define an inversion pair for σ to be a pair of indices (i,j) such that i<j and σ(i)>σ(j). Let N(σ) be the number of inversion pairs of σ. Now if we compose σ with the transposition (i, i+1) of two adjacent numbers, then, compared to σ, the new permutation σ(i, i+1) will have exactly one inversion pair less (in case (i,i+1) was an inversion pair for σ) or more (in case (i, i+1) was not an inversion pair). So any product of an odd number of transpositions of adjacent elements will have an odd value of N, and any product of an even number of transpositions of adjacent elements will have an even value of N. We can now define σ to be even if N(σ) is even, and odd if N(σ) is odd. This coincides with the definition given earlier but it is now clear that every permutation is either even or odd.
An alternative proof uses the polynomial
 <math>P(x_1,\ldots,x_n)=\prod_{i
So for instance in the case n = 3, we have
 <math>P(x_1, x_2, x_3) = (x_1  x_2)(x_2  x_3)(x_1  x_3)\;<math>
Now for a given permutation σ of the numbers {1,...,n}, we define
 <math>\operatorname{sgn}(\sigma)=\frac{P(x_{\sigma(1)},\ldots,x_{\sigma(n)})}{P(x_1,\ldots,x_n)}<math>
Since the polynomial P(x_{σ(1)},...,x_{σ(n)}) has the same factors as P(x_{1},...,x_{n}) except for their signs, if follows that sgn(σ) is either +1 or −1. Furthermore, if σ and τ are two permutations, we see that
 <math>\operatorname{sgn}(\sigma\tau) = \frac{P(x_{\sigma(\tau(1))},\ldots,x_{\sigma(\tau(n))})}{P(x_1,\ldots,x_n)}<math>
 <math> = \frac{P(x_{\sigma(1)},\ldots,x_{\sigma(n)})}{P(x_1,\ldots,x_n)} \cdot \frac{P(x_{\sigma(\tau(1))},\ldots, x_{\sigma(\tau(n))})}{P(x_{\sigma(1)},\ldots,x_{\sigma(n)})}<math>
 <math> = \operatorname{sgn}(\sigma)\cdot\operatorname{sgn}(\tau)<math>
Since with this definition it is furthermore clear that any transposition of two adjacent elements has signature 1, we do indeed recover the signature as defined earlier.
A third approach uses the presentation of the group S_{n} in terms of generators τ_{1},...,τ_{n1} and relations
 τ_{i}^{2} = 1 for all i
 τ_{i}τ_{i+1}τ_{i} = τ_{i+1}τ_{i}τ_{i+1} for all i < n1
 τ_{i}τ_{j} = τ_{j}τ_{i} if ij > 2.
[Here the generator τ_{i} represents the transposition (i, i+1).] All relations keep the length of a word the same or change it by two. Starting with an evenlength word will thus always result in an evenlength word after using the relations, and similarly for oddlength words. It is therefore unambiguous to call the elements of S_{n} represented by evenlength words "even", and the elements represented by oddlength words "odd".
See also
 The fifteen puzzle is a classic application.