Permutation is the rearrangement of objects or symbols into distinguishable
sequences. Each unique ordering is called
a permutation. (For cases wherein the ordering of elements is irrelevant, compare
combination and
set.) For example, with the
numerals one to six, each possible ordering consists of a complete list of the numerals, without repetitions. There are 720 total permutations of these numerals, one of which is: "4, 5, 6, 1, 2, 3".
The general concept of permutation can be defined more formally in different contexts:
- In set theory, a permutation is an ordered sequence containing each symbol from a set once, and only once. Neither "1, 2, 2, 3, 4, 5, 6" nor "1, 2, 4, 5, 6" are permutations of the sequence "1, 2, 3, 4, 5, 6". A permutation is distinct from a set or combination, in that the ordering of elements in a set is not considered relevant for sets or combinations. In other words, the set-theoretic definition of permutation is that of a one-to-one correspondence, or bijection, of labeled elements with "positions" or "places" which are arranged in a straight line.
- In abstract algebra and related areas, the elements of permutation may not be arranged in a linear order, or indeed in any order at all. Under this refined definition, a permutation is a bijection from a finite set, X, onto itself. This allows for the definition of groups of permutations; see permutation group.
- In combinatorics, the term permutation also has a traditional meaning which includes ordered lists without repetition and where one or more elements from the list are omitted from the distinguishable orderings; for example, a permutation of "1,2,4,3" with "5" and "6" omitted.
Counting permutations
In this section only, the traditional definition is used: a permutation is an ordered list without repetitions, perhaps missing some (
n−
r) elements. The number of permutations of a sequence is:

where:
- r is the size of each permutation,
- n is the size of the set from which elements are permuted, and
- ! is the factorial operator.
For example, if we have a total of 10 elements, the integers {1, 2 .. 10}, one sequence of three elements from this set would be (5, 3, 4). In this case,
n = 10 and
r = 3. To find out how many unique sequences we can find, we need to calculate
P(10,3) = 10! / (10−3)! = (1×2×3×4×5×6×7×8×9×10) / (1×2×3×4×5×6×7) = 8×9×10 = 720
In the case only where
n =
r then the formula above as in
pure mathematics simplifies to:

The reason why 0! (zero factorial) is 1, is because in
set theory an empty set can only be ordered one way, so 0! = 1.
If
n = 0 then there is also one unique sequence.
In the example given in the header of this article, with 6 integers {1..6}, this would be:
P(6,6) = 6! / (6−6)! = (1×2×3×4×5×6×) / 0! = 720 / 1 = 720.
If
n > 1 and
r > 1, each permutations element order becomes significant.
For example the permutations of 3 elements in the set {1, 2, 3} taken in sequence lengths of 2 is:
(1,2), (1,3), (2,1), (2,3), (3,1) and (3,2). 6 permutations for sequence lengths of 2
This should not be confused with
combination where the order of the elements is not taken into account and the above elements in the same set combine into just the 3 combinations for the same lengths:
(1,2), (1,3) and (2,3). 3 combinations for collection lengths of 2
Other, older notations include
nPr,
Pn,r, or
nPr. 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)r.
With the rising factorial notation, 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.
Notation
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:
-

