*This article is about ***permutation**, a mathematical concept. See permutation (music) for the application of this concept to music.

In mathematics, especially in abstract algebra and related areas, a **permutation** is a bijection, from a finite set *X* onto itself.

In combinatorics, the term **permutation** has a traditional meaning, which is used to include ordered lists without repetition, but not exhaustive (so of less than maximum length).

The concept of a permutation expresses the idea that objects that can be distinguished may be arranged in various different orders. For example, in taking two steps forward one may take paces *left-right* or *right-left*, depending on which foot is first. A more complex application occurs in change ringing. There are many different orders in which a collection of six bells, of different notes, may each be rung once. If the bells are numbered 1 to 6, then each possible order makes a list of the numbers, without repetitions.

There are a number of ways in which the permutation concept may be defined more formally. A permutation of the alphabet of 26 letters is a string of length 26 containing each letter just once; and it is clear that this definition works for any alphabet of *N* letters, with strings of length *N*. That is, a permutation is simply an ordered sequence with no two elements the same, drawn from a fixed set of symbols, and of maximum length. One can therefore point to the essential difference between a *permutation* and a set: the elements of a permutation are arranged in a specified order.

## Arrangements and substitutions

Considering the example of bell-ringing more closely, assume we have six fixed *positions* in which a bell can be rung (*first*, *second*, ..., *sixth*); and also six bells (*A*, *B*, ..., *F* might be the notes of the scale). Then what we mean by an *arrangement* is something like

*B*-*A*-*F*-*E*-*D*-*C*,

with each bell put in its ordered place. What we mean by a *substitution* is a command such as 'change the order in which *A* and *F* are rung, and the order in which *E* and *D* are rung'. This would then give a new arrangement

*B*-*F*-*A*-*D*-*E*-*C*.

The distinction between *arrangement* and *substitution* is important. For example, in ringing church bells not all substitutions are possible, from one ringing of the bells to the next arrangement, for practical reasons; and the instructions to the bell-ringers take the form of a list of arrangements, in which only neighbouring bells are interchanged from one 'round' to the next.

*Both* arrangements and substitutions are commonly called *permutations*. In mathematics, however, the phrase *permutation of a set* always refers to a *substitution*.

## Counting permutations

In this section only, the traditional definition is used: a permutation is an ordered list without repetitions. It is easy to count the number of permutations of size *r* when chosen from a set of size *n* (obviously with *r*≤*n*).

For example, if we have a total of 10 elements, the integers {1, 2, ..., 10}, a permutation of three elements from this set is (2,3,1). In this case, *n* = 10 and *r* = 3. So how many ways can this completely be done?

- We can pretend to select the first member of all permutations out of
*n* choices because there are *n* distinct elements from the generating set.
- Next, since we have used one of the
*n* elements already, the second member of the permutation has (*n* − 1) elements to choose from the remaining set.
- The third member can be filled in (
*n* − 2) ways since 2 have been used already.
- This pattern continues until there are
*r* members on the permutation. This means that the last member can be filled in (*n* − *r* + 1) ways.

Summarizing, we find that a total of

*n*(*n* − 1)(*n* − 2) ... (*n* − *r* + 1)

different permutations of *r* objects, taken from a pool of *n* objects, exist. If we denote this number by P(*n*, *r*) and use the factorial notation, we can write

- .

In the above example, we have *n* = 10 and *r* = 3, so to find out how many unique sets, such as the one previously, we can find, we need to calculate P(10,3) = 720.

Other, older notations include ^{n}P_{r}, P_{n,r}, or _{n}P_{r}.

A common modern notation is (*n*)_{r} which is called a *falling factorial*. However, the same notation is used for the *rising factorial* (also called *Pochhammer symbol*)

*n*(*n* + 1)(*n* + 2)...(*n* + *r* − 1).

In the latter case, the number of permutations is (*n* + *r* − 1)_{r}.

## Abstract algebra

As explained in a previous section, in abstract algebra and other mathematical fields, the term *permutation (of a set)* is now reserved for a bijective map (bijection) from a finite set onto itself. The earlier example, of making permutations out of numbers 1 to 10, would be translated as a map from the set {1, ..., 10} to itself.

