A constructed collection of records has records with flag A, with flag B and with flag C. The three counts add up to , more than the number of records, because a record with several flags is counted once for each of them. To find how many records carry at least one flag, the overlaps have to be removed, and in the right amounts. This lesson derives that correction for three events, splits the picture into its disjoint Venn regions, and uses the regions to answer questions such as exactly one flag or exactly two flags.
Key terms
Inclusion-exclusion principle
Definition For any two events and in a probability model,
as in The Addition Rule. For any three events , and ,
The same identities hold for the numbers of elements of finite sets, with in place of . Neither version needs independence or equally likely outcomes. Equal likelihood matters only when counts are turned into probabilities by dividing by the size of a finite sample space . The reason for the signs is visible one outcome at a time. An outcome in exactly one of the events is counted once by the first three terms and never again. An outcome in exactly two is counted twice and subtracted once. An outcome in all three is counted three times, subtracted three times and added back once. So every outcome of the union is counted exactly once, and outcomes outside the union are never counted. For more events the pattern continues with alternating signs, adding the probabilities of the single events, subtracting those of all pairwise intersections, adding those of all triple intersections and so on. Later cards use the shorthand
in which the three-event formula reads .
In plain words Adding the three events counts the overlaps too often. Subtracting the pairwise overlaps repairs the double counts but removes the center of the diagram completely, so the center is added back once.
Example For the records, the pairwise intersections have , and records, and records carry all three flags. Then
If one record is chosen with all records equally likely, the probability of at least one flag is , and by the complement rule the probability of no flag is .
Pairwise intersection
Definition For three events , and , the pairwise intersections are , and . The event contains every outcome that lies in both and , including the outcomes that also lie in . The outcomes in and but not in form the smaller event , with
Inclusion-exclusion uses the full pairwise intersections, not these smaller pieces.
In plain words The event that and both occur places no condition on . An outcome in all three events belongs to every pairwise intersection.
Example Of the records with flags A and B, also carry flag C, so records have flags A and B and no flag C. Likewise, records have A and C without B, and have B and C without A. Using these exactly-two counts in place of the pairwise totals gives , which is wrong because each of the five triple-flag records is then counted four times instead of once, and .
Triple intersection
Definition The triple intersection is the event that all three events occur. The single and pairwise probabilities do not determine it in general, so it has to be given or found separately. Once they are fixed, the triple probability determines every other piece of the diagram, and it can take exactly those values for which all eight disjoint regions described in the next card have nonnegative probability.
In plain words The triple intersection is the center of the Venn diagram. Subtracting the pairs removes the center once too often, which is why it returns with a plus sign at the end.
Example Keep the single counts , and and the pairwise counts , and , but change the triple count from to . The union then has records instead of . The regions become with only A, with only B, with only C, then , and with exactly the pairs AB, AC and BC, and records with no flag. All of these are nonnegative, so the changed data describe a possible collection. With these single and pairwise counts, every triple count from to gives nonnegative regions, and the union then has between and records.
Disjoint Venn regions
Definition Three events split the sample space into eight disjoint regions, one for each choice of being inside or outside each event, from to . Every outcome lies in exactly one region, so the eight region probabilities add up to , and the seven regions inside the union add up to . The regions with exactly two events come from the pairwise card, the outside region has probability , and the region with only has probability
with the same pattern for only and only . Supplied single, pairwise and triple values describe a possible model exactly when all eight regions computed this way are nonnegative.
In plain words Fill the diagram from the inside out. Write the center first, then the three pieces with exactly two events, then the three pieces with one event, and finally the outside.
Example For the records with triple count , the regions are the following.
| Region | Records |
|---|---|
| Only A | |
| Only B | |
| Only C | |
| Only A and B | |
| Only A and C | |
| Only B and C | |
| All three | |
| None |
The seven inside regions add up to , matching inclusion-exclusion, and with the records outside they account for all records.
Exactly one of three events
Definition The event that exactly one of , and occurs is the union of the three disjoint regions , and , so its probability is the sum of their probabilities. In the shorthand of the first card,
To check the weights, follow one outcome. An outcome in exactly one event contributes to the right side. An outcome in exactly two events contributes , and an outcome in all three contributes .
In plain words Exactly one means that one of the events occurs and the other two do not. Its probability is smaller than that of at least one exactly when the event that two or more of them occur has positive probability.
Example For the records, the three one-flag regions hold records. The formula agrees, since . With all records equally likely, the probability of exactly one flag is , compared with for at least one flag.
Exactly two of three events
Definition The event that exactly two of , and occur is the union of the three disjoint regions , and . Each pairwise intersection contains the triple intersection, so includes every outcome of three times and every outcome in exactly two events once. Therefore
In plain words Start from the three pairwise totals and take the center out of each of them. Keeping the center once gives at least two instead of exactly two.
Example For the records, the exactly-two regions hold records, and the formula gives , so the probability is . At least two flags covers records. That is also the number of records with no flag, but only by coincidence in these constructed counts. The events “at least two flags” and “no flag” are disjoint and neither is empty, so they are certainly not the same event.
Check yourself
- A number is chosen uniformly from . Let , and be the events that it is divisible by , by and by . Find the probability that at least one of the events occurs, and list the outcomes where none occurs.
Show the answer
The single events have , and outcomes. Since , and are distinct primes, is the set of multiples of , namely , and , then is the set of multiples of , namely and , and contains only . A number in all three events would be a multiple of , and there is none up to . So
and the probability is . The six remaining outcomes are , , , , and , and the probability of none is .
- In the same experiment, find the probability of exactly one of the three events and the probability of exactly two.
Show the answer
With counts in place of probabilities, , and . Exactly two has outcomes, namely , , , , and , so its probability is . Exactly one has outcomes, namely , , , , , , and , so its probability is . As a check, is the size of the union.
- A report on constructed records gives records in each of , and , records in each pairwise intersection and records in the triple intersection. Inclusion-exclusion gives a union of records, which is less than . Can these data be correct?
Show the answer
No. The region with only A would have
records, and the same holds for only B and only C. A region cannot have a negative number of records, so no collection has these counts. The union formula alone did not reveal the problem, because looks plausible. Checking every disjoint region does.