You are currently browsing the tag archive for the ‘venn diagram’ tag.

**Part 1:**

A couple of weeks ago, my friend John (from UK) asked me if I could explain the Inclusion-Exclusion Principle to him. Wikipedia contains an article on the same topic but John felt that it wasn’t a very helpful introduction. So, as promised, here is the post on that topic, though I managed to finish it only after some delay. (Sorry, John!)

As the title of this post suggests, the *inclusion-exclusion principle* can simply be described as *counting all the objects outside the oval regions*! We will use Venn diagrams to explain what that means.

*Note*: denotes the greatest integer less than .

Ok, let’s now “build” the principle step by step.

**1**. Suppose there are objects out of which there are exactly objects of type . How many objects are NOT of type ? The answer is obvious: . The Venn diagram below depicts the answer pictorially. The rounded rectangular region (with the orange border) is the set of all objects, and the oval region (with the blue border) is the set of all objects of type . Then, the remaining white region that is *outside the oval region* denotes the set of all objects that are NOT of type , and clearly, there are of ’em.

Indeed, let us take a simple example. Consider the set of first thirty natural numbers: . So, . Now, out of these thirty integers, let be the number of integers divisible by . Then, . It is easy to see that the number of integers NOT divisible by equals , which is what we would expect if we were to list all the integers not divisible by . Indeed, those integers are .

**2**. Now, suppose there are objects out of which there are exactly objects of type and objects of type . Also, suppose there are exactly objects that are of *both* type AND . Then, how many objects are NOT of type OR ? The Venn diagram below illustrates this case.

Again, we are counting the number of *objects outside the two oval regions*. To answer the above question, we first need to determine the number of objects inside the two oval regions, and then subtract this number from the total, which is . Now, one might be tempted to think that the number of objects inside the two oval regions is simply . But this is only true if the two oval regions don’t intersect (i.e. they have no objects in common.) In the general case, however, the expression counts *twice*! And so, we must subtract from the expression to get as the exact number of objects inside the two oval regions. We can now see that the number of objects outside the two oval regions equals , and we are done.

Continuing with our example used earlier, let be the number of integers divisible by . Also, let be the number of integers divisible by AND (*i.e.* we count multiples of .) Now, note that , and .

Thus, using the formula derived above, the number of integers that are NOT divisible by OR equals . In fact, we can list these ten integers: and ; and this confirms our answer.

**3**. Now, suppose there are objects out of which there are exactly objects of type , objects of type and objects of type . Also, let denote the number of objects of type AND , the number of objects of type AND , the number of objects of type AND , and the number of objects of type AND . Then, how many objects are NOT of type OR ? This case is illustrated by the Venn diagram shown below.

Once again, let us ask, what is the number of objects inside the three oval regions. A possible answer is . Now this will only be true if the three oval regions are pairwise *disjoint*. In the general case, however, we will have to take care of *overcounting*, just as we did in earlier. A brief thought will reveal that in the above expression, we have counted each of and *twice* and *thrice*! To take care of this overcounting, we subtract each of and once from the expression, but in doing so, we also end up subtracting *thrice*! We thus need to add back into the expression to get , and this expression yields the exact number of objects inside the three oval regions. Therefore, the number of objects outside the three oval regions equals . And, we are done.

Again, continuing with our earlier example, let denote the number of integers divisible by . Then, . Also, let denote the number of integers divisible by AND (*i.e.* we are counting multiples of ); then, . Again, let denote the number of integers divisible by and ; then . And, finally, let denote the number of integers divisible by and ; then .

So, the number of integers NOT divisible by OR equals

. Indeed, those eight integers are and .

It isn’t very hard to deduce the formula for the general case when we have a set of objects, out of which there are objects of type , objects of type , and so on. The proof of the general formula will follow in the next post, which may include a couple of problems/solutions involving this principle.

## Recent Comments