ArticleslgStudy

mathematics

Derangement

Derangement is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Derangement rather than just read about it. In short: In combinatorial mathematics, a derangement is a permutation of the elements of a set in which no element appears in its original position. In other words, a derangement is a permutation that has no fixed points.

Derangement — main illustration
Derangement — illustration

Key takeaways

  • Derangement belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Derangement to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Derangement from memory before moving on to harder problems.

Reference excerpt

In combinatorial mathematics, a derangement is a permutation of the elements of a set in which no element appears in its original position. In other words, a derangement is a permutation that has no fixed points. The number of derangements of a set of size n is known as the n th derangement number or the subfactorial of n or n th de Montmort number (after Pierre Remond de Montmort). Notations for subfactorials in common use include Dn, dn, !n, or n¡ . For n > 0 , the subfactorial Dn equals the nearest integer to ⁠n!/e⁠, where n! denotes the factorial of n and e ≈ 2.718281828... is Euler's number. The problem of counting derangements was first considered by Pierre Raymond de Montmort in his Essay d'analyse sur les jeux de hazard in 1708; he solved it in 1713, as did Nicholas Bernoulli at about the same time.

Example

Suppose that a professor gave a test to 4 students – A, B, C, and D – and wants to let them grade each other's tests. How many ways could the professor hand the tests back to the students for grading, such that no student receives their own test back? Out of 24 possible permutations (4!) for handing back the tests,

there are only 9 derangements (shown in blue italics above). In every other permutation of this 4-member set, at least one student gets their own test back (shown in bold red). Another version of the problem arises when we ask for the number of ways n letters, each addressed to a different person, can be placed in n pre-addressed envelopes so that no letter appears in the correctly addressed envelope.

Counting derangements Counting derangements of a set amounts to the hat-check problem, in which one considers the number of ways in which n hats (call them h1 through hn) can be returned to n people (P1 through Pn) such that no hat makes it back to its owner. Each person may receive any of the n − 1 hats that is not their own. Call the hat which the person P1 receives hi and consider hi's owner: Pi receives either P1's hat, h1, or some other. Accordingly, the problem splits into two possible cases:

Pi receives a hat other than h1. This case is equivalent to solving the problem with n − 1 people and n − 1 hats because for each of the n − 1 people besides P1 there is exactly one hat from among the remaining n − 1 hats that they may not receive (for any Pj besides Pi, the unreceivable hat is hj, while for Pi it is h1). Another way to see this is to rename h1 to hi, where the derangement is more explicit: for any j from 2 to n, Pj cannot receive hj. Pi receives h1. In this case the problem reduces to n − 2 people and n − 2 hats, because P1 received hi's hat and Pi received h1's hat, effectively putting both out of further consideration. For each of the n − 1 hats that P1 may receive, the number of ways that P2, …, Pn may all receive hats is the sum of the counts for the two cases. This gives us the solution to the hat-check problem: Stated algebraically, the number Dn of derangements of an n-element set is Dn=(n−1)(Dn−1+Dn−2)for n≥2, where D0 = 1 and D1 = 0. The number of derangements of small lengths is given in the table below.

