Counting with Venn Diagrams
Inclusion-Exclusion aka the Sieve Method • We will denote; • A’s complement as A. • A B as A + B • A B as AB
Inclusion-Exclusion: 2 Sets • |A + B| = |A| + |B| - |AB| • |A + B| = |U| - |A| - |B| + |AB| = |A B| A A-B B AB B-A
Example 1 There are 100 students. • 50 students speak Java. • 40 students speak C++. • 20 students speak both. How many speak neither Java nor C++?
Example 2 How many arrangements of the letters in MISSISSIPPI do not begin with M and do not end with I? • Let U = all arrangements of these letters. • Let A = all arrangements that begin with M. • Let B = all arrangements that end with I. We want |A B| = |U| - |A| - |B| + |AB| = • P(11; 1, 4, 4, 2) - P(10; 4, 3, 2, 1) + P(9; 4, 3, 2)
Inclusion-Exclusion: 3 Sets • |A+B+C| = |A|+|B|+|C| - |AB|-|AC|-|BC| + |ABC| • |A+B+C| = |U| - |A+B+C| = |A B C| = |U| - |A| - |B| - |C| + |AB| + |AC| + |BC| - |ABC| A B C
Example 3 In a state-wide politician survey: • • 260 partake of illegal drugs weekly 208 pack a gun 160 buy sex 76 partake and pack 48 partake and buy 62 pack and buy 30 partake, pack, and buy 150 do none of the above (yeah, right).
How many politicians: • • were surveyed? are partaking and packing, but not buying? are partaking and buying, but not packing? are packing and buying, but not partaking? Are buying, but neither partaking nor packing? Are partaking, but neither packing nor buying? Are packing, but neither partaking nor buying?
Example 4 • There is a small “swingers” party among prez candidates, Gore (G), Bush (B), Trump(T), and their wives (i. e. , 6 people). • The wives randomly pick a male partner for the remainder of the party (e. g. , Tipper swaps Al for George, etc. ). • What is the probability that no wife spends the party with her hubby?
• Let G denote all pairings where Gore is with his wife. • Let B denote all pairings where Bush is with his wife. • Let T denote all pairing where Trump is with his wife (does he have one currently? ). |G B T| = |U| - |G| - |B| - |T| + |GB| + |GT| + |BT| - |GBT|
• Let N = |A B C|. • Let I 1 = |A| + |B| + |C|. • Let I 2 = |AB| + |AC| + |BC|. • Let I 3 = |ABC|. • Then, N = |U| - I 1 + I 2 - I 3. • Partition the elements of U according to whether they are in K = 0, 1, 2, or all 3 sets.
For each K value, see how many times such an element is counted by the formula. • e A, B, and/or C are counted 0 times. • e in none are counted exactly one. K 0 1 2 3 U 1 1 -I 1 0 -1 -2 -3 +I 2 0 0 1 +3 -I 3 0 0 0 -1