I’ve been talking informally about the Principle of Inclusion-Exclusion but I realized it would be useful to state it more formally before proceeding to some proofs. The only problem is that a fully formal statement of PIE has a lot of details and uses a lot of notation—so I’ll state it formally and then spend some time going through and explaining the parts carefully.
Suppose we have a collection of finite sets , , , and so on up to , which are all subsets of a finite set . We think of as the “universe”, i.e. the entire population of things we are considering, and all the are sets which “live in” the universe. Each set typically represents a subpopulation with a particular property. For example, might be the set of all people; then might be the set of people named Brent, might be the set of people who own a dog, and so on. Or as another example, might be the set of natural numbers up to one million, and then might be the even numbers up to one million, might be the prime numbers less than one million, might be the set of all the ages I’ve ever been in my life, and so on.
The diagram below illustrates the general situation for . The big green rectangle is the universe set ; the blue circles represent the three subsets , , and , which in general may overlap, as in the diagram (though they don’t have to).
As I’ve presented it so far, PIE then tells us how to compute the number of elements of the universe which are not in any of the , represented by the green shaded area in the diagram above. Put another way, this is the number of elements of the universe which have none of the properties (e.g. people not named Brent who don’t own a dog; natural numbers up to one million which aren’t even or prime or an age I’ve ever been; etc.).
Without further ado, here is PIE:
Let’s go through this piece by piece. On the left-hand side, the big union symbol works just like a summation symbol, i.e. big-sigma notation: so means , the union of all the . Unioning the sets throws out duplicates, so the union represents all the elements of the universe which are in one or more of the (i.e. the blue area in the diagram above). Subtracting this number from the size of then gives the number of elements which aren’t in any of the .
The right-hand side is a bit more complicated. First, means we take a sum over every subset of . That is, we will get one number for every possible subset of (all of them), and we add all these numbers up. Now, for each subset , the big intersection symbol means to take the intersection of all the represented by . For example, if , then we get the intersection . We find the size of this intersection and make it either positive or negative: raising to a power keeps flipping back and forth between (if the power is even) and (if the power is odd). So means we should add the term if the number of in the intersection is even, and subtract if the number is odd.
There is one subtle point to make, which I also mentioned in my previous post. All subsets of includes the empty subset, , and it’s not necessarily obvious what the intersection means when is the empty set. How are we supposed to take the intersection of zero sets? To make everything work, we have to interpret it as being equal to the entire universe . However, this is actually sensible, since is like the “identity” for intersection: for each . Put another way, intersecting always results in a smaller set than you started with, so when intersecting you always start with the biggest possible set (namely, the universe ) and then the result gets smaller and smaller as you intersect more sets. That is, we can interpret as . So if you don’t intersect any you’re just left with the starting set . (This is exactly the same argument for why a union of zero sets should be the empty set, but that certainly feels more intuitive! Pop quiz: what do we get if we’re taking the product of a set of numbers and the set is empty?)
For some examples, see the previous post. You might like to try writing out PIE for .
An alternative presentation
Since we just argued why the empty set results in a term of on the right-hand side (note it is positive since ), and there is also a positive term on the left-hand side, we can subtract from both sides to cancel them out, leaving this:
(Notice how we got rid of the term on the right-hand side just by specifying that the summation should not use .)
If we finally negate both sides, we get an alternative form of PIE which is actually the way it is typically presented. We can negate every term on the right-hand side by simply adding to the power of , so any terms which used to be positive are now negative and vice versa.
For example, when this says
This alternative presentation is nice because it tells us directly about the size of the union of all the , i.e. the number of things in at least one of the sets (the blue region in the diagram), rather than the number of things in none of the sets (the green region). It seems like we would typically care more about the blue region; talking about the green region seems roundabout. However, as you can see, the right-hand side becomes a bit more awkward in this alternative presentation, because of the need to specify the extra condition , and the in the exponent of the . Strange as it might seem at first, PIE is really more natural when phrased in terms of the number of things in none of the sets .
Pingback: PIE: proof by algebra | The Math Less Traveled
Pingback: A combinatorial proof: reboot! | The Math Less Traveled
Pingback: A combinatorial proof: the story so far | The Math Less Traveled
Pingback: A combinatorial proof: counting bad functions | The Math Less Traveled
Pingback: A combinatorial proof: PIE a la mode! | The Math Less Traveled