# computing probability that at least one letter matches with envelope

Four letters to different insurers are prepared along with accompanying envelopes. The letters are put into the envelopes randomly. Calculate the probability that at least one letter ends up in its accompanying envelope.

### Attempt

Since this is tedioues, we can do

$$P(at \; least \; one ) = 1 - P( no \; match )$$

We notice that sample space is $4!$ since for letter 1 it has 4 choices but letter 2 has 3 choices and so on. Now, we wanna count in how many ways we get no match.

Let start with first one, we only have $3$ choices for this since it can go to either 2,3,4 envelope.

Now, as for the second one, we have to possibilities. If the first letter went to the second envelope, then the second letter now will have 3 different choices, but if the first letter didnt go to second letter, then the second letter will have 2 choices. Assume the former. Then we have 3 choices for this stage.

Now, for the third one (envelope 2 is taken already and assume letter 2 went to letter 1) then it would have 1 choice only and

last one must go to envelope 3.

Thus, we have $3 \times 3 \times 1 \times 1 = 9$ choices in total

Thus,

$$P(at \; least \; 1 \; letter) = 1 - \frac{9}{24}$$

IS this correct? I still feel as is something wrong because I assumed the letter 2 went to 1 and letter 1 went to envelope 2. Can we do that?

• The logic behind your attempt is incorrect. Consider the complement event that no letter is in its correct spot. This is what is known as a derangement. Read the wiki article if you like, otherwise as a hint as to how to count derangements correctly if you don't want to read the formulas there, consider using inclusion-exclusion. – JMoravitz Apr 19 '18 at 6:04
• A reminder, multiplication principle works only if the number of available options does not depend on previously made selections. The number of options for your first step is indeed $3$, but the number of options at the second step as you noted was either $3$ or $2$ depending on what was selected for the first step. Similarly, the number of options for the third will depend on what was selected for the first two steps and would be either $2$ or $1$ option. Since the number of options at certain steps here depends on what specific choices were made earlier, we may not just multiply. – JMoravitz Apr 19 '18 at 6:07
• Possible duplicate of What is the probability that no letter is in its proper envelope? – JMoravitz Apr 19 '18 at 6:11

The probability of at least one letter ending in the correct envelope is equal to 1 - p(no letter ends up in correct envelope)

the probability of no letter ending up in its correct envelope is given by derangement. The derangement of 4 comes out to be

$$D(4) = 4! \left( 1-\frac{1}{1!}+\frac{1}{2!}-\frac{1}{3!}+\frac{1}{4!} \right)$$ $$= 9$$

Therefore, the probability of at least one letter ending in the correct envelope is

$$P = 1- \frac{9}{24}$$ $$= \frac{15}{24}$$

The problem with your solution is that it does not take into account the different branches of decisions that can be made while placing letters. Such a method would ultimately reduce to just counting the cases in which derangement happens.

Extended Comment: This is a much-studied problem. You can find more by searching on 'derangements' and 'hatcheck problem'.

As in SarthakNigam's answer (+1), the probability of at least one correctly placed letter out of $n = 4$ is 15/24. An inclusion-exclusion argument shows that a generalized alternating series works for any $n > 1.$

If $X$ is the number of correctly placed letters, then a simple argument with indicator functions shows that $E(X) = 1,$ for all $n.$ By induction with indicator functions one can show that $Var(X) = 1,$ for $n > 1.$

If there are more than about 10 letters, then the distribution of $X$ is very nearly $\mathsf{Pois}(1),$ but $P(X = n-1) = P(X > n) = 0.$

Simulation (in R) of 10 million random permutations of four letters gives the following result (in which we get about three places of accuracy):

set.seed(419); m = 10^7;  n = 4
x = replicate(m,  sum(sample(4) == 1:4) )
table(x)/m
x
0         1         2         4
0.3749624 0.3331619 0.2500974 0.0417783
mean(x > 0); mean(x);  sd(x)
## 0.6250376   # aprx P(X > 0) = 15/24 = 0.625
## 1.00047     # aprx E(X) = 1
## 1.000532    # aprx SD(X) = 1