What is the probability that no letter is in its proper envelope?

The formula for the derangement can be used directly. The number of derangements is $$n! \left(\frac{1}{2!} - \frac{1}{3!} + \frac{1}{4!} + \ldots + \frac{(-1)^n}{n!}\right)$$ put the value of n and get your answer. I guess this is the fastest and safest way. Hope it helpful. Cheers.


This is called Montmort's matching problem. Just Google it. Any short answer I can provide will not have the same clarity or completeness as any you will find on the web! If you still have difficulties, let me know. Or may be someone else will provide an answer.

In case I am not around when you post the comment, the final answer is $$ 44/5! \approx 0.36667$$

The notation that is used is $$ \frac{!5}{5!}$$ where $$ !n = \text{Round}\left(\frac{n!}{e}\right)$$

See https://en.wikipedia.org/wiki/Derangement for more details.


Slight variations of derangement are quick to compute once the all wrong solution is found.

Consider the two wrong solution out of seven envelopes. How many deranged solutions are possible.

7! = 5040

7 all wrong is 1854 = Derange(7) 6 all wrong is 265 = Derange(6) 5 all wrong is 44 = Derange(5) 4 all wrong is 9 = Derange(4) 3 all wrong is 2 = Derange(3) 2 all wrong is 1 = Derange(2) 1 all wrong is 0 = Derange(1)

One right in 7 envelops Derange(7-1) * 7!/(1!*(7-1)!) = 265 * 7 = 1855

Two right in 7 envelopes Derange(7-2) * 7!/(2!*(7-2)!) = 44 * 7 * 6 * 5 / 2 = 924

Three right in 7 envelopes Derange(7-3) * 7!/(3!*(7-3)!) = 9 * 7 * 6 * 5 * 4 / 6 = 315

Four right in 7 envelopes Derange(7-4) * 7!/(4!*(7-4)!) = 2 * 7 * 6 * 5 / 6 = 70

Five right in 7 Derange(7-5) * 7!/(5!*(7-5)!) = 1 * 7 * 6 / 2 = 21

Six right in 7 Derange(7-6) * 7!/(6!*(7-6)!) = 0 * 7 = 0

7 envelopes: 7 wrong: 1854 6 wrong: 1855 5 wrong: 924 4 wrong: 315 3 wrong: 70 2 wrong: 21 1 wrong: 0 0 wrong: 1

Sum: 1854 + 1855 + 924 + 315 + 70 + 21 + 0 + 1 = 5040 = 7!

Pattern extends to any size derangement so long as zero wrong equals 1.

Compute the Derangement values. from N to 0, and select the correct coefficient for the binomial theorem and the problem is done: worked and validated. Don Turnblade 10/22/2014

Also note: A recursion relationship exists inside the Derangement series:

Derange(2) = 1 Derange(3) = 3 * 1 - 1 = 2 Derange(4) = 4 * 2 + 1 = 9 Derange(5) = 5 * 9 - 1 = 44 Derange(6) = 6 * 44 + 1 = 265 Derange(7) = 7 * 265 - 1 = 1854

More fun still is that the Derangement series itself is driving to approximate e = 2.718...

2!/Derange(2) = 2/1 = 2 3!/Derange(3) = 6/2 = 3 4!/Derange(4) = 24/9 = 2 + 6/9 = 2.666... 5!/Derange(5) = 120/44 = 2 + 32/44 = 2.7272... 6!/Derange(6) = 720/265 = 2 + 190/265 = 2.71698... 7!/Derange(7) = 5040/1854 = 2 + 1332/1854 = 2.7184...

For N large n!/derange(n) = e = 2.718...

So, fast Derange computation is simply, N!/e

Derange(1) ~ 1!/2.718 = 0.4 ~ 0 Derange(2) ~ 2!/2.718 = 0.7 ~ 1 Derange(3) ~ 3!/2.718 = 2.2 ~ 2 Derange(4) ~ 4!/2.718 = 8.8 ~ 9 Derange(5) ~ 5!/2.718 = 44.1 ~ 44 Derange(6) ~ 6!/2.718 = 264.9 ~ 265 Derange(7) ~ 7!/2.718 = 1854.1 ~ 1854 Derange(8) ~ 8!/2.718 = 14832.9 ~ 14833

Even envelopes lead to odd Derange numbers Odd envelopes lead to even Derange numbers

The one right scenario is either one up or one down from the Derange number always. But the multiple wright scenarios can be a bugger to estimate, I posted a generalized solution.

In my case, the problem assists with a Modern Application: Computer Security

Deranged computer configurations / all possible computer configurations = 1/e

So, what are the odds that staff is allowing Deranged computer security settings.

W = vulnerable systems. M = total number of systems

Estimate of IT Derangement of Information Security Settings = W/M * e (All Wrong)

or variations (1 right, 2 right, 3 right, 4 right out of N possible right)

So, it is not so difficult to understand the following results from a vulnerability scanner on a corporate network.

5000 systems 1839 systems have one or more high or critical vulnerabilities that have not been patched in more than a month. Odds of InfoSec derangement 1836/5000 * e = 100% Welcome to business intelligence metrics directly from an InfoSec tool.