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?

- algorithm algorithms approximation arithmetic art Babylonian beauty binary binomial coefficients birthday book review bracelets carnival Carnival of Mathematics change chess chess board combinatorics complex consecutive cookies counting decadic decimal derivatives diagrams divisibility divisors education expansion factorization fibonacci floor foundations fractal fractions game games GIMPS graph graphs Haskell history humor hyperbinary idempotent integers interactive irrational Ivan Niven lehmer lucas MaBloWriMo Mersenne number numbers permutations pi prime primes problem programming proof puzzle random rectangles repunit review sequence squares symmetry test triangular video visualization
### Blogroll

### Fun

### Reference

### Categories

- algebra (37)
- arithmetic (58)
- books (25)
- calculus (6)
- challenges (47)
- combinatorics (8)
- complex numbers (5)
- computation (53)
- convergence (9)
- counting (28)
- famous numbers (61)
- fibonacci (14)
- fractals (12)
- games (17)
- geometry (29)
- golden ratio (8)
- group theory (3)
- humor (6)
- induction (7)
- infinity (17)
- iteration (38)
- links (71)
- logic (6)
- meta (37)
- modular arithmetic (33)
- number theory (70)
- open problems (11)
- paradox (1)
- pascal's triangle (8)
- pattern (54)
- people (19)
- pictures (28)
- posts without words (3)
- primes (46)
- probability (5)
- programming (17)
- proof (42)
- puzzles (10)
- recursion (8)
- review (17)
- sequences (26)
- solutions (25)
- teaching (9)
- trig (3)
- Uncategorized (2)
- video (18)

### Archives

- November 2015 (23)
- August 2015 (3)
- June 2015 (2)
- April 2015 (1)
- May 2014 (1)
- December 2013 (1)
- October 2013 (1)
- July 2013 (1)
- June 2013 (1)
- May 2013 (1)
- April 2013 (3)
- March 2013 (3)
- February 2013 (2)
- January 2013 (5)
- December 2012 (3)
- November 2012 (4)
- October 2012 (5)
- September 2012 (1)
- August 2012 (4)
- July 2012 (1)
- June 2012 (6)
- May 2012 (2)
- April 2012 (3)
- March 2012 (1)
- February 2012 (4)
- January 2012 (5)
- December 2011 (1)
- November 2011 (7)
- October 2011 (4)
- September 2011 (6)
- July 2011 (2)
- June 2011 (4)
- May 2011 (5)
- April 2011 (2)
- March 2011 (4)
- February 2011 (1)
- January 2011 (1)
- December 2010 (1)
- November 2010 (4)
- October 2010 (2)
- September 2010 (1)
- August 2010 (1)
- July 2010 (1)
- June 2010 (2)
- May 2010 (3)
- April 2010 (1)
- February 2010 (6)
- January 2010 (3)
- December 2009 (8)
- November 2009 (7)
- October 2009 (3)
- September 2009 (3)
- August 2009 (1)
- June 2009 (4)
- May 2009 (5)
- April 2009 (4)
- March 2009 (2)
- February 2009 (1)
- January 2009 (7)
- December 2008 (1)
- October 2008 (2)
- September 2008 (7)
- August 2008 (1)
- July 2008 (1)
- June 2008 (1)
- April 2008 (5)
- February 2008 (4)
- January 2008 (4)
- December 2007 (3)
- November 2007 (12)
- October 2007 (2)
- September 2007 (4)
- August 2007 (3)
- July 2007 (1)
- June 2007 (3)
- May 2007 (1)
- April 2007 (4)
- March 2007 (3)
- February 2007 (7)
- January 2007 (1)
- December 2006 (2)
- October 2006 (2)
- September 2006 (6)
- July 2006 (4)
- June 2006 (2)
- May 2006 (6)
- April 2006 (3)
- March 2006 (6)

### Meta

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: http://people.qc.cuny.edu/faculty/christopher.hanusa/courses/636fa11/Pages/notes.aspx)

Thanks!

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:

http://mathdl.maa.org/images/upload_library/22/Ford/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.

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 :)

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.

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.

Sorry – just realised I messed that up.

Should be NOT(NOT(a) AND NOT(b) AND NOT(c)) of course.