Four users each receive one of ten labels, independently and with all labels equally likely. Users 1 and 2 match with probability , which sounds small, yet the probability that some pair of users matches is almost one half. The difference comes from the six pairs among four users and from the fact that the matching pair is not named in advance. This lesson computes such collision probabilities through the complement, states the model that makes the counting valid, and shows what changes when there are more users than labels or when the labels are not equally likely.
Key terms
Collision
Definition Suppose each of individuals receives one of categories, such as labels or birthdays. A collision is the event that at least two individuals receive the same category. The matching individuals are not specified in advance, and a collision includes outcomes in which several pairs match at once. The complement of a collision is the event that the individuals all receive different categories, called no collision, so by The Complement Rule, .
In plain words A collision asks whether any two individuals match, not whether one particular pair does. Many pairs can match in one outcome, so it is easier to count the outcomes with no match at all.
Example Four users receive labels from to , and the outcome lists the labels of users 1 to 4 in order. The outcome is a collision, since users 1 and 3 match. The outcome is also a single collision outcome, even though three pairs match in it. The outcome has no collision.
No-collision probability
Definition Assume that each of individuals receives one of categories independently, with probability for each category, and record the outcome as the ordered list of the categories. The list is ordered because its positions identify the individuals. Under these assumptions the ordered records are equally likely. By the product rule, the number of records with all categories different is
since each new individual must avoid the categories already used. Dividing by gives
The formula holds for every whole number . For and the product equals , since there is no pair that could match, and for it contains the factor .
In plain words Assign the categories one individual at a time. The first can take any category, and in a record with no collision each later one avoids all categories already taken, so the number of allowed choices drops by one each time. The total number of records stays , because the assignment itself still allows every category for every individual.
Example For four users and ten labels there are records, and of them have four different labels. So
and the probability of a collision is .
Birthday problem
Definition The birthday problem asks for the probability that at least two of people share a birthday. The standard model ignores February 29, gives each of the remaining days probability , and treats the birthdays of different people as independent. Under these assumptions it is the collision problem with , so
The model is an idealization. Actual birth dates are not spread exactly evenly over the year, and a group that contains twins does not have independent birthdays.
In plain words The question concerns any two people in the group, not a match with one particular person. Even a group of moderate size contains many pairs, and each pair is another chance for a match.
Example For people the model gives a shared birthday with probability about , computed from the exact product. For people it is about , so is the smallest group for which the model probability exceeds one half. The people form pairs, and that large number of pairs explains why a match is likely.
Match of a specified pair
Definition A specified-pair match is the event that two individuals named in advance, for example users 1 and 2, receive the same category. Under the uniform independent model its probability is , whatever the number of other individuals, because whatever category user 1 receives, user 2 receives the same one with probability . A collision is the union of the specified-pair events. When these events can occur together, so their probabilities cannot simply be added. For every their sum gives the union bound
In plain words One named pair has one chance to match. A collision collects the chances of every pair, so it is at least as likely, and with many pairs and many categories it can be far more likely. The chances overlap, so adding them overstates the answer whenever several pairs can match at once.
Example For four users and ten labels, users 1 and 2 match with probability . There are pairs, and is an upper bound for a collision. The exact value is smaller because records such as make several pair events happen at once. Of the records, make two or more pairs match, and each of them is counted more than once in the sum. For birthdays the bound is likewise larger than the exact value, about .
Pigeonhole principle
Definition If objects are placed into boxes and , then at least one box contains at least two objects. More generally, some box contains at least objects. In collision terms, if individuals each receive one of categories, a collision is certain, so , whatever the category probabilities and whether or not the assignments are independent. Under the uniform model the no-collision product agrees, since it contains a zero factor when .
In plain words With more individuals than categories there is no way to give everyone a different category, and no probability calculation is needed.
Example Seven users with six labels must produce a collision, and in the -day birthday model any people include two with the same birthday. With six users and six equally likely labels a collision is not certain, but it is very likely, since
which is about .
Nonuniform categories
Definition Suppose each individual receives category with probability , where . When the are not all equal, the ordered records are no longer equally likely, and the ratio of counts behind the no-collision formula no longer applies. Probabilities must then be computed from the actual . For two individuals who choose independently with these probabilities, the events that both receive category are disjoint for different , so
This sum is always at least , with equality exactly when every . More generally, for any number of individuals who choose independently with the same category probabilities, the collision probability is never smaller than it is when all categories are equally likely. For birthdays this means that, as long as people are independent and share one distribution over days, unequal birth frequencies cannot lower the chance of a shared birthday below the uniform value.
In plain words Unequal probabilities make some categories popular, and independent individuals tend to meet in them. So with independent choices a match is never less likely than with equally likely categories.
Example Two independent choices from four labels with probabilities , , and match with probability
compared with when the four labels are equally likely. Counting matching records among would give for both models, which is wrong for the unequal one, because the record has probability while the record has probability .
Check yourself
- Three users independently receive one of six equally likely labels. Find the probability of a collision and the probability that users 1 and 2 match. What is the probability of a collision for seven users and six labels?
Show the answer
There are equally likely ordered records, and of them have three different labels. So
which is about . Users 1 and 2 match with probability . The collision probability is larger because it also includes matches that involve user 3, while an outcome with several matches is still counted once. With seven users and six labels a collision is certain by the pigeonhole principle, so its probability is .
- In the -day birthday model with people, one person computes the probability that someone else in the group shares her birthday as . She concludes that the value for the birthday problem must be wrong. Explain the discrepancy.
Show the answer
Her calculation is correct for a different event, a match with one specified person. Given her birthday, each of the other people independently misses it with probability , which gives
The birthday problem asks about all pairs in the group, including the pairs that do not involve her. Both numbers are right for their own events, and the collision event contains hers and is much more likely.
- Two people independently choose one of three labels with probabilities , and . A classmate lists the ordered records, finds with matching labels and answers . Find the correct probability of a match and explain the error.
Show the answer
The match events for the three labels are disjoint, so
The classmate treated the records as equally likely, but they are not. The record has probability , while has probability . A ratio of record counts gives the probability of every event exactly when the records are equally likely. As expected for unequal label probabilities, the answer is larger than the uniform value .