How to explain the principle of inclusion-exclusion?

I’ve been remiss in finishing my series of posts on a combinatorial proof. I still intend to, but I must confess that part of the reason I haven’t written for a while is that I’m sort of stuck. The next part of the story is to explain the Principle of Inclusion-Exclusion, but I haven’t yet come up with a compelling way to present it. So perhaps I should crowd-source it. If you know about PIE, how would you motivate and present it? Or do you know of any links to good presentations?

About Brent

Associate Professor of Computer Science at Hendrix College. Functional programmer, mathematician, teacher, pianist, follower of Jesus.
This entry was posted in combinatorics, meta and tagged , , , . Bookmark the permalink.

7 Responses to How to explain the principle of inclusion-exclusion?

  1. I agree that it is hard to motivate. My lecture slides aren’t the best on this topic, but feel free to take a look (October 24:

  2. Tom says:

    I like to go abstract on this one and introduce Mobius inversion and then describe how PIE is a special case of this for the subsets poset… I know this isn’t what you’re looking for for your blog, but it is definitely an interesting read:

    Click to access BenderGoldman.pdf

    As an actual motivating example, I always look to compute the collection of numbers less than 105 that are relatively prime to 105=3*5*7. This usually gives the idea of something interesting going on.

  3. tom says:

    NOTE: This is deceptively difficult isn’t it 🙂 I’m not entirely satisfied with this myself, but I hope it is of some use to you.

    For a really basic explanation (though it can probably be extended to the generalised principle) I’d start by asking a question like: If there are 13 million Australians with brown hair, and 7 million Australians with blonde hair, how many Australians have either blonde or brown hair? Answer: 20 million people. We just add the two groups up, very simple stuff.

    Slightly trickier question: if a new survey finds there are (again) 13 million Australians with brown hair, and in another question it finds there are 11 million Australian men, how many Australians are either male or have brown hair? Is it 24 million (more than our entire population 🙂 ), or is it something else? Why is this question different to the first question – why can’t we just add the size of the two groups? Let’s take a closer look at them:

    In the first question, we can count the number of people with blonde hair or brown hair like this:
    (1) Count all blonde haired people (7 million people)
    (2) Add to this all brown haired people who haven’t been counted already (but none of them have been counted yet, as they have brown hair, not blonde hair (I’m ignoring crazy hairdos here!) (So this is a further 13 million on top of the 7 million, 20 million total).

    Let’s follow the same steps to count the number of people who are either brown haired or male:
    (1) Count all the brown haired people (13 million)
    (2) Add to this the number of people *we haven’t counted already* (we don’t want to be counting people twice!) who are male. But how many is this? We know there’s 11 million men, but how many of these have we counted already? We’ve already counted all the men with brown hair! If that’s 9 million people, we wouldn’t want to count these again, so to our original 13 million brown haired people we’d only add a further 2 million people (11 million – 9 million). Overall:

    #(male or brown hair) = #(brown hair) + #(male) – #(male and brown hair)

    And that’s basically the PIE 🙂

  4. Craig says:

    For those unfamiliar with PIE, let’s start with an example. Suppose that the students at a certain school have the option of joining any or all of n clubs. Imagine that we know the membership of each club, but we don’t know the total number of students. We claim that, using PIE, we can make that calculation as follows, Start by adding up the number of students in each club. Subtract from that total the number of students that belong to at least 2 clubs. Add to that the number of students in at least 3 clubs, subtract the number of students in at least 4 clubs,…, add/subtract the number of students in all n clubs. The final amount will be the total number of students. Note that if we think of the clubs as sets and the members of each club as elements of those sets, we claim that using PIE, we can calculate the number of elements in the union of those sets.

    To prove our claim, it suffices to prove that PIE counts each student exactly once. The key to that proof lies in the fact that, starting from either end of any given row of Pascal’s triangle, if you alternately add and subtract the entries in that row, you get zero (1-1=0, 1-2+1=0, 1-3+3-1=0, etc.). That, in turn, can be proved directly from the binomial theorem.

    Let’s continue our example. Suppose Frodo is one of the aforementioned students. Frodo belongs to r of those clubs. The number of ways Frodo can belong to at least one club is C(r,1), the number of ways Frodo can belong to at least 2 clubs is C(r,2), etc. If r<n, we need not consider any combinations of more than r clubs, since Frodo's non-membership in those clubs will contribute zero to our calculation. Let # stand for the number of times Frodo is counted by PIE. Then, # = C(r,1) – C(r,2) + C(r,3) – … +/- C(r,r). Therefore, 1 – # = 1 – C(r,1) + C(r,2) – C(r,3) +…-/+ C(r,r) = C(r,0) – C(r,1) + C(r,2) – C(r,3) + … -/+ C(r,r) = 0. Therefore, # = 1. Thus, PIE counted Frodo exactly once. Since we made no special assumptions about Frodo, PIE counts every student exactly once, giving us the total we were looking for.

    You ask for motivation. Well, it turns out that PIE is useful in solving a number of combinatorial problems. Two that come to mind are 1) the Bernoulli-Euler problem of the misaddressed envelopes, and 2) the menage problem, aka Lucas' married couples problem. Both are discussed by Heinrich Dorrie in "100 Great Problems of Elementary Mathematics" (Dover). Dorrie's treatment of the first one is done well, but a shorter and more elegant solution is obtained by using PIE. Dorrie's solution of the latter problem is, to my mind, just dreadful. However, by utilizing PIE and other combinatorial methods that have been touched on in these blogs, a very accessible solution can be found. All of this, including the math presented above, was gleaned from various sites on the Internet; I claim no originality.

    My motivation? I first became aware of the combinatorial problem under consideration in a proof that every prime number of the form 4k+1 can be expressed as the sum of two squares. It was the only step in that proof that was taken for granted, and till now, I've not yet seen a satisfactory proof. I eagerly await the conclusion of Brent's discussion. If these comments help to move things along, so much the better.

  5. Steve says:

    It may be useful to pursue an analogy between Boolean algebra and normal algebra. We represent sets of size aN, bN, cN, etc. where N is the size of the universal set as variables a, b, c, etc. between 0 and 1, the empty set is zero, the universal set is 1, the complement of a is 1-a, the intersection of a AND b is the product ab, and so on. There’s a reasonably intuitive picture of these as subsets of a unit cube, or counting points on a scatterplot of the set elements.

    So a OR b OR c is by DeMorgan’s rule NOT(a AND b AND c) which we translate to 1 – (1-a)(1-b)(1-c). And so on for more variables.

    The inclusion-exclusion principle is then basically what you get when you multiply out 1 – (1-a)(1-b)(1-c)…

    It’s not rigorous, but anyone who can multiply out 1 – (1-a)(1-b)(1-c)(1-d) in normal algebra can quickly get the *shape* of the idea, in a fairly intuitive way, and that acts as a map for when you do it properly.

    • Steve says:

      Sorry – just realised I messed that up.
      Should be NOT(NOT(a) AND NOT(b) AND NOT(c)) of course.

Comments are closed.