1 / 46

Principle of Inclusion-Exclusion

Principle of Inclusion-Exclusion. Principle of Inclusion and Exclusion.

Télécharger la présentation

Principle of Inclusion-Exclusion

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Principle of Inclusion-Exclusion

  2. Principle of Inclusion and Exclusion • The Principle of Inclusion and Exclusion (PIE) is a counting technique that computes the number of elements that satisfy at least one of several properties while guaranteeing that elements satisfying more than one property are not counted twice.

  3. Principle of Inclusion & Exclusion The above equation represents the principle of inclusion and exclusion for two sets A and B. • The name comes from the fact that to calculate the elements in a union, we include the individual elements of A and B but subtract the elements common to A and B so that we don’t count them twice. • This principle can be generalized to n sets. Section 3.3 Principle of Inclusion & Exclusion; Pigeonhole Principle 4

  4. Inclusion-Exclusion U A A B It’s simply a matter of not over-counting the blue area in the intersection.

  5. 2 sets

  6. Problem 1

  7. If F is faculty who speak French and R is the faculty who speak Russian, then given that • n(F) = |F| = 200 • n(R) = |R|= 50 • n (F∩R) = | F∩R | = 20 and we need to find |F U R| • Then by the PIE we have | F∩R | = |F| + |R| - |F U R| • Thus |F U R| = 200+50-20=230

  8. Problem2

  9. Total number of committees possible is C(10,5) = 252 ways • Let A be the set of committees that include Professor-A and B be the set of committees that include Professor-B. Then • n(A) = • C (9,4)=126 • n(B) = • C (9,4)=126 • n(A ∩ B) = • C(8,3) = 56…thus by inclusion and exclusion principle • n(A U B) = 126 + 126 – 56 = 196

  10. Example on Inclusion/Exclusion Rule (2 sets) • Question: How many integers from 1 through 100 are multiples of 3 or multiples of 7 ? • Solution: Let A=the set of integers from 1 through 100 which are multiples of 3; B = the set of integers from 1 through 100 which are multiples of 7. Then we want to find n(A U B). First note that A ∩ B is the set of integers from 1 through 100 which are multiples of 21 . n(A U B) = n(A) + n(B) - n(A ∩ B) (by incl./excl. rule)

  11. n(AUB) = n(A) + n(B) - n(A ∩ B) (by incl./excl. rule) • = 33 + 14 – 4 = 43 (by counting the elements • From 1 to 100, every third integer is a multiple of 3, each of this multiple can be represented as 3p, for any integer p from 1 through 33, Hence |A| = 33. • Similarly for multiples of 7, each multiple of 7 is of the form 7q for some integer q from 1 through 14. Hence, we have |B| = 14.) and the multiple of 21… n(A ∩ B) = 4

  12. Example: Inclusion and Exclusion Principle • Example 1: How many integers from 1 to 1000 are either multiples of 3 or multiples of 5? • Let us assume that A = set of all integers from 1 to 1000 that are multiples of 3. • Let us assume that B = set of all integers from 1 to 1000 that are multiples of 5. • A U B = The set of all integers from 1 to 1000 that are multiples of either 3 or 5. • A ∩ B = The set of all integers that are both multiples of 3 and 5, which also is the set of integers that are multiples of 15. • To use the inclusion/exclusion principle to obtain |A U B|, we need |A|, |B| and |A ∩ B|. • From 1 to 1000, every third integer is a multiple of 3, each of this multiple can be represented as 3p, for any integer p from 1 through 333, Hence |A| = 333. • Similarly for multiples of 5, each multiple of 5 is of the form 5q for some integer q from 1 through 200. Hence, we have |B| = 200. Section 3.3 Principle of Inclusion & Exclusion; Pigeonhole Principle 13

  13. Example: Inclusion/exclusion principle for 3 sets To determine the number of multiples of 15 from 1 through 1000, each multiple of 15 is of the form 15r for some integer r from 1 through 66. Hence, |A ∩ B| = 66. From the principle, we have the number of integers either multiples of 3 or multiples of 5 from 1 to 1000 given by |A U B| = 333 + 200 – 66 = 467. Section 3.3 Principle of Inclusion & Exclusion; Pigeonhole Principle 14

  14. 3 sets

  15. Problem 3

  16. Let F be the set of faculty who speak French, R be the set of faculty who speak Russian, and S be the set of faculty that speak Spanish. • Thus we have |F | = 200, | R | = 50, |S|= 100 • |F ∩ R | = 20 • |F ∩ S | = 60 • |R∩ S | = 35 • |F ∩ R∩ S | = 10 • Thus | F U R US | = • 200 + 50+ 100- 20 -60 -35 + 10 = 245. Section 3.3 Principle of Inclusion & Exclusion; Pigeonhole Principle 17

  17. Example 2: • In a class of students undergoing a computer course the following were observed. • Out of a total of 50 students: 30 know Pascal, 18 know Fortran, 26 know COBOL, 9 know both Pascal and Fortran, 16 know both Pascal and COBOL, 8 know both Fortran and COBOL, 47 know at least one of the three languages. • From this we have to determine • a. How many students know none of these languages? • b. How many students know all three languages?

  18. Example: Inclusion/exclusion principle for 3 sets • We know that 47 students know at least one of the three languages in the class of 50. The number of students who do not know any of three languages is given by the difference between the number of students in class and the number of students who know at least one language. • Hence, the students who know none of these languages = 50 – 47 = 3. • Students know all three languages, so we need to find |A  B  C|. • A = All the students who know Pascal in class. • B = All the students who know COBOL in the class. • C = All the students who know FORTRAN in class. • We have to derive the inclusion/exclusion formula for three sets |A  B  C| = |A  (B  C)| = |A| + |B  C| - |A  (B  C)| Section 3.3 Principle of Inclusion & Exclusion; Pigeonhole Principle 19

  19. Example: Inclusion/exclusion principle for 3 sets • |A  B  C| = |A  (B  C)| = |A| + |B  C| - |A  (B  C)| = |A| + |B| + |C| - |B  C| - |(A  B)  (A  C)| = |A| + |B| + |C| - |B  C| - (|A  B| + |A  C| - |A  B  C|) = |A| + |B| + |C| - |B  C| - |A  B| - |A  C| + |A  B  C| • Given in the problem are the following: |B  C| = 8 |A  B| = 9 |A  C| =16 |A  B  C| = 50 • Hence, using the above formula, we have 47 = 30 + 26 + 18 -9 -16 -8 + |A  B  C| Hence, |A  B  C| = 6 Section 3.3 Principle of Inclusion & Exclusion; Pigeonhole Principle 20

  20. Example on Inclusion/Exclusion Rule (3 sets) • 3 headache drugs – A,B, and C – were tested on 40 subjects. The results of tests: 23 reported relief from drug A; 18 reported relief from drug B; 31 reported relief from drug C; 11 reported relief from both drugs A and B; 19 reported relief from both drugs A and C; 14 reported relief from both drugs B and C; 37 reported relief from at least one of the drugs. Questions: 1) How many people got relief from none of the drugs? 2) How many people got relief from all 3 drugs? 3) How many people got relief from A only?

  21. C A B Example on Inclusion/Exclusion Rule (3 sets) S We are given: n(A)=23, n(B)=18, n(C)=31, n(A  B)=11, n(A  C)=19, n(B  C)=14 , n(S)=40, n(A  B  C)=37 Q1) How many people got relief from none of the drugs? By difference rule, n((A  B  C)c ) = n(S) – n(A  B  C) = 40 - 37 = 3

  22. Example on Inclusion/Exclusion Rule (3 sets) Q2)How many people got relief from all 3 drugs? By inclusion/exclusion rule: n(A  B  C) = n(A  B  C) - n(A) - n(B) - n(C) + n(A  B) + n(A  C) + n(B  C) = 37 – 23 – 18 – 31 + 11 + 19 + 14 = 9 Q3)How many people got relief from A only? n(A – (B  C)) (byinclusion/exclusion rule) = n(A) – n(A  B) - n(A  C) + n(A  B  C) = 23 – 11 – 19 + 9 = 2

  23. Simple example – 3 sets area = 4-3=1 U C area = 2-1=1 area = 1 B A • Image a blue circle has area 4. The intersections between 2 circles have • area 2 and the intersection between three circles 1. What is the total area • covered? A=4+4+4 – 2 -2 -2 + 1 = 12 – 6 + 1 = 7.

  24. PIE DeMorgon’s laws

  25. Cont…

  26. Solution

  27. exercises

  28. Solutions

  29. Examples Compute the number of solutions to x1+x2+x3=11 where x1,x2,x3 non-negative integers and x1 <=3, x2<=4, x4<=6. P1: x1 > 3 P2: x2 > 4 P3: x3 > 6 The solution must have non of the properties P1,P2,P3. The solution of a problem x1+x2+x3=11 with constraints x1 > 3 is solved as follows: 7 more balls 4 balls in basket x1 already. Total number of ways: C(7+3-1,7)=36 x1 x2 x3 Therefore: N-N(P1)-N(P2)-N(P3)+N(P1,P2)+N(P2,P3)+N(P1,P3)-N(P1,P2,P3) = C(11+3-1,11) – C(7+3-1,7) – C(6+3-1,6) – C(4+3-1,4) + … – 0.

More Related