Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Section 6.5 Inclusion/Exclusion. 2 Finding the number of elements in the union of 2 sets From set theory, we know that the number of elements in the.

Similar presentations


Presentation on theme: "1 Section 6.5 Inclusion/Exclusion. 2 Finding the number of elements in the union of 2 sets From set theory, we know that the number of elements in the."— Presentation transcript:

1 1 Section 6.5 Inclusion/Exclusion

2 2 Finding the number of elements in the union of 2 sets From set theory, we know that the number of elements in the union of 2 sets is the sum of the number of elements in each set minus the number of elements in the intersection of the 2 sets: |A  B| = |A| + |B| - |A  B|

3 3 Example 1 A discrete math class consists of 4 students taking Software Design, 3 students taking CS2, 2 students taking neither, and 1 student taking both. How many students are in the class? –Let |A| = # in SD, |B| = # in CS2, |C| = # in neither –So |A  B| = # taking both and |A  B  C| = # in discrete –|A  B  C| = |A| + |B| + |C| - |A  B| = 4+3+2-1=8

4 4 Example 2 How many positive integers not exceeding 100 are divisible by 2 or 5? –|A| = # divisible by 2 =  100/2  = 50 –|B| = # divisible by 5 =  100/5  = 20 –|A  B| = # divisible by both; since they are mutually prime, this is the numbers divisible by 2*5 =  100/10  = 10 –So |A  B| = 50 + 20 - 10 = 60

5 5 Example 3 We can use similar means to find the number of elements outside the union of 2 sets: A recent survey found that 96% of U.S. households have at least one television, 98% have phone service, and 95% have both; what percentage of households have neither?

6 6 Solution for example 3 Let |A| = % of households with TV (96) and |B| = % of households with phone service (98) We know that 95% have both; this is |A  B| The total number of households that have either TV or phone service, |A  B| is: |A| + |B| - |A  B| = 96+98-95 = 99 The total number of households is 100%, so the number that have neither TV nor phone is 100-99, or 1%

7 7 Finding the number of elements in the union of 3 sets The sum |A| + |B| + |C| counts the number of elements in one set once, the number in 2 sets twice, and the number in all 3 sets 3 times Subtracting the number of elements in any pair of the sets eliminates the double counting: |A|+|B|+|C| - |A  B| - |A  C| - |B  C| But this also eliminates all elements appearing in all 3; so we add those elements back in: |A|+|B|+|C| - |A  B| - |A  C| - |B  C| + |A  B  C|

8 8 Example 4 Suppose there are 2504 computer science majors at a school; of these: –1876 have taken C++, 999 have taken Java, 345 have taken C and –876 have taken both Java and C++, 231 have taken C++ and C, and 290 have taken Java and C How many CS majors have not taken any of these languages?

9 9 Example 4 Let |J| be the number who have taken Java (999), |P| be the number who have taken C++ (1876) and |C| the number who have taken C (345) Then: |J  P  C| = |J|+|P|+|C| - |J  P| - |J  C| - |P  C| + |J  P  C| 999+1876+345 - 876 - 231 - 290 + 189 = 2012 So 2504 - 2012 or 492 have taken none of these languages

10 10 Principle of Inclusion/Exclusion Let A 1, A 2, …, A n be finite sets; then |A 1  A 2  …  A n | =  |A i | -  |A i  A j | + 1  i  n 1  i<j  n  |A i  A j  A k | - … + 1  i<j<k  n (-1) n+1 |A 1  A 2  …  A n |

11 11 Proof We want to show that each element in the union of the sets is counted exactly once; suppose a is a member of exactly r of the sets A 1 … A n where 1  r  n. This element is counted: C(r,1) times by  |A i | and C(r,2) times by  |A i  A j | and, in general, C(r,m) times by summation involving m of the sets So element a is counted C(r,1)-C(r,2)+C(r,3)- … +C(r,r) times

12 12 Proof continued Recall the binomial theorem: (x+y) n =  C(n,j)x n-j y j (as j goes from 0 to n) We can show from this theorem that  (-1) k C(n,k) = 0 (as k goes from 0 to n); thus C(r,1) - C(r,2) + C(r,3)- … +(-1) r C(r,r) = 0 Changing the exponent of -1 in the last term to r+1 gives us: C(r,1) - C(r,2) + C(r,3)- … +(-1) r+1 C(r,r) = 1 So each element in the union is counted exactly once.


Download ppt "1 Section 6.5 Inclusion/Exclusion. 2 Finding the number of elements in the union of 2 sets From set theory, we know that the number of elements in the."

Similar presentations


Ads by Google