 We can generalize the inclusion-exclusion principle to even more sets, and this gives us a rather daunting-looking theorem, but informally we'll add the individual sets, subtract the pairs, add the triples, subtract the quadruples, and so on. To prove the inclusion-exclusion principle, consider an element in exactly k of the sets. We want its contribution to the sum on the right to be exactly 1. Now let's consider where that appears in this sum. Since the element is in k of the sets A i, it's going to appear in k choose 1 of the sets A i, k choose 2 of the pairwise intersections, k choose 3 of the triple intersections, and so on. And so an element in exactly k of the sets will contribute to the sum on the right. To deal with this rather horrific-looking sum, let's remember that consistency counts. So in our sum, as written, only the last term has a negative 1 to some power, so let's go ahead and incorporate that negative 1 to some power in all of our terms. And a second useful idea in math and in life is that aesthetics also counts. And here it's a little bit ugly in that the exponent of the negative 1 is different from the term in the binomial coefficient. So let's factor out a negative 1 to get. Now if we stare at the terms inside the parentheses for a moment, we are reminded of the binomial expansion. So let's rewrite our terms here. Remember the binomial expansion includes a factor of A to some power where the sum of the exponents is equal to n. We can always include a factor of 1 to some power, so let's include a factor of 1 to some power where the exponents add to k. And so that will give us the binomial expansion also includes a zero term, and you can have anything you want as long as you pay for it. So let's put in that zero term and we'll pay for it later by subtracting it out. And now notice that all of these terms are the expansion of 1 plus negative 1 to the k. We include the last term and simplify. And remember these were the terms inside the parentheses, so all those terms inside the parentheses collapse down to negative 1, and we get... And so an element in exactly k of the set will contribute exactly 1 to the sum on the right, and that's our proof. So let's consider another example. Let's consider how many numbers between 1 and 2 times 3 times 5 times 7, 210 are not divisible by 2, 3, 5, or 7. So a useful strategy in math and in life look both ways. While we want to find the numbers that are not divisible by 2, 3, 5, or 7, we could start by finding the numbers that are divisible by 2, 3, 5, or 7. So we know that every k-th number is divisible by k, so one-half of our numbers are divisible by 2, one-third are divisible by 3, one-fifth are divisible by 5, and one-seventh are divisible by 7. So if we have these up, we get 247 are divisible by 2, 3, 5, or 7, although we've counted some numbers more than once. So let's look at our pairs, the numbers that are divisible by 2 of our numbers. So the numbers divisible by 2 include the numbers divisible by 2 times 3, that's 6, that's 1-6 of our numbers. Similarly, the numbers divisible by 2 times 5 are one-tenth of our numbers, and the numbers divisible by 2 times 7 are one-fourteenth of the numbers, and so there are 35 plus 21 plus 15 numbers divisible by 2 that are counted twice. So we'll subtract these off, and then the other pairwise sets are the numbers divisible by 3 times 5, 3 times 7, and 5 times 7, and so there are more numbers that are counted twice. And we'll subtract these as well. However, we've now eliminated all the numbers divisible by 3 numbers, so we have to put back in the triples. So the numbers divisible by 2 times 3 times 5, the numbers divisible by 2 times 3 times 7, the numbers divisible by 2 times 5 times 7, and the numbers divisible by 3 times 5 times 7. So we need to add back, and this double counts the numbers divisible by 4 of our numbers, so we need to subtract, and that gives us 162 numbers between 1 and 210 that are divisible by 2, 3, 5, or 7. And this means there are 48 numbers that are not divisible by 2, 3, 5, or 7.