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

(categories) |
I like pie (talk | contribs) m |
||

Line 2: | Line 2: | ||

== Application == | == Application == | ||

− | |||

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

Line 10: | Line 9: | ||

To find the union, we can add <math>|A_1|</math> and <math>|A_2|</math>. In doing so, we know we have counted everything in <math>|A_1\cup A_2|</math> at least once. However, some things were counted twice. The elements that were counted twice are precisely those in <math> {}A_1\cap A_2 </math>. Thus, we have that: | To find the union, we can add <math>|A_1|</math> and <math>|A_2|</math>. In doing so, we know we have counted everything in <math>|A_1\cup A_2|</math> at least once. However, some things were counted twice. The elements that were counted twice are precisely those in <math> {}A_1\cap A_2 </math>. Thus, we have that: | ||

− | <center><math> |A_1 \cup A_2| = |A_1| + |A_2| - |A_1\cap A_2| | + | <center><math> |A_1 \cup A_2| = |A_1| + |A_2| - |A_1\cap A_2|</math>.</center> |

=== Three Set Example === | === Three Set Example === | ||

Line 17: | Line 16: | ||

Just like in the Two Set Example, we start with the sum of the sizes of the individual sets <math>|A_1|+|A_2|+|A_3|</math>. 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 <math>|A_1\cap A_2|+|A_2\cap A_3| + |A_3\cap A_1|</math>. 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 <math>|A_1\cap A_2\cap A_3|</math>. Putting this all together gives: | Just like in the Two Set Example, we start with the sum of the sizes of the individual sets <math>|A_1|+|A_2|+|A_3|</math>. 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 <math>|A_1\cap A_2|+|A_2\cap A_3| + |A_3\cap A_1|</math>. 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 <math>|A_1\cap A_2\cap A_3|</math>. Putting this all together gives: | ||

− | <center><math> |A_1\cup A_2\cup A_3| = |A_1| + |A_2| + |A_3| -|A_1\cap A_2| - |A_2\cap A_3| - |A_3\cap A_1| +|A_1\cap A_2\cap A_3| | + | <center><math> |A_1\cup A_2\cup A_3| = |A_1| + |A_2| + |A_3| -|A_1\cap A_2| - |A_2\cap A_3| - |A_3\cap A_1| +|A_1\cap A_2\cap A_3|</math>.</center> |

− | |||

=== Five Set Example === | === Five Set Example === | ||

− | Problem | + | ==== Problem ==== |

− | There are five courses at my school. Students take the classes as follows | + | There are five courses at my school. Students take the classes as follows: |

243 take algebra. | 243 take algebra. | ||

323 take language arts. | 323 take language arts. | ||

Line 59: | Line 57: | ||

How many people are in my school? | How many people are in my school? | ||

+ | ==== Solution ==== | ||

+ | Let A be the subset of students who take algebra, L-languages, S-social s., B-biology, H-history, M the set of all students. We have: | ||

− | + | <math>|M|=|A|+|L|+|S|+|B|+|H|-|A\cap L|-|A\cap S|-|A\cap B|-|A\cap H|-|L\cap S|-|L\cap B|</math> | |

− | |||

− | <math> | + | <math>-|L\cap H|-|S\cap B|-|S\cap H|-|B\cap H|+|A\cap L\cap S|+|A\cap L\cap B|+|A\cap L\cap H|+|A\cap S\cap B|+|A\cap S\cap H|</math> |

− | \ | ||

− | </math> | ||

− | <math> | + | <math>+|A\cap B\cap H|+|L\cap S\cap H|+|L\cap S \cap B|+|S\cap B\cap H|+|L \cap B\cap H|-|A\cap L\cap S\cap B|-|A\cap L\cap S\cap H|</math> |

− | \ | ||

− | </math> | ||

− | <math> | + | <math>-|A\cap L\cap B\cap H|-|A\cap S\cap B\cap H|-|L\cap S\cap B\cap H|+|A\cap L\cap S\cap B\cap H|</math> |

− | |||

