I recently gave an exam in my statistics course, which turned out to be an excellent example for the matching problem, a classic problem in probability. There were 66 students taking the test. I wrote down the names of the students in the order of turning in the exam. The following table shows the positions of the students in alphabetical order and in the order they turned in the exam.
For example, the first student in the alphabetical order was the 12th student who turned in the exam. The first student who turned in the exam was the 37th student in the alphabetical order. It turned out that there was a student who had the same position in both orders. Such a student is called a match (see the following table).
This example captures the essence of a classic problem in probability called the matching problem. There are many other colorful descriptions of the matching problem. All of them involve the pairing of two orderings on a set of objects. We have a set of objects or items that are ordered in some natural way. Then we scramble the items randomly (or according to some ordering that is unpredictable in advance). Whenever an item has the same position in both the original order and in the scrambled order, it is called a match.
In our exam example, one version of the matching problem asks: what is the probability that there is at least one student that is a match?
In fact, in matching two orderings, such as the one described here, a match happens more often than not. The probability of having at least one match is roughly 0.63. Specifically, when is the number of students taking the exam, the probability of finding at least one match approaches as . The derivation of this probability is based on the inclusion-exclusion principle and is discussed in the blog post called The Matching Problem.
Even though the probability of having at least one match is a function of (the number of items), the probability converges to pretty rapidly. Thus for all practical purposes, we can say that the probability of having at least one match is 0.63 (roughly two-third), whenever the number of items involved in the random scrambling is reasonably large (as in the 66 students taking the exam).
Instead of finding the probability of having at least one match, we can also ask for the probability of having exactly matches, where is any integer from to . Let be the number of matches when we match the “exam turning in” order with the alphabetical order for students. The probability function is derived in the blog post called More About the Matching Problem.
The blog post More About the Matching Problem also points out that is approximated by the Poisson distribution with parameter . Thus we have:
The following are the first 4 probabilities of .
In the random experiment of matching two orderings on the same set of objects, about 37% of the time, there is no match and about 37% of the time there is exactly one match. Having no matches and having exactly one match are the mostly scenarios (occurring about 74% of the time). Having 2 matches is possible, but only happens about 18% of the time. It is rare to have 3 ore more matches.
Another interesting observation is that if a match occurs, it is mostly likely that there is only one match (such as the example discussed here).
There are many colorful descriptions of the matching problem. The possibilities are limitless. One example is that of married couples going to a ball room dancing class. The instructor randomly assign the ladies to the gentlemen as dancing partners. A match occurs if a wife is assigned as
the dancing partner of her husband.
A previous blog post (Tis the Season for Gift Exchange) presents an example involving gift exchange. Each person attending a party brings a gift for gift exchange. The gifts are put in a pile and each person randomly selects a gift from the pile. A match occurs if a person selects his or her own gift.
In another blog post (A lazy professor who lets students do their own grading), a professor randomly returns quizzes to the students for grading. A match occurs if a students is assigned his or her own quiz.