One of the classic problems in probability theory is the “matching problem.” This problem has many variations and dated back to the early 18th century. There are many ways to describe the problem. One such description is the example of matching letters with envelops. Suppose there are letters with matching envelops (assume that each letter has only one matching envelop). Further suppose that the secretary stuffs the letters randomly into envelops. What is the probability that every letter is matched correctly, or that no letter is matched correctly or that exactly letters are stuffed into the correct envelops? In this post we solve a simpler problem. What is the probability that at least one letter is stuffed into a correct envelop? Though the answer is in terms of the total number of letters , it turns out that the answer is practically independent of and is roughly .

We first states the formula for the union of events. After we apply this formula to obtain the answer to the matching problem, we give a sketch of a proof to the formula.

**The union of n events**

For any events that are defined on the same sample space, we have the following formula:

where

,

,

Note that in the general term , the sum is taken over all increasing sequence , i.e. . For , we have the following familiar formulas:

**The matching problem**

Suppose that the letters are numbered . Let be the event that the letter is stuffed into the correct envelop. Then is the probability that at least one letter is matched with the correct envelop.

The probability of the intersection of events is:

.

For , we have . Note that the position is fixed and we permute the other positions. For , we have . Here, the and positions are fixed and we permute the other positions.

We now show that . There are number of ways to have matches out of letters. Thus we have:

Using the formula for the union of events, we have:

Note that the left hand side of the above is the first terms of the expansion of . Thus we have:

The above limit converges quite rapidly. Let . The following matrix shows the first several terms of this limit.

**Sketch of proof**

We now discuss the union formula:

The key idea is that any sample point in the union is counted exactly one time in the right hand side of the formula. Suppose that a sample point is in exactly events . Then the following shows the number of times the sample point is counted in each expression:

times

times

times and so on

Thus the sample point in question will be counted exactly times in the right hand side of the formula.

The following is the derivation that .

Excellent site

Can you solve this problem for me

I have 4 (say x) identical chocolates (A,A,A, A) and 3 (say y) additional chocolates (B,C,D) which are completely distinct (as identified above) and I wish to distribute it among 3 (say z) children (P,Q.R,) such that each child P,Q.R, gets atleast one chocolate. How many ways can I distribute – I am looking at a simple formulae (in x,y,z)

[ It is easy if the condition given in last line of each person getting one chocolate is not stated in which case 4 identical gets distributed in

(4 + 5 -1) C ( 5 -1) ways and 5^3 ways for non identical chocolates and we multiply the two results ]

I can get the answer using different cases but becomes long

next part of the question is if 2 more children are added (making it > 4) how does this formula change

Hi Dan,

Can you consider a write up for the second part:

What is the probability that exactly k of the letters match their envelope?

The probability that there are exactly k matches is derived in the following post:

More about the matching problem

What’s Going down i am new to this, I stumbled upon this I’ve

found It positively useful and it has aided me

out loads. I am hoping to contribute & help other customers

like its helped me. Good job.