# Difference between revisions of "Principle of Inclusion-Exclusion"

(→Examples: The "mathideas" link was broken and pointed to a spammy "warning" page, so I have removed it.) |
(→Solution) |
||

Line 25: | Line 25: | ||

==== Solution ==== | ==== Solution ==== | ||

− | Let <math>A</math> be the event that the first, second, and third people are in ordered height, <math>B</math> be the event that the second, third, and fourth people are in ordered height, <math>C</math> be the event that the third, fourth, and fifth people are in ordered height, and <math>D</math> be the event that the fourth, fifth and sixth people are in ordered height. By a combination of complementary counting and PIE, we have that our answer will be <math>720-|A|-|B|-|C|-|D|+|A\ | + | Let <math>A</math> be the event that the first, second, and third people are in ordered height, <math>B</math> be the event that the second, third, and fourth people are in ordered height, <math>C</math> be the event that the third, fourth, and fifth people are in ordered height, and <math>D</math> be the event that the fourth, fifth and sixth people are in ordered height. By a combination of complementary counting and PIE, we have that our answer will be <math>720-|A|-|B|-|C|-|D|+|A\cap B|+|A\cap C|+|A\cap D|+|B\cap C|+|B\cap D|+|C\cap D|-|A\cap B\cap C|-|A\cap B\cap D|-|A\cap C\cap D|-|B\cap C\cap D|+|A\cap B\cap C\cap D|</math>. Now for the daunting task of evaluating all of this. |

For <math>|A|</math>, we just choose <math>3</math> people and there is only one way to put them in order, then <math>3!</math> ways to order the other three guys for <math>3!\binom{6}{3}=120</math>. Same goes for <math>|B|</math>, <math>|C|</math>, and <math>|D|</math>. | For <math>|A|</math>, we just choose <math>3</math> people and there is only one way to put them in order, then <math>3!</math> ways to order the other three guys for <math>3!\binom{6}{3}=120</math>. Same goes for <math>|B|</math>, <math>|C|</math>, and <math>|D|</math>. | ||

− | Now, for <math>|A\ | + | Now, for <math>|A\cap B|</math>, that's just putting four guys in order. By the same logic as above, this is <math>2!\binom{6}{4}=30</math>. Again, <math>|A\cap C|</math> would be putting five guys in order, so <math>1!\binom{6}{5}=6</math>. <math>|A\cap D|</math> is just choosing <math>3</math> guys out of <math>6</math>, then <math>3</math> guys out of <math>3</math> for <math>\binom{6}{3}=20</math>. Now, <math>|B\cap C|</math> is just the same as <math>|A\cap B|</math>, so <math>30</math>, <math>|B\cap D|</math> is <math>|A\cap C|</math> so <math>6</math>, and <math>|C\cap D|</math> is <math>|A\cap B|</math> so <math>30</math>. |

− | Moving on to the next set: <math>|A\ | + | Moving on to the next set: <math>|A\cap B\cap C|</math> is the same as <math>|A\cap C|</math> which is <math>6</math>, <math>|A\cap B\cap D|</math> is ordering everybody so <math>1</math>, <math>|A\cap C\cap D|</math> is again ordering everybody which is <math>1</math>, and <math>|B\cap C\cap D|</math> is the same as <math>|A\cap B\cap C|</math> so <math>6</math>. |

− | Finally, <math>|A\ | + | Finally, <math>|A\cap B\cap C\cap D|</math> is ordering everybody so <math>1</math>. |

Now, lets substitute everything back in. We get a massive expression of <math>720-120-120-120-120+30+6+20+30+6+30-6-1-1-6+1=\boxed{349}</math>. | Now, lets substitute everything back in. We get a massive expression of <math>720-120-120-120-120+30+6+20+30+6+30-6-1-1-6+1=\boxed{349}</math>. |

## Revision as of 09:56, 26 April 2016

