1 / 33

To Exclude Or Not To Exclude?

-. +. Great Theoretical Ideas In Computer Science. To Exclude Or Not To Exclude?. Lecture 11. CS 15-251. How many integer solutions to the following equations?. The # of solutions to. The coefficient of x k in (1-x) -n =.

Download Presentation

To Exclude Or Not To Exclude?

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. - + Great Theoretical Ideas In Computer Science To Exclude Or Not To Exclude? Lecture 11 CS 15-251

  2. How many integer solutions to the following equations?

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

  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. 100 – 70 = 30 F  French students L  Latin students |F|=50|L|=40 French Latin French AND Latin students: |FL|=20 French OR Latin students: |F|+|L|-|F L| = 50 + 40 – 20 = 70 |FL|= Neither language:

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

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

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

  12. 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 • How many 7 card hands contain at least one card of each suit?

  13. 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.

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

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

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

  17. Question:What is the coefficient of X20 in ?

  18. 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.

  19. 1 2 3 4 5 4 2 5 3 1 1 2 3 4 5 2 3 1 5 4 23154 is a derangement Examples: 42531 is not

  20. Dn # of derangements of [1..n] Dn = ? 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?

  21. # of j-tuples # 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

  22. But the power series converges rapidly. nearest integer

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

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

  25. 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

  26. Lemma: [ ways to do this] 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 • Pick a function from 1..k onto those j elements [ ONTO(k , j) ways to do this]

More Related