− | <math>- | + | <math>=243+323+143+241+300-213-264-144-121-111-90-80-60-70-60</math> |

− | </math> | ||

− | + | <math>+50+50+50+50+50+50+50+50+50+50-20-15-15-10-10+5=472</math> | |

− | |||

− | |||

− | <math>+50+50+50+50+50+50+50+50+50+50-20-15-15-10-10+5=472 | ||

− | </math> | ||

== Statement == | == Statement == | ||

If <math>(A_i)_{1\leq i\leq n}</math> are finite sets, then: | If <math>(A_i)_{1\leq i\leq n}</math> are finite sets, then: | ||

<center><math> \left|\bigcup_{i=1}^n A_i\right|=\sum_{i=1}^n\left|A_i\right| | <center><math> \left|\bigcup_{i=1}^n A_i\right|=\sum_{i=1}^n\left|A_i\right| | ||

− | -\sum_{i < j}\left|A_i\cap A_j\right| +\sum_{i<j<k}\left|A_i\cap A_j\cap A_k\right|-\cdots\ +(-1)^n \left|A_1\cap\cdots\cap A_n\right|{} | + | -\sum_{i < j}\left|A_i\cap A_j\right| +\sum_{i<j<k}\left|A_i\cap A_j\cap A_k\right|-\cdots\ +(-1)^n \left|A_1\cap\cdots\cap A_n\right|{}</math>.</center> |

== Remark == | == Remark == | ||

Sometimes it is also useful to know that, if you take into account only the first <math>m\le n</math> sums on the right, then you will get an overestimate if <math>m</math> is [[odd integer | odd]] and an underestimate if <math>m</math> is [[even integer | even]]. | Sometimes it is also useful to know that, if you take into account only the first <math>m\le n</math> sums on the right, then you will get an overestimate if <math>m</math> is [[odd integer | odd]] and an underestimate if <math>m</math> is [[even integer | even]]. | ||

So, | So, | ||

− | <math> \left|\bigcup_{i=1}^n A_i\right|\le \sum_{i=1}^n\left|A_i\right|</math>, | + | <math>\left|\bigcup_{i=1}^n A_i\right|\le \sum_{i=1}^n\left|A_i\right|</math>, |

− | <math> \left|\bigcup_{i=1}^n A_i\right|\ge \sum_{i=1}^n\left|A_i\right| | + | <math>\left|\bigcup_{i=1}^n A_i\right|\ge \sum_{i=1}^n\left|A_i\right|-\sum_{i < j}\left|A_i\cap A_j\right|</math>, |

− | -\sum_{i < j}\left|A_i\cap A_j\right| | ||

− | <math> \left|\bigcup_{i=1}^n A_i\right|\le \sum_{i=1}^n\left|A_i\right| | + | <math>\left|\bigcup_{i=1}^n A_i\right|\le \sum_{i=1}^n\left|A_i\right|-\sum_{i < j}\left|A_i\cap A_j\right| +\sum_{i<j<k}\left|A_i\cap A_j\cap A_k\right|</math>, |

− | -\sum_{i < j}\left|A_i\cap A_j\right| +\sum_{i<j<k}\left|A_i\cap A_j\cap A_k\right| </math>, | ||

and so on. | and so on. | ||

== Examples == | == Examples == | ||

− | |||

* http://www.artofproblemsolving.com/Forum/viewtopic?t=83102 | * http://www.artofproblemsolving.com/Forum/viewtopic?t=83102 | ||

* http://www.artofproblemsolving.com/Forum/viewtopic?t=61283 | * http://www.artofproblemsolving.com/Forum/viewtopic?t=61283 | ||

Line 109: | Line 95: | ||

== See also == | == See also == | ||

− | |||

* [[Combinatorics]] | * [[Combinatorics]] | ||

* [[Overcounting]] | * [[Overcounting]] | ||

[[Category:Combinatorics]] | [[Category:Combinatorics]] |

## Revision as of 21:22, 24 April 2008

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:

### 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 scocial 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 s., B-biology, H-history, M the set of all students. We have:

## 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