The **Principle of Inclusion-Exclusion** (abbreviated PIE) provides an organized method/formula to find the number of elements in the union of a given group of sets, the size of each set, and the size of all possible intersections among the sets.

## Contents

## Application

Here we will illustrate how PIE is applied with various numbers of sets.

### Two Set Example

Assume we are given the sizes of two sets, and , and the size of their intersection, . We wish to find the size of their union, .

To find the union, we can add and . In doing so, we know we have counted everything in at least once. However, some things were counted twice. The elements that were counted twice are precisely those in . Thus, we have that:

### Three Set Example

Assume we are given the sizes of three sets, and , the size of their pairwise intersections, , and , and the size their overall intersection, . We wish to find the size of their union, .

Just like in the Two Set Example, we start with the sum of the sizes of the individual sets . We have counted the elements which are in exactly one of the original three sets once, but we've obviously counted other things twice, and even other things thrice! To account for the elements that are in two of the three sets, we first subtract out . Now we have correctly accounted for them since we counted them twice originally, and just subtracted them out once. However, the elements that are in all three sets were originally counted three times, and then subtracted out three times. We have to add back in . Putting this all together gives:

### Four Set Example

#### Problem

Six people of different heights are getting in line to buy donuts. Compute the number of ways they can arrange themselves in line such that no three consecutive people are in increasing order of height, from front to back. (2015 ARML I10)

#### Solution

Let be the event that the first, second, and third people are in ordered height, be the event that the second, third, and fourth people are in ordered height, be the event that the third, fourth, and fifth people are in ordered height, and be the event that the fourth, fifth and sixth people are in ordered height. By a combination of complementary counting and PIE, we have that our answer will be . Now for the daunting task of evaluating all of this.

For , we just choose people and there is only one way to put them in order, then ways to order the other three guys for . Same goes for , , and .

Now, for , that's just putting four guys in order. By the same logic as above, this is . Again, would be putting five guys in order, so . is just choosing guys out of , then guys out of for . Now, is just the same as , so , is so , and is so .

Moving on to the next set: is the same as which is , is ordering everybody so , is again ordering everybody which is , and is the same as so .

Finally, is ordering everybody so .

Now, lets substitute everything back in. We get a massive expression of .

### Five Set Example

#### Problem

There are five courses at my school. Students take the classes as follows: 243 take algebra. 323 take language arts. 143 take social studies. 241 take biology. 300 take history. 213 take algebra and language arts. 264 take algebra and social studies. 144 take algebra and biology. 121 take algebra and history. 111 take language arts and social studies. 90 take language arts and biology. 80 take language arts and history. 60 take social studies and biology. 70 take social studies and history. 60 take biology and history. 50 take algebra, language arts, and social studies. 50 take algebra, language arts, and biology. 50 take algebra, language arts, and history. 50 take algebra, social studies, and biology. 50 take algebra, social studies, and history. 50 take algebra, biology, and history. 50 take language arts, social studies, and biology. 50 take language arts, social studies, and history. 50 take language arts, biology, and history. 50 take social studies, biology, and history. 20 take algebra, language arts, social studies, and biology. 15 take algebra, language arts, social studies, and history. 15 take algebra, language arts, biology, and history. 10 take algebra, social studies, biology, and history. 10 take language arts, social studies, biology, and history. 5 take all five. None take none.

How many people are in my school?

#### Solution

Let A be the subset of students who take Algebra, L-languages, S-Social Studies, B-biology, H-history, M-the set of all students. We have:

Thus, there are people in my school.

## Statement

If are finite sets, then:

## Remark

Sometimes it is also useful to know that, if you take into account only the first sums on the right, then you will get an overestimate if is odd and an underestimate if is even. So,

,

,

,

and so on.

## Examples

- http://www.artofproblemsolving.com/Forum/viewtopic?t=83102
- http://www.artofproblemsolving.com/Forum/viewtopic?t=61283