There are various other expressions for Dn, equivalent to the formula given above. These include Dn=n!∑i=0n(−1)ii!for n≥0 and Dn=[n!e]=⌊n!e+12⌋for n≥1, where [x] is the nearest integer function and ⌊x⌋ is the floor function. Other related formulas include Dn=⌊n!+1e⌋for n≥1,Dn=⌊(e+e−1)n!⌋−⌊en!⌋for n≥2,Dn=n!−∑i=1n(ni)⋅Dn−ifor n≥1. The following recurrence also holds: Dn={1if n=0,n⋅Dn−1+(−1)nif n>0.

Derivation by inclusion–exclusion principle One may derive a non-recursive formula for the number of derangements of an n-set, as well. For 1 ≤ k ≤ n we define Sk to be the set of permutations of n objects that fix the k th object. Any intersection of a collection of i of these sets fixes a particular set of i objects and therefore contains (n − i)! permutations. There are (ni) such collections, so the inclusion–exclusion principle yields |S1∪⋯∪Sn|=∑i|Si|−∑i<j|Si∩Sj|+∑i<j<k|Si∩Sj∩Sk|+⋯+(−1)n+1|S1∩⋯∩Sn|=(n1)(n−1)!−(n2)(n−2)!+(n3)(n−3)!−⋯+(−1)n+1(nn)0!=∑i=1n(−1)i+1(ni)(n−i)!=n! ∑i=1n(−1)i+1i!, and since a derangement is a permutation that leaves none of the n objects fixed, this implies Dn=n!−|S1∪⋯∪Sn|=n!∑i=0n(−1)ii!. On the other hand, n!=∑i=0n(ni)Di since we can choose n − i elements to be in their own place and derange the other i elements in just Di ways, by definition.

Growth rate From Dn=n!∑i=0n(−1)ii! and ex=∑i=0∞xii! by substituting x = −1 one immediately obtains that limn→∞Dnn!=limn→∞∑i=0n(−1)ii!=e−1≈0.367879…. This is the limit of the probability that a randomly selected permutation of a large number of objects is a derangement. The probability converges to this limit extremely quickly as n increases, which is why Dn is the nearest integer to ⁠n!/e⁠. The above semi-log graph shows that the derangement graph lags the permutation graph by an almost constant value. More information about this calculation and the above limit may be found in the article on the statistics of random permutations.

Asymptotic expansion in terms of Bell numbers An asymptotic expansion for the number of derangements in terms of Bell numbers is as follows: Dn=n!e+∑k=1m(−1)n+k−1Bknk+O(1nm+1), where m is any fixed positive integer, and Bk denotes the k th Bell number. Moreover, the constant implied by the big O-term does not exceed Bm + 1.

Generalizations The problème des rencontres asks how many permutations of a size-n set have exactly k fixed points. Derangements are an example of the wider field of constrained permutations. For example, the ménage problem asks if n opposite-sex couples are seated man–woman–man–woman–… around a table, how many ways can they be seated so that nobody is seated next to his or her partner? More formally, given sets A and S, and some sets U and V of surjections A → S, we often wish to know the number of pairs of functions (f, g) such that f is in U and g is in V, and for all a ∈ A, f(a) ≠ g(a); in other words, where for each f and g, there exists a derangement φ of S such that f(a) = φ(g(a)). Another generalization is the following problem:

… excerpt ends here. Continue reading the full article.

Illustrations

Derangement: Number of possible permutations and derangements of .mw-parser-output .texhtml{font-family:"Nimbus Roman No9 L","Times New Roman",Times,serif;font-size:118%;line-height:1;font-variant-numeric:lining-nums tabular-nums;font-kerning:none}.mw-parser-output .texhtml .texhtml{font-size:100%}.mw-parser-output .texhtml-big{font-size:165%}.mw-parser-output .mvar{font-style:italic}@media(min-width:420px){.mw-parser-output .texhtml{white-space:nowrap}}n elements. n! (n factorial) is the number of n-permutations; !n is the number of derangements – n-permutations where all of the n elements change their initial places.
Number of possible permutations and derangements of .mw-parser-output .texhtml{font-family:"Nimbus Roman No9 L","Times New Roman",Times,serif;font-size:118%;line-height:1;font-variant-numeric:lining-nums tabular-nums;font-kerning:none}.mw-parser-output .texhtml .texhtml{font-size:100%}.mw-parser-output .texhtml-big{font-size:165%}.mw-parser-output .mvar{font-style:italic}@media(min-width:420px){.mw-parser-output .texhtml{white-space:nowrap}}n elements. n! (n factorial) is the number of n-permutations; !n is the number of derangements – n-permutations where all of the n elements change their initial places.
Derangement: The 9 derangements (from 24 permutations) are highlighted.
The 9 derangements (from 24 permutations) are highlighted.
Derangement: ∫∞0 (t − 1)z e−t dt in the complex plane
∫∞0 (t − 1)z e−t dt in the complex plane

Worked examples

Example 1 — a first encounter with Derangement

Start with the simplest possible case. Write down what Derangement claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Derangement before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Derangement ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Derangement

In research
Derangement appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Derangement in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Derangement is common in secondary-school and first-year university syllabi. It links to neighbouring topics E (mathematical constant), Fixed points (mathematics), Integer sequences, so understanding it makes those chapters shorter.
In everyday life
Look for Derangement outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Derangement” →

How to study Derangement in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Derangement means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Derangement out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Derangement in simple terms?

In combinatorial mathematics, a derangement is a permutation of the elements of a set in which no element appears in its original position. In other words, a derangement is a permutation that has no fixed points.

Why does Derangement matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Derangement?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Derangement.

Tags

  • E (mathematical constant)
  • Fixed points (mathematics)
  • Integer sequences
  • Permutations

Keep exploring