Imagine a group of people trying to pick up their own hats after a party, only to discover that nobody gets the correct hat. Surprisingly, mathematics has a special counting concept for such situations, known as a derangement. In combinatorics, a derangement refers to a permutation in which no element appears in its original position. This fascinating concept is widely used in probability, cryptography, coding theory, matching problems, and advanced counting techniques. Understanding derangements helps students develop a deeper grasp of permutations and combinatorial reasoning, making it an important topic for mathematics enthusiasts and competitive examination aspirants. In this article, we will explore the concept of derangements, their definition, formulas, properties, applications, and solved examples in a simple and systematic manner.
This Story also Contains
Derangement is a special concept in permutations where objects are rearranged in such a way that none of them remains in its original position. It is one of the most interesting topics in combinatorics because it combines counting techniques, probability, and logical reasoning. Derangement problems frequently appear in advanced mathematics, probability theory, cryptography, and competitive examinations.
In simple terms, a derangement occurs when every object is placed in the wrong position.
For example, suppose three students A, B, and C are assigned seats 1, 2, and 3 respectively.
Original arrangement:
A → 1
B → 2
C → 3
A derangement could be:
A → 2
B → 3
C → 1
Since no student occupies the assigned seat, this arrangement is a derangement.
A derangement is a permutation of a set of objects in which no element appears in its original position.
If there are $n$ distinct objects, the number of derangements is denoted by:
$!n$
or
$D_n$
For example:
$D_2=1$
$D_3=2$
$D_4=9$
Derangements are sometimes called complete permutations.
Derangement plays an important role in combinatorial mathematics and probability.
Its importance includes:
Understanding advanced counting techniques.
Solving matching and assignment problems.
Studying probability distributions.
Designing cryptographic systems.
Developing algorithms in computer science.
Derangement problems are also common in JEE, Olympiads, CAT, GATE, and university-level mathematics.
Derangement appears naturally in many practical situations.
Everyone gives a gift, but nobody receives their own gift.
Students are assigned seats different from their allotted seats.
Letters are placed in envelopes such that no letter goes into its correct envelope.
No participant is matched with the original assigned partner.
These situations can all be analyzed using derangements.
Before studying formulas, it is important to understand how derangements relate to permutations.
A permutation is any arrangement of objects.
For example, the permutations of A, B, and C are:
ABC, ACB, BAC, BCA, CAB, CBA
A derangement is a special type of permutation where no object remains in its original position.
Thus:
Every derangement is a permutation, but not every permutation is a derangement.
A fixed point is an element that remains in its original position after a permutation.
For example:
Original arrangement:
ABCD
Permutation:
ABDC
Here:
A remains fixed.
B remains fixed.
Therefore, this permutation contains two fixed points.
A derangement contains no fixed points.
A permutation becomes a derangement only when:
Every element moves.
No element remains in its original position.
The number of fixed points equals zero.
For example:
Original:
ABC
Derangement:
BCA
Here:
A is not in position 1.
B is not in position 2.
C is not in position 3.
Hence it is a derangement.
| Permutation | Derangement |
|---|---|
| Any arrangement of objects | Arrangement with no fixed points |
| Original positions may remain | Original positions cannot remain |
| Counted using $n!$ | Counted using $D_n$ |
| General counting method | Special counting method |
Derangement has a rich history dating back several centuries.
The derangement problem originated from practical matching problems involving misplaced objects.
Mathematicians became interested in determining how many arrangements were possible when every object had to be misplaced.
This led to one of the earliest applications of the inclusion-exclusion principle.
The most famous derangement example is the Hat-Check Problem.
Suppose:
$n$ guests attend a party.
Each guest checks a hat.
The hats are returned randomly.
The question is:
How many ways can the hats be returned so that nobody receives their own hat?
This classic problem introduced the concept of derangements.
The French mathematician Pierre Raymond de Montmort studied the hat-check problem extensively in the early 1700s.
His work helped establish the modern theory of derangements and inclusion-exclusion counting.
He was among the first mathematicians to derive formulas for derangement numbers.
Over time, derangement theory expanded into:
Combinatorics
Probability
Computer science
Cryptography
Operations research
Today, derangements remain an important topic in advanced mathematics.
A direct formula exists for calculating the number of derangements.
The number of derangements of $n$ objects is:
$D_n=n!\left(1-\frac{1}{1!}+\frac{1}{2!}-\frac{1}{3!}+\cdots+(-1)^n\frac{1}{n!}\right)$
This formula is derived using the inclusion-exclusion principle.
In the formula:
$D_n=n!\left(1-\frac{1}{1!}+\frac{1}{2!}-\cdots\right)$
$D_n$ = Number of derangements
$n$ = Total objects
$n!$ = Total permutations
The alternating series adjusts for fixed positions.
Derangements are commonly written as:
$!n$
Examples:
$!1=0$
$!2=1$
$!3=2$
$!4=9$
$!5=44$
This notation is widely used in combinatorics.
For large values of $n$:
$D_n\approx\frac{n!}{e}$
where:
$e\approx2.71828$
This approximation becomes extremely accurate as $n$ increases.
The standard derangement formula is obtained using the inclusion-exclusion principle.
The inclusion-exclusion principle counts arrangements while removing overcounted cases.
It is frequently used when several restrictions exist simultaneously.
For $n$ objects:
Total permutations:
$n!$
This count includes arrangements with fixed positions.
Suppose:
$A_i$
represents the event that the $i^{th}$ object remains fixed.
Using inclusion-exclusion:
Subtract arrangements with one fixed point.
Add arrangements with two fixed points.
Subtract arrangements with three fixed points.
Continue until all cases are considered.
Applying inclusion-exclusion yields:
$D_n=n!\left(1-\frac{1}{1!}+\frac{1}{2!}-\frac{1}{3!}+\cdots+(-1)^n\frac{1}{n!}\right)$
This becomes the standard derangement formula.
Derangements can also be computed recursively.
The recurrence relation is:
$D_n=(n-1)(D_{n-1}+D_{n-2})$
for:
$n\ge2$
with:
$D_0=1,\quad D_1=0$
Consider object 1.
It can move to any of the remaining:
$(n-1)$
positions.
Two possibilities arise:
A swap occurs.
A longer cycle occurs.
Combining both cases leads to:
$D_n=(n-1)(D_{n-1}+D_{n-2})$
Using:
$D_0=1$
$D_1=0$
we obtain:
$D_2=1$
$D_3=2$
$D_4=9$
$D_5=44$
and so on.
The recurrence relation:
Avoids lengthy calculations.
Is efficient for programming.
Simplifies computation for large values of $n$.
Derangement numbers exhibit several interesting mathematical properties.
| n | $D_n$ |
|---|---|
| 1 | 0 |
| 2 | 1 |
| 3 | 2 |
| 4 | 9 |
| 5 | 44 |
| 6 | 265 |
Derangements are closely related to factorials.
Since:
$D_n\approx\frac{n!}{e}$
their growth rate is similar to factorial growth.
As $n$ increases:
Derangement numbers grow rapidly.
The ratio $\frac{D_n}{n!}$ approaches $\frac{1}{e}$.
Some important properties are:
$D_0=1$
$D_1=0$
$D_n=(n-1)(D_{n-1}+D_{n-2})$
$D_n\approx\frac{n!}{e}$
Derangement values are often tabulated for quick reference.
| n | $D_n$ |
|---|---|
| 1 | 0 |
| 2 | 1 |
| 3 | 2 |
| 4 | 9 |
| 5 | 44 |
| 6 | 265 |
| 7 | 1854 |
| 8 | 14833 |
| 9 | 133496 |
| 10 | 1334961 |
| n | $n!$ | $D_n$ |
|---|---|---|
| 4 | 24 | 9 |
| 5 | 120 | 44 |
| 6 | 720 | 265 |
Derangements form only a portion of all permutations.
The ratio:
$\frac{D_n}{n!}$
approaches:
$\frac{1}{e}\approx0.3679$
Thus approximately 36.79% of all permutations are derangements.
Students often memorize:
$D_2=1,;D_3=2,;D_4=9,;D_5=44,;D_6=265$
for fast calculations.
Derangements have many practical applications.
Used to calculate:
Matching probabilities.
Random assignment probabilities.
Secret Santa outcomes.
Used in:
Restricted permutations.
Counting problems.
Inclusion-exclusion applications.
Derangement concepts help design:
Secure mappings.
Encryption techniques.
Randomized systems.
Used in:
Algorithm design.
Data shuffling.
Assignment optimization.
Probability provides an interesting interpretation of derangements.
Probability that a random permutation is a derangement:
$P=\frac{D_n}{n!}$
As $n$ becomes large:
$\frac{D_n}{n!}\rightarrow\frac{1}{e}$
This creates a surprising connection between combinatorics and Euler's constant.
For large $n$:
$P\approx\frac{1}{e}$
or approximately:
$0.3679$
This means that for a large number of objects:
There is roughly a 36.79% chance that a random permutation will be a derangement.
Although closely related, derangements and permutations are not the same.
Permutation counts all arrangements.
Derangement counts only arrangements with no fixed points.
Permutation:
$P=n!$
Derangement:
$D_n=n!\left(1-\frac{1}{1!}+\frac{1}{2!}-\cdots+(-1)^n\frac{1}{n!}\right)$
Permutation asks:
"How many arrangements are possible?"
Derangement asks:
"How many arrangements are possible if nothing stays in its original position?"
| Feature | Permutation | Derangement |
|---|---|---|
| Definition | Any arrangement | Arrangement with no fixed points |
| Formula | $n!$ | $D_n$ |
| Original Positions Allowed | Yes | No |
| Uses | General counting | Restricted counting |
| Example | ABC, BAC, CAB | Only arrangements with no object fixed |
Derangement is an important topic in permutations, combinations, and combinatorics. The following books provide strong conceptual understanding and practice for derangement problems and advanced counting techniques.
| Book Name | Best For | Why It Helps |
|---|---|---|
| NCERT Mathematics Class 11 | School Students | Covers basic permutation and combination concepts |
| Higher Algebra – Hall & Knight | Advanced Mathematics | Detailed combinatorial methods |
| Problems Plus in IIT Mathematics – A. Das Gupta | Competitive Exams | Challenging counting problems |
| Skills in Mathematics Algebra – Arihant | Entrance Exams | Topic-wise practice questions |
| Cengage Algebra and Combinatorics | JEE Preparation | Advanced permutation and derangement concepts |
Derangement questions can often be solved quickly by recognizing common patterns and applying standard formulas instead of listing all arrangements manually.
| Trick | Explanation |
|---|---|
| Remember the Core Rule | In a derangement, no object remains in its original position |
| Use Standard Formula | Avoid manual counting for larger values of $n$ |
| Learn Small Values | Memorize derangements for $n=2,3,4,5$ |
| Apply Recurrence Relation | Useful for advanced questions |
| Compare with Total Permutations | Helps verify answers |
| Use Inclusion-Exclusion Principle | Basis of the derangement formula |
| Check Fixed Positions Carefully | One fixed position eliminates a valid derangement |
The following formulas are commonly used in derangement, permutation, and combinatorics problems.
| Concept | Formula |
|---|---|
| Derangement of $n$ Objects | $!n=n!\left(1-\frac{1}{1!}+\frac{1}{2!}-\frac{1}{3!}+\cdots+(-1)^n\frac{1}{n!}\right)$ |
| Recurrence Relation | $!n=(n-1)(!(n-1)+!(n-2))$ |
| Derangement of 1 Object | $!1=0$ |
| Derangement of 2 Objects | $!2=1$ |
| Derangement of 3 Objects | $!3=2$ |
| Derangement of 4 Objects | $!4=9$ |
| Approximation Formula | $!n\approx\frac{n!}{e}$ |
Example 1: In an examination, 5 students have been allotted their seats according to their roll numbers. Find the number of ways in which none of the students sits in the allotted seat. [JEE Main 2023]
Solution:
This is a derangement problem involving 5 students.
Using the derangement formula:
$D_5=5!\left(1-\frac{1}{1!}+\frac{1}{2!}-\frac{1}{3!}+\frac{1}{4!}-\frac{1}{5!}\right)$
$\begin{aligned}
D_5&=120\left(1-1+\frac{1}{2}-\frac{1}{6}+\frac{1}{24}-\frac{1}{120}\right)\
&=120\left(\frac{1}{2}-\frac{1}{6}+\frac{1}{24}-\frac{1}{120}\right)\
&=60-20+5-1\
&=44
\end{aligned}$
Hence, the number of ways is 44.
Example 2: The number of ways in which a matching arrangement of order $5\times5$ with one-to-one correspondence can be made such that none of the pairs is correctly matched is:
Solution:
We know that if $n$ objects are arranged such that none occupies its original position, then the number of derangements is:
$D_n=n!\left(1-\frac{1}{1!}+\frac{1}{2!}-\frac{1}{3!}+\cdots+(-1)^n\frac{1}{n!}\right)$
For $n=5$,
$\begin{aligned}
D_5&=5!\left(1-\frac{1}{1!}+\frac{1}{2!}-\frac{1}{3!}+\frac{1}{4!}-\frac{1}{5!}\right)\
&=120\left(\frac{1}{2}-\frac{1}{6}+\frac{1}{24}-\frac{1}{120}\right)\
&=60-20+5-1\
&=44
\end{aligned}$
Hence, the answer is 44.
Example 3: In how many ways can 10 letters be placed in 10 addressed envelopes such that exactly 9 letters are in the correct envelopes?
Solution:
Suppose exactly 9 letters are placed in their correct envelopes.
Then only one letter remains.
However, that remaining letter must also go into its correct envelope because all other envelopes have already been occupied correctly.
Therefore, such an arrangement is impossible.
Hence, the required number of ways is 0.
Example 4: A person writes letters to five friends and addresses the corresponding envelopes. In how many ways can the letters be placed in the envelopes such that at least two of them are in the wrong envelopes?
Solution:
Let the letters be $L_1,L_2,L_3,L_4,L_5$ and the corresponding envelopes be $E_1,E_2,E_3,E_4,E_5$.
The total number of ways of placing 5 letters into 5 envelopes is:
$5!=120$
The number of ways in which all letters are placed correctly is:
$1$
The number of ways in which exactly one letter is placed incorrectly is:
$0$
This is because if one letter is placed incorrectly, at least one more letter must also be misplaced.
Therefore,
$\begin{aligned}
\text{Required ways}
&=\text{Total ways}-\text{Ways with all letters correct}-\text{Ways with exactly one letter wrong}\
&=120-1-0\
&=119
\end{aligned}$
Hence, the answer is 119.
Example 5: The number of arrangements of all digits of 12345 such that at least 3 digits do not appear in their original positions is:
Solution:
The required arrangements consist of:
Using derangement values:
$D_3=2,\quad D_4=9,\quad D_5=44$
Therefore,
$\begin{aligned}
\text{Required arrangements}
&={}^{5}C_{3}D_{3}+{}^{5}C_{4}D_{4}+{}^{5}C_{5}D_{5}\
&=10(2)+5(9)+1(44)\
&=20+45+44\
&=109
\end{aligned}$
Hence, the answer is 109.
Derangement is closely related to permutations, combinations, probability, and counting principles. Exploring these topics helps build a stronger understanding of combinatorial mathematics and advanced counting techniques.
Frequently Asked Questions (FAQs)
The number of derangements of 5 objects is: $D_5=44$
This means there are 44 ways to arrange 5 objects such that none remains in its original position.
Because each person receives the wrong hat. Since nobody gets their own hat back, the arrangement satisfies the condition of a derangement.
The number of derangements of $n$ objects is given by:
$D_n=n!\left(1-\frac{1}{1!}+\frac{1}{2!}-\frac{1}{3!}+\cdots+(-1)^n\frac{1}{n!}\right)$
Check whether any object remains in its original position. If no object occupies its original place, the permutation is a derangement.
A derangement is a permutation in which none of the objects remains in its original position. In a normal permutation, objects may or may not stay in their original positions.