Presentation is loading. Please wait.

Presentation is loading. Please wait.

To Exclude Or Not To Exclude?

Similar presentations


Presentation on theme: "To Exclude Or Not To Exclude?"— Presentation transcript:

1 To Exclude Or Not To Exclude?
Great Theoretical Ideas In Computer Science To Exclude Or Not To Exclude? + - Lecture 11 CS

2 How many integer solutions to the following equations?

3 The coefficient of xk in (1-x)-n =
The # of solutions to

4 A famous generating function and power series expansion from calculus:

5 Question: What is the coefficient of X20 in
?

6 Question: What is the coefficient of X20 in
? The number of integer solutions to:

7 A school has 100 students. 50 take French, 40 take Latin, and 20 take both. How many students take neither language? How many positive integers less than 70 are relatively prime to 70? (70=257) How many 7 card hands have at least one card of each suit?

8 French Latin F  French students L  Latin students |F|=50 |L|=40
French AND Latin students: |FL|=20 French OR Latin students: |F|+|L|-|F L| = – 20 = 70 |FL|= Neither language: 100 – 70 = 30

9 A B U U  universe of elements Lesson: |AB| = |A| + |B| - |AB|

10 How many positive integers less than 70 are relatively prime to 70?
U 70 = 257 U = [1..70] A1  integers in U divisible by 2 A2  integers in U divisible by 5 A3  integers in U divisible by 7 |A1| = |A2| = |A3|=10

11

12 Lesson: U A1 A2 Let Sk be the sum of the sizes of
All k-tuple intersections of the Ai’s.

13 How many 7 card hands contain at least one card of each suit?
U  all 7 card hands A1  all hands with no hearts A2  all hands with no spades A3  all hands with no diamonds A4  all hands with no clubs

14

15 The Principle of Inclusion and Exclusion
Let A1,A2,…,An be sets in a universe U. Let Sk denote the sum of size of all k-tuple intersections of Ai’s.

16 Let x A1  An be an element appearing in m of the Ai’s.
x gets counted times by S1 “ “ “ times by S2 “ “ “ times by S3 “ “ “ times by Sn The formula counts x 1 time.

17 Each x in the union gets counted once by the formula so we are done.
Immediate corollary:

18 How many different ways can 6 pirates divide 20 bars of gold?
# of integral solutions to

19

20

21

22 Question: What is the coefficient of X20 in
?

23 A famous application of inclusion-exclusion is to calculate the number of
DERANGEMENTS. A permutation of [1..n] is called a derangement if for every i, the Number i is not in the i’th position.

24 Examples: 23154 is a derangement 42531 is not

25 Dn  # of derangements of [1..n]
Dn/n! = ? What is the probability that if n people randomly reach into a dark closet to retrieve their hats, no person will pick their own hat?

26 # of permutations with j elements fixed
Calculating Dn using Inclusion-Exclusion U = all n! permutations of [1..n] Ai = all permutations where i goes in position i # of j-tuples # of permutations with j elements fixed

27

28 But the power series converges rapidly.
nearest integer

29 So if we handed back homework in random order the probability that no student would get his/her own paper is about 1/e.

30 How many functions are there from [1..k] to [1..n] ?

31 ONTO(k,n) = # of functions from a k-element set onto an n element set.
U = all nk functions from [1..k] to [1..n] Ai = functions that miss element i the intersection of j of the Ai’s has (n-j)k functions

32 [ ONTO(k , j) ways to do this]
Lemma: There are nk functions from [1..k] to [1..n]. Each function is constructed by 3 choices: Pick j, 1  j  k Pick j elements from range [ ways to do this] Pick a function from 1..k onto those j elements [ ONTO(k , j) ways to do this]

33


Download ppt "To Exclude Or Not To Exclude?"

Similar presentations


Ads by Google