Net
Inclusion-Exclusion and its various Applications
Inclusion-Exclusion and its various Applications
In the field of Combinatorics, it is a counting method used to compute the cardinality of the union set. According to basic Inclusion-Exclusion principle:
- For 2 finite sets
and
, which are subsets of Universal set, then
and
are disjoint sets.
Hence it can be said that,
.
- Similarily for 3 finite sets
,
and
,
Principle :
Inclusion-Exclusion principle says that for any number of finite sets, Union of the sets is given by = Sum of sizes of all single sets – Sum of all 2-set intersections + Sum of all the 3-set intersections – Sum of all 4-set intersections .. +
Sum of all the i-set intersections.
In general it can be said that,Properties :- Computes the total number of elements that satisfy at least one of several properties.
- It prevents the problem of double counting.
Example 1:
As shown in the diagram, 3 finite sets A, B and C with their corresponding values are given. Compute.
Solution :
The values of the corresponding regions, as can be noted from the diagram are –
By applying Inclusion-Exclusion principle,
Applications :
- Derangements
To determine the number of derangements( or permutations) of n objects such that no object is in its original position (like Hat-check problem).
As an example we can consider the derangements of the number in the following cases:
For i = 1, the total number of derangements is 0.
For i = 2, the total number of derangements is 1. This is.
For i = 3, the total number of derangements is 2. These areand
.
- Example 1: How many binary strings of length 8 either start with a ‘1’ bit or end with two bits ’00’?
Solution: If the string starts with one, there are 7 characters left which can be filled inways.
If the string ends with ’00’ then 6 characters can be filled inways.
Now if we add the above sets of ways and conclude that it is the final answer, then it would be wrong. This is because there are strings with start with ‘1’ and end with ’00’ both, and since they satisfy both criteria they are counted twice.
So we need to subtract such strings to get a correct count.
Strings that start with ‘1’ and end with ’00’ have five characters that can be filled inways.
So by the inclusion-exclusion principle we get-
Total strings = 128 + 64 – 32 = 160 - Example 2: How many numbers between 1 and 1000, including both, are divisible by 3 or 4?
Solution: Number of numbers divisible by 3 ==
.
Number of numbers divisible by 4 ==
.
Number of numbers divisible by 3 and 4 ==
.
Therefore, number of numbers divisible by 3 or 4 == 333 + 250 – 83 = 500
Applying the Inclusion-Exclusion principle to i general eventsand rearranging we get the formula,
Inclusion Exclusion principle and programming applications
Sum Rule – If a task can be done in one ofways or one of
ways, where none of the set of
ways is the same as any of the set of
ways, then there are
ways to do the task.
The sum-rule mentioned above states that if there are multiple sets of ways of doing a task, there shouldn’t be any way that is common between two sets of ways because if there is, it would be counted twice and the enumeration would be wrong.
The principle of inclusion-exclusion says that in order to count only unique ways of doing a task, we must add the number of ways to do it in one way and the number of ways to do it in another and then subtract the number of ways to do the task that are common to both sets of ways.
The principle of inclusion-exclusion is also known as the subtraction principle. For two sets of waysand
, the enumeration would like-
Below are some examples to explain the application of inclusion-exclusion principle: