Questions tagged [derangements]

For questions on derangements, permutations of a set without fixed points.

A derangement of a set $S$ is a mapping $\sigma:S\to S$ such that $\sigma(x)\neq x$ for all $x\in S$ (or, more briefly, a permutation of $S$ with no fixed points). For example, the mapping $1\mapsto 2,\ 2\mapsto 3,\ 3\mapsto 1$ is a derangement of $\{1,2,3\}$, while $1\mapsto 1,\ 2\mapsto 3,\ 3\mapsto 2$ isn't (since $1$ remains fixed). $S$ may be infinite, but the finite case has been much better studied.

The number of derangements of an $n$-element set is commonly denoted as $!n$ or $D_n$, and called "$n$ subfactorial". In this example, we can easily see that $!3=2$.

There are various formulas for $!n$. By Inclusion-Exclusion, it is possible to prove that

\begin{equation}!n=\sum_{i=0}^n(-1)^i\cdot\frac{n!}{i!}.\tag{1}\label{1}\end{equation}

By then comparing this sum to the Taylor series of $e^x$, we can prove the surprising equality

\begin{equation}!n=\left[\frac{n!}e\right]\quad(n\geq1),\tag{2}\label{2}\end{equation}

where $[x]$ denotes the closest integer to $x$, and $e$ denotes Euler's number.

Other recursive formulas also exist. By a simple counting argument, we may prove

\begin{equation}!n=(n-1)(!(n-1)+!(n-2)).\tag{3}\label{3}\end{equation}

And by making use of $(\ref{1})$, we may also prove that

\begin{equation}!n=n(!(n-1))+(-1)^n.\tag{4}\label{4}\end{equation}

239 questions
36
votes
3 answers

I have a problem understanding the proof of Rencontres numbers (Derangements)

I understand the whole concept of Rencontres numbers but I can't understand how to prove this equation $$D_{n,0}=\left[\frac{n!}{e}\right]$$ where $[\cdot]$ denotes the rounding function (i.e., $[x]$ is the integer nearest to $x$). This equation…
34
votes
6 answers

Why is the Derangement Probability so Close to $\frac{1}{e}$?

A derangement is a permutation $\sigma$ of $\{1,2,3,\dots,n\}$ such that $\sigma(i) \neq i$ for every $i$. A common application of inclusion/exclusion in undergraduate combinatorics and probability classes is to compute the number of derangements,…
25
votes
1 answer

Number of permutations of $n$ elements where no number $i$ is in position $i$

I am trying to figure out how many permutations exist in a set where none of the numbers equal their own position in the set; for example, $3,1,5,2,4$ is an acceptable permutation where $3,1,2,4,5$ is not because 5 is in position 5. I know that the…
Will specht
22
votes
2 answers

What's the General Expression For Probability of a Failed Gift Exchange Draw

My family does a gift exchange every year at Christmas. There are five couples and we draw names from a hat. If a person draws their own name, or the name of their spouse, all the names go back in a hat and we re-draw names. This happens maybe 7…
21
votes
3 answers

Combinatorial argument to prove the recurrence relation for number of derangements

Give a combinatorial argument to prove that the number of derangements satisfies the following relation: $$d_n = (n − 1)(d_{n−1} + d_{n−2})$$ for $n \geq 2$. I am able to prove this algebraically but not able to see the combinatorial example.
20
votes
2 answers

Why is $!n\pmod{n+k}$ a multiple of $k+1$ so often?

Motivation: A permutation of a set with no fixed points is called a derangement. The number of derangements of $n$ elements is notated as $!n$ or "$n$ subfactorial". The relation $$!n=(n-1)(!(n-1)+!(n-2))$$ implies that $!n\equiv0\pmod{n-1}$.…
ViHdzP
  • 4,854
  • 2
  • 20
  • 51
17
votes
3 answers

What's the probability that a given permutation has exactly $k$ fixed points.

Given a random permutation $\sigma \in S_n$ from $[n] \to [n]$ in a uniform probability space, what is the probability that $\sigma $ has exactly $k$ fixed points for a given $k$ between $1$ and $n$? In other words: what is the probability that…
15
votes
4 answers

Exponential Generating Function For Derangements

I have been introduced to the concept of exponential generating functions a few days ago. However, my understanding of them are still quite limited, and I would like to see some examples. Earlier this term, I derived a formula for the number of…
15
votes
4 answers

Number of Derangements of the word BOTTLE

I am wondering how to calculate the number of derangements for the word BOTTLE. I understand how to actually do the formula for derangements already. My issue is what do you do with repeated letters. Obviously, I will be over counting if I do the…
12
votes
4 answers

Can we count odd and even derangements nicely without taking a determinant?

It's not hard to see that $$\det \begin{pmatrix} 0 & 1 & 1 \\ 1 & 0 & 1 \\ 1 & 1 & 0 \end{pmatrix}$$ is equal to #(even derangements on 3 elements) - #(odd derangements on 3 elements) and similarly for larger n. It's not hard to calculate this…
11
votes
2 answers

$\frac{1}{e}=$"Probability that every chocolate goes into a wrong spot".

While watching a video by Po Shen Loh I found something strange. In the video, he said that: Suppose I have a box of chocolates having $100$ chocolates, and I drop them all on the ground, and then I try to put them all back in. What is the…
10
votes
1 answer

What is the probability that a geometric random permutation of $\mathbb{N}$ has no fixed points?

UPDATE. The case of geometric distributions seems to be solved: I think we have that for all $\lambda \in (0,1)$, $\mathbb{P}_{p_\lambda}(D(\mathbb{N})) = 0$. But the fundamental question that remains open is: does there exist a probability mass…
10
votes
4 answers

Proof of subfactorial formula $!n = n!- \sum_{i=1}^{n} {{n} \choose {i}} \quad!(n-i)$

Any hints about how to prove $$!n = n!- \sum_{i=1}^{n} {{n} \choose {i}}\,!(n-i)$$ from Wikipedia's article on derangements? Here, $!n$ is the number of derangements of a set with $n$ elements. I am not looking for proofs, just nudges in the right…
picakhu
  • 4,994
9
votes
1 answer

Counting some special derangements

A derangement of a list of $n$ distinct entries is a permutation of that list such that no corresponding entries match. It is well-known that the number of such derangements is the nearest integer to $n!/e$ where $e$ is the base of natural…
hardmath
  • 37,715
9
votes
1 answer

Counting permutations $\pi \in S_n$ such that $\pi(i) \neq i$ and $\pi(i) - k \not\equiv i \bmod n$.

Given integers $n > 2$ and $1 \leq k < n$, I'm interested in the set of permutations $$ \{\pi \in S_n : \pi(i) \neq i \text{ and } \pi(i) - k \not\equiv i \bmod n\}. $$ When $k = 1$, these are called ménage permutations (OEIS sequence A000179). I…
Peter Kagey
  • 5,438
1
2 3
15 16