5.3. The Matching Problem#
This famous problem has been stated variously in terms of hats and people, letters and envelopes, tea cups and saucers – indeed, any situation in which you might want to match two kinds of items seems to have appeared somewhere as a setting for the matching problem.
In the letter-envelope setting there are
“Real life” settings aside, the problem is about the number of fixed points of a random permutation. A fixed point is an element whose position is unchanged by the shuffle.
5.3.1. Matches at Fixed Locations#
Consider a random permutation of
See More
We know that there are
Put letter
in envelope .Once that is done, the remaining
letters can be permuted in ways.
So
Notice the absence of
Now fix any pair of positions
Put letter
in envelope and letter in envelope .Once that is done, the remaining
letters can be permuted in ways.
So
The second term in the product is
You should check by induction that for
5.3.2. No Matches#
If letters falling in the right envelopes are good events, then the worst possible event is every letter falling in a wrong envelope. That is the event that there are no matches, and is called a derangement. Let’s find the chance of a derangement.
See More
The key is to notice that the complement is a union, and then use the inclusion-exclusion formula.
where
By the inclusion-exclusion formula and our calculations above,
If those sums look hair-raising, look again. None of the terms being added has an index (
The number of terms in the first sum is
In the third sum the number of terms is
and so on. Therefore
Remember that
So the chance of a derangement is
when
In the language of random variables, let
For large
roughly. When
5.3.3. Matches#
For
There are
ways of fixing the places for the matches.Once the places have been fixed, you have to get a match at those
places; the chance of that is .Given that there are matches at those
places, there are letters left, with the corresponding envelopes, and there has to be a derangement of these. The conditional chance is equal to .
So for a fixed
We will see later that these probabilities form a Poisson distribution on the infinite set of non-negative integers.