1 / 25

Inclusion-Exclusion Principle

Inclusion-Exclusion Principle. Sum Rule. If sets A and B are disjoint, then | A  B | = | A | + | B |. A. B. What if A and B are not disjoint ?. Inclusion-Exclusion (2 sets). For two arbitrary sets A and B. A. B. Inclusion-Exclusion (2 sets).

elledge
Download Presentation

Inclusion-Exclusion Principle

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. Inclusion-Exclusion Principle

  2. Sum Rule If sets A and B are disjoint, then |AB| = |A| + |B| A B • What if A and B are not disjoint?

  3. Inclusion-Exclusion (2 sets) For two arbitrary sets A and B A B

  4. Inclusion-Exclusion (2 sets) Let S be the set of integers from 1 through 1000 that are multiples of 3 or multiples of 5. Let A be the set of integers from 1 to 1000 that are multiples of 3. Let B be the set of integers from 1 to 1000 that are multiples of 5. It is clear that S is the union of A and B, but notice that A and B are not disjoint. A B |A| = 1000/3 = 333 |B| = 1000/5 = 200 A Å B is the set of integers that are multiples of 15, and so |A Å B| = 1000/15 = 66 So, by the inclusion-exclusion principle, we have |S| = |A| + |B| - |A Å B| = 467.

  5. Inclusion-Exclusion (3 sets) |A [B [C| = |A| + |B| + |C| – |AÅB| – |AÅC| – |BÅC| + |AÅBÅC| A B C

  6. Inclusion-Exclusion (3 sets) |A| 30 know Java 18 know C++ 26 know C# 9 know both Java and C++ 16 know both Java and C# 8 know both C++ and C# 47 know at least one language. From a total of 50 students: |B| |C| |AÅB| How many know none? How many know all? |AÅC| |BÅC| |AÅBÅC| |A[B[C| |A[B[C| = |A| + |B| + |C|– |AÅB| – |AÅC| – |BÅC| + |AÅBÅC| 47 = 30 + 18 + 26 – 9 – 16 – 8 + |AÅBÅC| |AÅBÅC| = 6

  7. Inclusion-Exclusion (4 sets) |A [ B [ C [ D| = |A| + |B| + |C| + |D| – |A Å B| – |A Å C| – |A Å D| – |B Å C| – |B Å D| – |C Å D| + |A Å B Å C| + |A Å B Å D| + |A Å C Å D| + |B Å C Å D| – |A Å B Å C Å D | A B C D

  8. Inclusion-Exclusion (n sets) What is the inclusion-exclusion formula for the union of n sets?

  9. Inclusion-Exclusion (n sets) sum of sizes of all single sets – sum of sizes of all 2-set intersections + sum of sizes of all 3-set intersections – sum of sizes of all 4-set intersections … + (–1)n+1 × sum of sizes of intersections of all n sets

  10. Inclusion-Exclusion (n sets) |A1[ A2[ A3[ … [ An| sum of sizes of all single sets – sum of sizes of all 2-set intersections + sum of sizes of all 3-set intersections – sum of sizes of all 4-set intersections … + (–1)n+1 × sum of sizes of intersections of all n sets We want to show that every element is counted exactly once. Consider an element which belongs to exactly k sets, say A1, A2, A3, …, Ak. In the formula, such an element is counted the following number of times: Therefore each element is counted exactly once, and thus the formula is correct

  11. Inclusion-Exclusion (n sets) Plug in x=1 and y=-1 in the above binomial theorem, we have

  12. Christmas Party In a Christmas party, everyone brings his/her present. There are n people and so there are totally n presents. Suppose the host collects and shuffles all the presents. Now everyone picks a random present. What is the probability that no one picks his/her own present? Let the n presents be {1, 2, 3, …, n}, where the present i is owned by person i. Now a random ordering of the presents means a permutation of {1, 2, 3, …, n}. e.g. (3,2,1) means the person 1 picks present 3, person 2 picks present 2, etc. And the question whether someone picks his/her own present becomes whether there is a number i which is in position i of the permutation.

  13. Fixed Points in a Permutation Given a random permutation of {1, 2, 3, …, n}, what is the probability that a permutation has no fixed point (i.e number i is not in position i for all i)? e.g. {2, 3, 1, 5, 6, 4} has no fixed point, {3, 4, 7, 5, 2, 6, 1} has a fixed point, {5, 4, 3, 2, 1} has a fixed point. You may wonder why we are suddenly asking a probability question. Actually, this is equivalent to the following counting question: What is the number of permutations of {1,2,3,…,n} with no fixed point?

  14. Fixed Points in a Permutation What is the number of permutations of {1,2,3,…,n} with no fixed point? For this question, it is more convenient to count the complement. Let S be the set of permutations of {1,2,3…,n} with some fixed point(s). Let A1 be the set of permutations in which the number 1 is in position 1. … Let Aj be the set of permutations in which the number j is in position j. … Let An be the set of permutations in which the number n is in position n. S = A1[ A2[ … [ An Note that Ai and Aj are not disjoint, and so we need inclusion-exclusion.

  15. Fixed Points in a Permutation Let S be the set of permutations of {1,2,3…,n} with some fixed point(s). Let Aj be the set of permutations in which the number j is in position j. S = A1[ A2[ … [ An How large is |Aj|? Once we fixed j, we can have any permutation on the remaining n-1 elements. Therefore, |Aj| = (n-1)! How large is |AiÅ Aj|? Once we fixed i and j, we can have any permutation on the remaining n-2 elements. Therefore, |AiÅ Aj| = (n-2)!

  16. Fixed Points in a Permutation Let S be the set of permutations of {1,2,3…,n} with some fixed point(s). Let Aj be the set of permutations in which the number j is in position j. S = A1[ A2[ … [ An How large is the intersection of k sets? In the intersection of k sets, there are k positions being fixed. Then we can have any permutation on the remaining n-k elements. Therefore, |the intersection of k sets| = (n-k)!

  17. Fixed Points in a Permutation Let S be the set of permutations of {1,2,3…,n} with some fixed point(s). Let Aj be the set of permutations in which the number j is in position j. S = A1[ A2[ … [ An |the intersection of k sets| = (n-k)! |S| = |A1[ A2[ … [ An| |A1[ A2[ A3[ … [ An| sum of sizes of all single sets – sum of sizes of all 2-set intersections + sum of sizes of all 3-set intersections – sum of sizes of all 4-set intersections … + (–1)n+1 × sum of sizes of intersections of n sets …

  18. Fixed Points in a Permutation Let S be the set of permutations of {1,2,3…,n} with some fixed point(s). Let Aj be the set of permutations in which the number j is in position j. S = A1[ A2[ … [ An |the intersection of k sets| = (n-k)! |S| = |A1[ A2[ … [ An| |S| = |A1[ A2[ … [ An| = n! – n!/2! + n!/3! +… (-1)i+1 n!/i! + … + (-1)n+1 …

  19. Fixed Points in a Permutation Let S be the set of permutations of {1,2,3…,n} with some fixed point(s). Let Aj be the set of permutations in which the number j is in position j. S = A1[ A2[ … [ An |S| = n! – n!/2! + n!/3! +… (-1)i+1 n!/i! + … + (-1)n+1 The number of permutations with no fixed points = n! – |S| = n! – n! + n!/2! – n!/3! +… (-1)i n!/i! + … + (-1)n = n! (1 – 1/1! + 1/2! – 1/3! + … + (-1)i 1/i! … + (-1)n 1/n!) -> n!/e (where e is the constant 2.71828…)

  20. Euler Function Given a number n, how many numbers from 1 to n are relatively prime to n? When n is a prime number, then every number from 1 to n-1 is relatively prime to n, and so When n is a prime power, then p, 2p, 3p, 4p, …, n are not relatively prime to n, there are n/p = pc-1 of them, and other numbers are relatively prime to n. Therefore,

  21. Euler Function Given a number n, how many numbers from 1 to n are relatively prime to n? Suppose Then p, 2p, 3p, 4p, …, n are not relatively prime to n, there are n/p of them. Also, q, 2q, 3q, 4q, …, n are not relatively prime to n, and there are n/q of them. Other numbers are relatively prime to n. Therefore, The numbers pq, 2pq, 3pq, …, n are subtracted twice, and there are n/pq of them. So the correct answer is

  22. Euler Function Given a number n, how many numbers from 1 to n are relatively prime to n? Let Let S be the set of numbers from 1 to n that are not relatively prime to n. Let Ai be the set of numbers that are a multiple of pi. S = A1[ A2[ … [ An For the intersection of k sets, say A1, A2, A3,…, Ak then every number in A1Å A2Å … Å Ak is a multiple of p1p2…pk then |A1Å A2Å … Å Ak| = n/p1p2…pk

  23. Euler Function Given a number n, how many numbers from 1 to n are relatively prime to n? Let Let S be the set of numbers from 1 to n that are not relatively prime to n. Let Ai be the set of numbers that are a multiple of pi. S = A1[ A2[ … [ An |A1Å A2Å … Å Ak| = n/p1p2…pk |A1[A2[A3| = |A1| + |A2| + |A3| – |A1 ÅA2| – |A1ÅA3| – |A2ÅA3| + |A1ÅA2ÅA3| When r=3 (only 3 distinct factors), |A1[ A2[ A3| = n/p1 + n/p2 + n/p3 - n/p1p2 – n/p1p3 – n/p2p3 + n/p1p2p3 = n(1-p1)(1-p2)(1-p3)

  24. Euler Function Given a number n, how many numbers from 1 to n are relatively prime to n? Let Let S be the set of numbers from 1 to n that are not relatively prime to n. Let Ai be the set of numbers that are a multiple of pi. S = A1[ A2[ … [ An |A1Å A2Å … Å Ak| = n/p1p2…pk |A1[ A2[ A3[ … [ An| |S| = |A1[ A2[ … [ An| sum of sizes of all single sets – sum of sizes of all 2-set intersections + sum of sizes of all 3-set intersections – sum of sizes of all 4-set intersections … + (–1)n+1 × sum of sizes of intersections of n sets calculations… = n(1-p1)(1-p2)…(1-pn)

  25. Quick Summary We have studied how to determine the size of a set directly. The basic rules are the sum rule, product rule, and the generalized product rule. We apply these rules in counting permutations and combinations, which are then used to count other objects like poker hands. Then we prove the binomial theorem and study combinatorial proofs of identities. Finally we learn the inclusion-exclusion principle and see some applications. Later we will learn how to count “indirectly” by “mapping”.

More Related