What is the probability that at least one letter is in the correct envelope?
Because the Derangement formula given above is also the components of a series to calculate the constant e the "all fails" for any number (n) envelopes can be given by
n!/e rounded to the nearest integer
The constant e has the value (to 9dp) of 2.718281828
So for the first few
envelopes, all-possibilities, all-fails (remember rounded to nearest integer)
2 2! = 2 2!/e = 1
3 3! = 6 3!/e = 2
4 4! = 24 4!/e = 9
5 5! = 120 5!/e = 44
6 6! = 720 6!/e = 265
7 7! = 5040 7!/e = 1854
etc.
Note that the overall probability tends to 1/e or about 37% - and gets closer to 1/e as the number of envelopes increases.
The value given by [n!/e] (where the square brackets denote "nearest integer to") is known as the subfactorial of n and can be written !n
For $3$ objects this is fairly trivial, as you can simply inspect each combination:
- $123:$ all letters are in the correct envelope
- $132:$ letter #$1$ is in the correct envelope
- $213:$ letter #$3$ is in the correct envelope
- $231:$ no letter is in the correct envelope
- $312:$ no letter is in the correct envelope
- $321:$ letter #$2$ is in the correct envelope
In $4$ out of $6$ combinations, there is at least one letter in the correct envelope.
Hence the probability of having at least one letter in the correct envelope is $\dfrac{4}{6}$.
A derangement is a permutation of the elements of a set such that none of the elements appear in their original position.given by: $$D(n)=n!\left(\frac1{0!}-\frac1{1!}+\frac1{2!}\cdots\frac1{n!}\right)=n!\sum_{k=0}^{n}\frac{(-1)^k}{k!}$$
So you ways of none in correct envelope is: $$D(3)=3!\left(\frac1{0!}-\frac1{1!}+\frac1{2!}-\frac1{3!}\right)=2$$
It is basically derived from inclusion-exclusion principle, and if you don't know the formula you can use inclusion-exclusion principle.
Also there are very few encelopes, i.e.3, so you can count manually too(the total arrangements).
The six assignments of the letters to the envelopes are 123, 132, 213, 231, 312, 321. How many of them have at least a letter in the right envelope ?
Divide this number by 6.
HINT
The assignments with at least one letter in the right envelope are of the form 1??, ?2? and ??3. Replacing the ? in every possible way gives 123, 132, 123, 321, 123, 213. And after removing duplicates, 123, 132, 321, 213.
Alternatively, consider all disallowed assignments (no letter in the right envelope): they must be of the form 2?? or 3??. Among 2??, only 231 is disallowed, and among 3??, only 312.
Let the envelopes be A, B, and C; designated for letters {A, B, C} in that order respectively. Now taking the complementary case where all letters are enclosed in the wrong envelopes, we have the permutations {B, C, A} and {C, A, B}, in that order. Overall, we have 3! = 6 ways of arranging the letters.
Hence the probability of enclosing the envelopes in the wrong order would be 2/6 = 1/3, whilst the required probability that at least one is in the right envelope would be 1 - 1/3 = 2/3.