stands for the permutation
s of the set {1,2,3,4,5} defined by
s(1)=2,
s(2)=5,
s(3)=4,
s(4)=3,
s(5)=1.
If we have a finite set
E of
n elements, it is by definition in
bijection with the set {1,…,
n}, where this bijection
f corresponds just to numbering the elements. Once they are numbered, we can identify the permutations of the set
E with permutations of the set {1,…,
n}. (In more mathematical terms, the function that maps a permutation
s of
E to the permutation
f o s o f−1 of {1,…,
n} is a
morphism from the
symmetric group of
E into that of {1,…,
n}, see below.)
Alternatively, we can write the permutation in terms of how the elements change when the permutation is successively applied. This is referred to as the permutation's
decomposition in a product of disjoint cycles. It works as follows: starting from one element
x, we write the sequence (
x s(
x)
s2(
x) …) until we get back the starting element (at which point we close the parenthesis without writing it for a second time). This is called the
cycle associated to
x's
orbit following
s.
Then we take an element we did not write yet and do the same thing, until we have considered all elements. In the above example, we get:
s = (1 2 5) (3 4).
Each cycle (
x1 x2 …
xL) stands for the permutation that maps
xi on
xi+1 (
i=1…
L−1) and
xL on
x1, and leaves all other elements invariant.
L is called the length of the cycle. Since these cycles have by construction
disjoint supports (i.e. they act non-trivially on disjoint subsets of
E), they do commute (for example, (1 2 5) (3 4) = (3 4)(1 2 5)). The order of the cycles in the (composition) product does not matter, while the order of the elements in each cycles does matter (
up to cyclic change; see also
cycles and fixed points).
Obviously, a 1-cycle (cycle of length 1) is the same as fixing the element contained in it, so there is no use in writing it explicitly. Some authors' definition of a cycle do not include cycles of length 1.
Cycles of length two are called
transpositions; such permutations merely exchange ("the place of") two elements. (Conversely, a
matrix transposition is itself an important example of a permutation.)
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. Conversely, a permutation which changes the position of all elements (no element is mapped to itself) is called a
derangement.
If one has some permutation, called
P, one may describe a permutation, written
P−1, which undoes the action of applying
P. In essence, performing
P then
P−1 is equivalent to performing the identity permutation. One always has such a permutation since a permutation is a bijective map. Such a permutation is called the
inverse permutation. It is computed by exchanging each number and the number of the place which it occupies.
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.
One theorem regarding the inverse permutation is the effect of a conjugation of a permutation by a permutation in a permutation group. If we have a permutation
Q=(
i1 i2 …
in) and a permutation
P, then
PQP−1 = (
P(
i1)
P(
i2) …
P(
in)).
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 look at permutations as
assignments, as mentioned above. In
computer science terms, these are
assignment operations, with values
- 1, 2, …, n
assigned to variables
- x1, x2, …, xn.
Each value should be assigned only 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 of
k one can quickly find the corresponding permutation.
Algorithm to generate permutations
For every number
k, with 0 ≤
k <
n!, the following algorithm generates the corresponding permutation of the initial sequence
sj,
j=1…
n:
function permutation(k, s) {
var int factorial:= 1;
for j= 2
to length(s) {
factorial:= factorial* (j-1); // factorial= (j-1)!
swap s[j- ((k / factorial) mod j)]
with s[j];
}
return s;
}
Notation
- k / j denotes integer division of k by j, i.e. the integral quotient without any remainder, and
- k mod j is the remainder following integer division of k by j.
- s[n] denotes the nth element of list s (s is not zero-based).
Built-in calculator functions for calculating the number of permutations
Most
calculators have a built-in function for calculating the number of permutations, called nPr or PERM on many. The permutations function is often only available through several layers of menus; how to access the function is usually indicated in the documentation for calculators that support it.
Calculating the number of permutations using spreadsheet software
Most
spreadsheet software also provides a built-in function for calculating the number of permutations, called PERMUT in many popular spreadsheets.
Apple's Numbers software notably does not currently include such a function
[1].
Further reading
- Miklos Bona. "Combinatorics of Permutations", Chapman Hall-CRC, 2004. ISBN 1-58488-434-7.
- Donald Knuth. The Art of Computer Programming, Volume 4: Generating All Tuples and Permutations, Fascicle 2, first printing. Addison-Wesley, 2005. ISBN 0-201-85393-0.
- Donald Knuth. The Art of Computer Programming, Volume 3: Sorting and Searching, Second Edition. Addison-Wesley, 1998. ISBN 0-201-89685-0. Section 5.1: Combinatorial Properties of Permutations, pp.11–72.
See also
References
External links
Permutation is a mathematical concept.
Permutation may also refer to:
- Permutation (music), a concept in musical set theory
- Permutation (policy debate), a type of argument in policy debate
- Permutation
..... Click the link for more information. sequence is an ordered list of objects (or events). Like a set, it contains members (also called elements or terms), and the number of terms (possibly infinite) is called the length of the sequence.
..... Click the link for more information.
In combinatorial mathematics, a combination is an un-ordered collection of unique elements. (An ordered collection is called a permutation.) Given S, the set of all possible unique elements, a combination is a subset of the elements of S.
..... Click the link for more information.
SET may stand for:
- Sanlih Entertainment Television, a television channel in Taiwan
- Secure electronic transaction, a protocol used for credit card processing,
..... Click the link for more information. numeral system (or system of numeration) is a framework where a set of numbers are represented by numerals in a consistent manner. It can be seen as the context that allows the numeral "11" to be interpreted as the binary numeral for three
..... Click the link for more information.
Set theory is the mathematical theory of sets, which represent collections of abstract objects. It encompasses the everyday notions, introduced in primary school, often as Venn diagrams, of collections of objects, and the elements of, and membership in, such collections.
..... Click the link for more information.
sequence is an ordered list of objects (or events). Like a set, it contains members (also called elements or terms), and the number of terms (possibly infinite) is called the length of the sequence.
..... Click the link for more information.
Symbols are objects, characters, or other concrete representations of ideas, concepts, or other abstractions. For example, in the United States, Canada and Great Britain, a red octagon is a symbol for the traffic sign meaning "STOP".
..... Click the link for more information.
In mathematics, the elements or members of a set (or more generally a class) are all those objects which when collected together make up the set (or class).
Set theory and elements
Writing , means that the elements of the set are the numbers 1, 2, 3 and 4.
..... Click the link for more information. In mathematics, a bijection, or a bijective function is a function f from a set X to a set Y with the property that, for every y in Y, there is exactly one x in X such that
f(x) = y.
..... Click the link for more information.
line can be described as an ideal zero-width, infinitely long, perfectly straight curve (the term curve in mathematics includes "straight curves") containing an infinite number of points. In Euclidean geometry, exactly one line can be found that passes through any two points.
..... Click the link for more information.
Abstract algebra is the subject area of mathematics that studies algebraic structures, such as groups, rings, fields, modules, vector spaces, and algebras. Most authors nowadays simply write algebra instead of abstract algebra.
..... Click the link for more information.
In mathematics, a total order, linear order, simple order, or (non-strict) ordering on a set X is any binary relation on X that is antisymmetric, transitive, and total.
..... Click the link for more information.
In mathematics, a bijection, or a bijective function is a function f from a set X to a set Y with the property that, for every y in Y, there is exactly one x in X such that
f(x) = y.
..... Click the link for more information.
In mathematics, a set is called finite if there is a bijection between the set and some set of the form where n is a natural number. (The value n = 0 is allowed; that is, the empty set is finite.) An infinite set is a set which is not finite.
..... Click the link for more information.
In mathematics, a permutation group is a group G whose elements are permutations of a given set M, and whose group operation is the composition of permutations in G (which are thought of as bijective functions from the set M
..... Click the link for more information.
Combinatorics is a branch of pure mathematics concerning the study of discrete (and usually finite) objects. It is related to many other areas of mathematics, such as algebra, probability theory, ergodic theory and geometry, as well as to applied subjects such as computer science
..... Click the link for more information.
factorial of a non-negative integer is the product of all positive integers less than or equal to . For example,
- and
where represents n factorial.
..... Click the link for more information. Broadly speaking, pure mathematics is mathematics motivated entirely for reasons other than application. It is distinguished by its rigour, abstraction and beauty. From the eighteenth century onwards, this was a recognized category of mathematical activity, sometimes characterised
..... Click the link for more information.
Set theory is the mathematical theory of sets, which represent collections of abstract objects. It encompasses the everyday notions, introduced in primary school, often as Venn diagrams, of collections of objects, and the elements of, and membership in, such collections.
..... Click the link for more information.
In combinatorial mathematics, a combination is an un-ordered collection of unique elements. (An ordered collection is called a permutation.) Given S, the set of all possible unique elements, a combination is a subset of the elements of S.
..... Click the link for more information.
In mathematics, the
Pochhammer symbol
introduced by Leo August Pochhammer, has two different meanings.
It is used in the theory of special functions to represent the
rising sequential product, sometimes called the (
..... Click the link for more information. In mathematics, the
Pochhammer symbol
introduced by Leo August Pochhammer, has two different meanings.
It is used in the theory of special functions to represent the
rising sequential product, sometimes called the (
..... Click the link for more information. In mathematics, the
Pochhammer symbol
introduced by Leo August Pochhammer, has two different meanings.
It is used in the theory of special functions to represent the
rising sequential product, sometimes called the (
..... Click the link for more information. Abstract algebra is the subject area of mathematics that studies algebraic structures, such as groups, rings, fields, modules, vector spaces, and algebras. Most authors nowadays simply write algebra instead of abstract algebra.
..... Click the link for more information.
In mathematics, a bijection, or a bijective function is a function f from a set X to a set Y with the property that, for every y in Y, there is exactly one x in X such that
f(x) = y.
..... Click the link for more information.
In mathematics, a bijection, or a bijective function is a function f from a set X to a set Y with the property that, for every y in Y, there is exactly one x in X such that
f(x) = y.
..... Click the link for more information.
In mathematics, a bijection, or a bijective function is a function f from a set X to a set Y with the property that, for every y in Y, there is exactly one x in X such that
f(x) = y.
..... Click the link for more information.
In mathematics, a morphism is an abstraction of a structure-preserving mapping between two mathematical structures.
The most common example occurs when the process is a function or map which preserves the structure in some sense.
..... Click the link for more information.
In mathematics, the symmetric group on a set X, denoted by SX or Sym(X), is the group whose underlying set is the set of all bijective functions from X to X, in which the group operation is that of composition of functions, i.
..... Click the link for more information.