Line 9: | Line 9: | ||
In general, | In general, | ||
− | <math> | + | <math>\displaystyle |A_1 \cup A_2 \cup ... \cup A_n| = </math> |
− | <math> | + | <math>\displaystyle |A_1| + |A_2| + ... + |A_n| </math> |
− | <math> | + | <math>\displaystyle - |A_1 \cap A_2| - |A_1 \cap A_3| - ... - |A_(n-1)\cap A_n| </math> |
− | <math> + | | + | <math>\displaystyle + |A_1 \cap A_2 \cap A_3| + |A_1 \cap A_2 \cap A_4| + ... + |A_(n-2) \cap A_(n-1) \cap A_n| </math> |
− | <math> + (-1)^(n+1) | | + | <math>\displaystyle + (-1)^(n+1)|A_1 \cap A_2 \cap A_3 \cap ... \cap A_n| </math> |
Revision as of 16:36, 7 September 2008
Inclusion-Exclusion Principle (Basic)
Let B and C be subsets of a given set A. To count the number of elements in the union of B and C, we must evaluate the following:
$ |B \cup C| = |B| + |C| - |B \cap C| $
Subtracting $ |B \cap C| $ corrects the overcount.
In general,
$ \displaystyle |A_1 \cup A_2 \cup ... \cup A_n| = $
$ \displaystyle |A_1| + |A_2| + ... + |A_n| $
$ \displaystyle - |A_1 \cap A_2| - |A_1 \cap A_3| - ... - |A_(n-1)\cap A_n| $
$ \displaystyle + |A_1 \cap A_2 \cap A_3| + |A_1 \cap A_2 \cap A_4| + ... + |A_(n-2) \cap A_(n-1) \cap A_n| $
$ \displaystyle + (-1)^(n+1)|A_1 \cap A_2 \cap A_3 \cap ... \cap A_n| $