11

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 probability that every chocolate went back in a wrong spot?

According to him, the probability is $\frac{1}{e}$. Now the question is that how can we get that? To me, It is as interesting as Buffon's Needle problem, that is why I am eager to know the method to reach at $\frac{1}{e}$. I shall be thankful if you guys can provide me idea about what is happening.

Thanks

  • As an aside we can also write the number of derangements you can form with $n$ elements as $!n$. Thus the total number of arrangements is $n!$ and the probability everything goes back in the wrong spot is $\frac{!n}{n!}$. – ClownInTheMoon Dec 09 '16 at 20:00
  • Other places where e pops up unexpectedly can be found here. – John Bentin Dec 09 '16 at 20:05
  • 1
    An exact formula for the number of derangements is $\lfloor n! / e \rceil$, i.e. rounding to the nearest integer for $n \gt 0$. You are then looking at the limit of the probability $\dfrac{\lfloor n! / e \rceil}{n!}$, which is $\dfrac{1}{e}$ – Henry Dec 09 '16 at 20:07
  • As a really really rough approximation (for exact you should do inclusion/exclusion), notice that for $n$ places, the probability that 1 chocolate goes to the wrong place is $1 - 1/n$. Do it $n$ time is approximately $\left(1 - \frac 1n \right)^n$. This isn't exactly since these are not independent events. I've heard of this result being used by charlatans to amaze people that after shuffling a deck, not a single card went back to the correct place (works ~30% of the time). – DanielV Dec 09 '16 at 22:22

2 Answers2

10

It is not exactly $\dfrac{1}{e}$. However the probability approaches $\dfrac{1}{e}$ as the number of chocolates tends to infinity.

What we are counting are the permutations over $\{1,..,n\}$ which do not a have a fixed point that is $\sigma(i)\not=i$ for every $i$. These are called derangements. The usual method for counting derangements is by using the inclusion-exclusion principle which gives that there are $$n!\sum_{i=0}^n\dfrac{(-1)^i}{i!}$$ derangements over $\{1,..,n\}$. Since there are a total of $n!$ permutations it means the probability for random permutation to be a derangement is $$\sum_{i=0}^n\dfrac{(-1)^i}{i!}$$ which tends to $\dfrac{1}{e}$ as $n\rightarrow\infty$ according to the formula $$e^x=\sum_{i=0}^{\infty}\dfrac{x^i}{i!}$$

  • It approaches $1/{\rm e}$ really fast. Like, 3 or 4 chocolates is enough to get a really accurate estimate. – DanielV Dec 09 '16 at 22:27
  • 1
    An amusing application: Take 2 standard decks of 52 cards each. Shuffle one or both decks. Compare the $n$th card of one deck with the $n$th card of the other, for $n=1,...,52.$ Many people would be willing to bet that there is at least a 50% chance there will be no match. When the actual chance is very close to $1/e$ which is about $0.368.$ – DanielWainfleet Dec 10 '16 at 10:05
7

You are interested in the number of Derangements of the set of $100$ chocolates.

In this answer, the number of Derangements of $n$ items is shown to be $$ \sum_{k=0}^n(-1)^k\frac{n!}{k!} $$ which is the closest integer to $\frac{n!}e$ for $n\ge1$. Since there are $n!$ ways to arrange the $n$ items, the probability of getting all objects into the wrong spot is $$ \sum_{k=0}^n(-1)^k\frac1{k!}\approx\frac1e $$ Note that this is approximate, it is not exactly $\frac1e$. By the Alternating Series Theorem, the error is less than $\frac1{(n+1)!}$ which is very small, but not $0$. For $n=100$, the error is less than $\frac1{101!}\approx1.06\times10^{-160}$. In particular:

$$ \begin{array}{r} \begin{array}{r}\scriptsize{p =0.3678794411714423215955237701614608674458111310317678345078368016974614957448998}\\ \scriptsize{03357147274345919643746627325276843995208246975792790129008626653589494098783092\color{#C00}{299}}\end{array}\\[12pt] \begin{array}{r}\scriptsize{\frac1e =0.3678794411714423215955237701614608674458111310317678345078368016974614957448998}\\ \scriptsize{03357147274345919643746627325276843995208246975792790129008626653589494098783092\color{#C00}{194}}\end{array} \end{array} $$

robjohn
  • 345,667
  • However, for $n\ge 1$ the number of derangements is the integer nearest $\frac{n!}e$, so the approximation is very good even for rather small $n$: the relative error is a little under $2$% for $n=4$, a little under a third of a percent for $n=5$, and less than $0.05$% for $n=6$. – Brian M. Scott Dec 09 '16 at 20:14
  • @BrianM.Scott: I did mention that the number of derangements is the closest integer to $\frac{n!}e$. The approximation is very good, but it is still an approximation. That is, the probability is not $\frac1e$. I have added a bound on the error. – robjohn Dec 09 '16 at 20:17
  • Oh, I agree that it’s important to note that it’s an approximation; I just thought that it was also a good idea to indicate how very good an approximation it is, since this explains why someone would use it without comment. (I did upvote, by the way.) – Brian M. Scott Dec 09 '16 at 20:27