theory1
The Inclusion-Exclusion Principle
The inclusion-exclusion principle is an important combinatorial way to compute the size of a set or the probability of complex events. It relates the sizes of individual sets with their union.
Statement
The verbal formula
The inclusion-exclusion principle can be expressed as follows:
To compute the size of a union of multiple sets, it is necessary to sum the sizes of these sets separately, and then subtract the sizes of all pairwise intersections of the sets, then add back the size of the intersections of triples of the sets, subtract the size of quadruplesof the sets, and so on, up to the intersection of all sets.
The formulation in terms of sets
The above definition can be expressed mathematically as follows:
And in a more compact way:
The formulation using Venn diagrams
Let the diagram show three sets , and :

Then the area of their union is equal to the sum of the areas , and less double-covered areas , , , but with the addition of the area covered by three sets :
It can also be generalized for an association of sets.
The formulation in terms of probability theory
If are events and the probability of an event from to occur, then the probability of their union (i.e. the probability that at least one of the events occur) is equal to:
And in a more compact way:
Proof
For the proof it is convenient to use the mathematical formulation in terms of set theory:
We want to prove that any element contained in at least one of the sets will occur in the formula only once (note that elements which are not present in any of the sets will never be considered on the right part of the formula).
Consider an element occurring in sets . We will show it is counted only once in the formula. Note that:
- in terms which , the item will be counted times;
- in terms which , the item will be counted times - because it will be counted in those terms that include two of the sets containing ;
- in terms which , the item will be counted times;
- in terms which , the item will be counted times;
- in terms which , the item will be counted zero times;
This leads us to the following sum of binomial coefficients:
This expression is very similar to the binomial expansion of :
When , looks a lot like . However, the expression has an additional , and it is multiplied by . That leads us to . Therefore , what was required to prove. The element is counted only once.
Usage when solving problems
The inclusion-exclusion principle is hard to understand without studying its applications.
First, we will look at three simplest tasks "at paper", illustrating applications of the principle, and then consider more practical problems which are difficult to solve without inclusion-exclusion principle.
Tasks asking to "find the number of ways" are worth of note, as they sometimes lead to polynomial solutions, not necessarily exponential.
A simple task on permutations
Task: count how many permutations of numbers from to exist such that the first element is greater than and the last one is less than .
Let's count the number of "bad" permutations, that is, permutations in which the first element is and/or the last is .
We will denote by the set of permutations in which the first element is and the set of permutations in which the last element is . Then the number of "bad" permutations, as on the inclusion-exclusion formula, will be:
After a simple combinatorial calculation, we will get to:
The only thing left is to subtract this number from the total of to get the number of "good" permutations.
Comments
Post a Comment