120 likes | 149 Views
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|
E N D
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| = |U| - |A| - |B| + |AB| = |A B| A B A - 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 |AB| = |U| - |A| - |B| + |AB| = • P(11;1, 4, 4, 2) - P(10; 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| = |ABC| = |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, butneither partaking nor packing? • Are partaking, butneither packing nor buying? • Are packing, butneither 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?). |GBT| = |U| - |G| - |B| - |T| + |GB| + |GT| + |BT| - |GBT|
Let N = |ABC|. • Let I1 = |A| + |B| + |C|. • Let I2 = |AB| + |AC| + |BC|. • Let I3 = |ABC|. • Then, N = |U| - I1 + I2 - I3. • 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 U -I1 +I2 -I3 0 1 0 0 0 1 1 -1 0 0 2 1 -2 1 0 3 1 -3 +3 -1