I was recently toying with Wolfram|Alpha with the expansion of $e^x$ and I noticed a strange thing. On substituting $x=-1$ (if it is allowed), I get on the RHS the strange looking infinite expression of $$e^{-1}=\left(1-\frac{1}{1!}+\frac{1}{2!}-\frac{1}{3!}+\ldots+(-1)^n\frac{1}{n!}+\ldots\right)$$ (ignoring for the time being all terms after ${n+1}^{th}$ term), which I find very similar to the formula I learned for the number of derangements of $n$ things (if we ignore the infinite nature of the expansion of $e^x$ and just look at the first $n+1$ terms for some time) $$D_n=n!\left(1-\frac{1}{1!}+\frac{1}{2!}-\frac{1}{3!}+\ldots+(-1)^n\frac{1}{n!}\right)$$ So is this similarity just a coincidence? Or are they related in any way whatsoever? Because I am not able to relate them in any way; after all, $e$ and derangements in combinatorics seem like two very different topics to me. But their similarity is very striking... Even for a beginner like me.
3 Answers
The following is very heuristic:
The probability that a given one of the $n$ things is not at his proper place is $1-{1\over n}$. Assuming that the $n$ things are placed properly or improperly independently of each other the probability that all things are improperly placed computes to $$\left(1-{1\over n}\right)^n\doteq{1\over e}\ .$$

- 226,825
-
@ChristianBlatter Your equality holds when $n\to\infty$ only. So in general it is wrong to make such a statement. Say $n=2,3,4,5,6$ and then what you say is not right. – SchrodingersCat Dec 12 '15 at 15:15
-
3@Aniket: It is a folklore fact that even for moderate $n$ the probability in question is $\doteq{1\over e}$ with high accuracy. I just gave a bogus "proof" for this that circumvents the combinatorics.. – Christian Blatter Dec 12 '15 at 15:26
-
@ChristianBlatter Perhaps I didn't get you before.Thanks for clarifying. :-) – SchrodingersCat Dec 12 '15 at 15:28
It's from the generating function theory and the fact that we have a nice recursion formula for derangements: $d_{n+1} = n(d_n + d_{n-1})$ for $n \ge 1$. For any counting problem like this where the answer is $d_n$ for $n$ objects, we can define a formal exponential generating function $D(x) = \sum_{n=0}^\infty d_n \frac{x^n}{n!}$ (there is also a normal generating function without the $n!$ term).
Know we can try to determine the function $D(x)$ from the recursion, and from that get the coefficients $d_n$, this is worked out very nicely in this answer, where you will see the connection.

- 242,131
There's a lot of stuff to say here. First, here is one way of interpreting the result: asymptotically, the probability that a random permutation is a derangement is $e^{-1}$. There are a lot of related claims you can write down. Here are two:
- For fixed $k$, asymptotically, the probability that a random permutation has exactly $k$ fixed points is $\frac{e^{-1}}{k!}$.
- For fixed $k$, asymptoically, the probability that a random permutation has no $k$-cycles is $e^{- \frac{1}{k}}$.
So basically there's a lot of $e$ business going on. My preferred way to think about all this is via a very large and beautiful generating function called the exponential formula, which you can read about here and here. It describes the cycle types of all permutations simultaneously, and specializing it in various ways extracts various information about cycle types. See, for example, here.

- 419,620