Difference between revisions of "Principle of Inclusion-Exclusion"

((added in intro stuff etc))
Line 1: Line 1:
=== Statement ===
+
== Introduction ==
 +
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.
 +
 
 +
=== Two Set Example ===
 +
Assume we are given the sizes of two sets, <math>|A_1|</math> and <math>|A_2|</math> and the size of their [[intersection]], <math>|A_1\cap A_2|</math>.  We wish to find the size of their union, <math>|A_1\cup A_2|</math>.
 +
 
 +
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|. </math></center>
 +
 
 +
=== Three Set Example ===
 +
Assume we are given the sizes of three sets, <math>|A_1|, |A_2|{}</math> and <math>|A_3|</math>, the size of their pairwise intersections, <math>|A_1\cap A_2|, |A_2\cap A_3|</math> and <math>|A_3\cap A_1|</math>, and the size their overall intersection, <math>|A_1\cap A_2\cap A_3|</math>.  We wish to find the size of their union, <math>|A_1\cup A_2\cup A_3|</math>.
 +
 
 +
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>.  So now we have correctly accounted for them since we counted them twice originally and just subtracted them out once. But the elements that are in all three sets were originally counted 3 times and then subtracted out three times.  So 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|.</math></center>
 +
 
 +
== 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:
<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\cdots\ +(-1)^n \left|A_1\cap\cdots\cap A_n\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|-\cdots\ +(-1)^n \left|A_1\cap\cdots\cap A_n\right|{}. </math></center>
  
=== 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
 +
 +
 +
== See also ==
 +
* [[Overcounting]]

Revision as of 14:11, 18 June 2006

Introduction

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.

Two Set Example

Assume we are given the sizes of two sets, $|A_1|$ and $|A_2|$ and the size of their intersection, $|A_1\cap A_2|$. We wish to find the size of their union, $|A_1\cup A_2|$.

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

$|A_1 \cup A_2| = |A_1| + |A_2| - |A_1\cap A_2|.$

Three Set Example

Assume we are given the sizes of three sets, $|A_1|, |A_2|{}$ and $|A_3|$, the size of their pairwise intersections, $|A_1\cap A_2|, |A_2\cap A_3|$ and $|A_3\cap A_1|$, and the size their overall intersection, $|A_1\cap A_2\cap A_3|$. We wish to find the size of their union, $|A_1\cup A_2\cup A_3|$.

Just like in the Two Set Example, we start with the sum of the sizes of the individual sets $|A_1|+|A_2|+|A_3|$. 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 $|A_1\cap A_2|+|A_2\cap A_3| + |A_3\cap A_1|$. So now we have correctly accounted for them since we counted them twice originally and just subtracted them out once. But the elements that are in all three sets were originally counted 3 times and then subtracted out three times. So we have to add back in $|A_1\cap A_2\cap A_3|$. Putting this all together gives:

$|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|.$

Statement

If $(A_i)_{1\leq i\leq n}$ are finite sets, then:

$\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|{}.$

Examples


See also