There are two main notations for such permutations. In relation notation, one can just arrange the "natural" ordering of the elements being permuted on a row, and the new ordering on another row:

This means that in the first position, the second element of the set should be placed, in the second position, the fifth element in the set should be placed, and so on. Alternatively, if we have a finite set of elements (which need not be integers), we can firstly create an association between each element and an integer - more precisely, we can create a mapping ν(*s*) : *S* -> **Z** where ν is bijective, and S is our pool of elements. One can then read the above notation as mapping the element ν^{-1}(1) to element ν^{-1}(2), element ν^{-1}(2) to element ν^{-1}(5), and so on.

Alternatively, we can write the permutation in terms of how the elements change when the permutation is successively applied. If we look at the above permutation as an example, if we take an element in the first position, the result of applying the permutation is then placed in the second position, the result of applying the permutation again is placed in the third position, and if we were to apply the permutation again we see that the element has now returned to the first permutation. We say that the behaviour of such an element is a *cycle*, and we can write this cycle as (1 2 5), or alternatively as (2 5 1) or (5 1 2), but not as e.g. (1 5 2). The next cycle begins with any other element not considered till now, until every element appears in a cycle.

As such, we can write the permutation as a set of cycles. The previous permutation just considered has cycle form (1 2 5)(3 4). The order *of* the cycles is not significant (but, as said before, the order of the elements *within* a cycle is, up to cyclic change). Thus, the same permutation could be written as e.g (4 3)(2 5 1). The "canonical" form for a permutation places the lowest-numbered position in each cycle first in that cycle and then orders the cycles by increasing first element.

This notation often omits fixed points, that is, elements mapped to themselves; thus (1 3)(2)(4 5) can become simply (1 3)(4 5), since a cycle of just one element has no effect.

A permutation consisting of one cycle is itself called a *cycle*. The number of entries of a cycle is called the *length*. For example, the length of (1 2 5) is three. A special terminology is used to describe cycles of length two - these are *transpositions* - since in a length two cycle, the elements are merely transposed.

### Special permutations

If we think of a permutation that "changes" the position of the first element to the first element, the second to the second, and so on, we really have not changed the positions of the elements at all. Because of its action, we describe it as the *identity permutation* because it acts as an identity function.

If we have some permutation called *P*, the identity permutation *I*, we can describe a permutation, written *P*^{-1}, which undoes the action of applying *P*. In essence, performing P then P^{-1} is the same as performing the identity permutation. We always have such a permutation since a permutation is a bijective map. Such a permutation is called the *inverse permutation*.

One can define the product of two permutations. If we have two permutations, *P* and *Q*, the action of performing *P* and *Q* will be the same as performing some other permutation, *R*, itself. Note that *R* could be *P* or *Q*. The product of *P* and *Q* is defined to be the permutation *R*. For more, see symmetric group and permutation group.

An even permutation is a permutation which can be expressed as the product of an even number of transpositions, and the identity permutation is an even permutation as it equals (1 2)(1 2). An odd permutation is a permutation which can be expressed as the product of an odd number of transpositions. It can be shown that every permutation is either odd or even and can't be both.

We can also represent a permutation in matrix form - the resulting matrix is known as a *permutation matrix*.

## Permutations in computing

Some of the older textbooks do look at permutations as *assignments*, as mentioned above. In computer science terms, these are assignment operations, with values

- 1, 2, ...,
*n*

assigned to variables

*x*_{1}, *x*_{2}, ..., *x*_{n}.

Each value should be assigned just once.

The assignment/substitution difference is then illustrative of one way in which functional programming and imperative programming differ — pure functional programming has no assignment mechanism. The mathematics *convention* is nowadays that permutations are just functions and the operation on them is function composition; functional programmers follow this. In the assignment language a *substitution* is an instruction to switch round the values assigned, simultaneously; a well-known problem.

## Numbering permutations

Factoradic numbers can be used to assign unique numbers to permutations, such that given a factoradic n, one can quickly find the corresponding permutation.

## See also

Last updated: 07-31-2005 00:07:37