foundations of computer science lecture 14 advanced
play

Foundations of Computer Science Lecture 14 Advanced Counting - PowerPoint PPT Presentation

Foundations of Computer Science Lecture 14 Advanced Counting Sequences with Repetition Union of Overlapping Sets: Inclusion-Exclusion Pigeonhole Principle Last Time To count complex objects, construct a sequence of instructions that can


  1. Foundations of Computer Science Lecture 14 Advanced Counting Sequences with Repetition Union of Overlapping Sets: Inclusion-Exclusion Pigeonhole Principle

  2. Last Time To count complex objects, construct a sequence of “instructions” that can be used to construct the object uniquely. The number of possible sequences of instructions equals the number of possible complex objects. 1 Sum and product Rules. 2 Build-up counting: � n � , n -bit sequences with k 1’s; goody-bags. k 3 Counting one set by counting another: bijection. 4 Permutations and combinations. 5 Binomial Theorem. Creator: Malik Magdon-Ismail Advanced Counting: 2 / 11 Today →

  3. Today: Advanced Counting Sequences with repetition. 1 Anagrams. Inclusion-exclusion: extending the sum-rule to overlapping sets. 2 Derangements. Pigeonhole principle. 3 Social twins. Subset sums. Creator: Malik Magdon-Ismail Advanced Counting: 3 / 11 Counting Sequences →

  4. Selecting k from n Distinguishible Objects no repetition with repetition k -sequence k -subset Creator: Malik Magdon-Ismail Advanced Counting: 4 / 11 Anagrams for aardvark →

  5. Selecting k from n Distinguishible Objects no repetition with repetition n ! k -sequence ( n − k )! k -subset Creator: Malik Magdon-Ismail Advanced Counting: 4 / 11 Anagrams for aardvark →

  6. Selecting k from n Distinguishible Objects no repetition with repetition n ! n k k -sequence ( n − k )! k -subset Creator: Malik Magdon-Ismail Advanced Counting: 4 / 11 Anagrams for aardvark →

  7. Selecting k from n Distinguishible Objects no repetition with repetition n ! n k k -sequence ( n − k )!  n n !    = k -subset k k !( n − k )! Creator: Malik Magdon-Ismail Advanced Counting: 4 / 11 Anagrams for aardvark →

  8. Selecting k from n Distinguishible Objects no repetition with repetition n ! n k k -sequence ( n − k )!  n n !  k + n − 1      = k -subset    k k !( n − k )! n − 1 Creator: Malik Magdon-Ismail Advanced Counting: 4 / 11 Anagrams for aardvark →

  9. Selecting k from n Distinguishible Objects no repetition with repetition n ! n k k -sequence ( n − k )!  n n !  k + n − 1      = k -subset    k k !( n − k )! n − 1 ( k 1 , k 2 , · · · , k r ) -sequence (5 , 4 , 3) -sequence of 5 , 4 , 3 Creator: Malik Magdon-Ismail Advanced Counting: 4 / 11 Anagrams for aardvark →

  10. Selecting k from n Distinguishible Objects no repetition with repetition n ! n k k -sequence ( n − k )!  n n !  k + n − 1      = k -subset    k k !( n − k )! n − 1 ( k 1 , k 2 , · · · , k r ) -sequence (5 , 4 , 3) -sequence of 5 , 4 , 3 1 2 3 4 5 6 7 8 9 10 11 12 Creator: Malik Magdon-Ismail Advanced Counting: 4 / 11 Anagrams for aardvark →

  11. Selecting k from n Distinguishible Objects no repetition with repetition n ! n k k -sequence ( n − k )!  n n !  k + n − 1      = k -subset    k k !( n − k )! n − 1 ( k 1 , k 2 , · · · , k r ) -sequence � 12 � (5 , 4 , 3) -sequence of 5 , 4 , 3 Choose slots for : ways 5 1 2 3 4 5 6 7 8 9 10 11 12 subset of slots used for each type type - { 1 , 3 , 4 , 7 , 11 } Creator: Malik Magdon-Ismail Advanced Counting: 4 / 11 Anagrams for aardvark →

  12. Selecting k from n Distinguishible Objects no repetition with repetition n ! n k k -sequence ( n − k )!  n n !  k + n − 1      = k -subset    k k !( n − k )! n − 1 ( k 1 , k 2 , · · · , k r ) -sequence � 12 � (5 , 4 , 3) -sequence of 5 , 4 , 3 Choose slots for : ways 5 � 7 � Then choose slots for : ways 4 1 2 3 4 5 6 7 8 9 10 11 12 subset of slots used for each type type - type - { 1 , 3 , 4 , 7 , 11 } { 2 , 5 , 6 , 10 } Creator: Malik Magdon-Ismail Advanced Counting: 4 / 11 Anagrams for aardvark →

  13. Selecting k from n Distinguishible Objects no repetition with repetition n ! n k k -sequence ( n − k )!  n n !  k + n − 1      = k -subset    k k !( n − k )! n − 1 ( k 1 , k 2 , · · · , k r ) -sequence � 12 � (5 , 4 , 3) -sequence of 5 , 4 , 3 Choose slots for : ways 5 � 7 � Then choose slots for : ways 4 � 3 � Then choose slots for : ways 1 2 3 4 5 6 7 8 9 10 11 12 3 subset of slots used for each type type - type - type - { 1 , 3 , 4 , 7 , 11 } { 2 , 5 , 6 , 10 } { 8 , 9 , 12 } Creator: Malik Magdon-Ismail Advanced Counting: 4 / 11 Anagrams for aardvark →

  14. Selecting k from n Distinguishible Objects no repetition with repetition n ! n k k -sequence ( n − k )!  n n !  k + n − 1      = k -subset    k k !( n − k )! n − 1 ( k 1 , k 2 , · · · , k r ) -sequence � 12 � (5 , 4 , 3) -sequence of 5 , 4 , 3 Choose slots for : ways 5 � 7 � Then choose slots for : ways 4 � 3 � Then choose slots for : ways 1 2 3 4 5 6 7 8 9 10 11 12 3 Product rule: subset of slots used for each type  12  12  7  3          =  ×  × type - type - type -  5 , 4 , 3 5 4 3 { 1 , 3 , 4 , 7 , 11 } { 2 , 5 , 6 , 10 } { 8 , 9 , 12 } Creator: Malik Magdon-Ismail Advanced Counting: 4 / 11 Anagrams for aardvark →

  15. Selecting k from n Distinguishible Objects no repetition with repetition n ! n k k -sequence ( n − k )!  n n !  k + n − 1      = k -subset    k k !( n − k )! n − 1 ( k 1 , k 2 , · · · , k r ) -sequence � 12 � (5 , 4 , 3) -sequence of 5 , 4 , 3 Choose slots for : ways 5 � 7 � Then choose slots for : ways 4 � 3 � Then choose slots for : ways 1 2 3 4 5 6 7 8 9 10 11 12 3 Product rule: subset of slots used for each type  12  12  7  3          =  ×  × type - type - type -  5 , 4 , 3 5 4 3 { 1 , 3 , 4 , 7 , 11 } { 2 , 5 , 6 , 10 } { 8 , 9 , 12 } 12! 7! 3! = 5! · 7! × 4! · 3! × 3! · 0! Creator: Malik Magdon-Ismail Advanced Counting: 4 / 11 Anagrams for aardvark →

  16. Selecting k from n Distinguishible Objects no repetition with repetition n ! n k k -sequence ( n − k )!  n n !  k + n − 1      = k -subset    k k !( n − k )! n − 1 ( k 1 , k 2 , · · · , k r ) -sequence � 12 � (5 , 4 , 3) -sequence of 5 , 4 , 3 Choose slots for : ways 5 � 7 � Then choose slots for : ways 4 � 3 � Then choose slots for : ways 1 2 3 4 5 6 7 8 9 10 11 12 3 Product rule: subset of slots used for each type  12  12  7  3          =  ×  × type - type - type -  5 , 4 , 3 5 4 3 { 1 , 3 , 4 , 7 , 11 } { 2 , 5 , 6 , 10 } { 8 , 9 , 12 } 12! 7! 3! = 5! · 7! × 4! · 3! × 3! · 0! 12! = 5! · 4! · 3! Creator: Malik Magdon-Ismail Advanced Counting: 4 / 11 Anagrams for aardvark →

  17. Selecting k from n Distinguishible Objects no repetition with repetition n ! n k k -sequence ( n − k )!  n n !  k + n − 1      = k -subset    k k !( n − k )! n − 1  k 1 + · · · + k r k !    = ( k 1 , k 2 , · · · , k r ) -sequence   k 1 , k 2 , . . . , k r k 1 ! · k 2 ! · · · k r ! � 12 � (5 , 4 , 3) -sequence of 5 , 4 , 3 Choose slots for : ways 5 � 7 � Then choose slots for : ways 4 � 3 � Then choose slots for : ways 1 2 3 4 5 6 7 8 9 10 11 12 3 Product rule: subset of slots used for each type  12  12  7  3          =  ×  × type - type - type -  5 , 4 , 3 5 4 3 { 1 , 3 , 4 , 7 , 11 } { 2 , 5 , 6 , 10 } { 8 , 9 , 12 } 12! 7! 3! = 5! · 7! × 4! · 3! × 3! · 0! 12! = 5! · 4! · 3! Creator: Malik Magdon-Ismail Advanced Counting: 4 / 11 Anagrams for aardvark →

  18. Anagrams: All “Words” Using the Letters of aardvark A sequence of 8 letters: 3 a ’s, 2 r ’s, 1 d , 1 v , 1 k . Creator: Malik Magdon-Ismail Advanced Counting: 5 / 11 Overlapping Sets →

  19. Anagrams: All “Words” Using the Letters of aardvark A sequence of 8 letters: 3 a ’s, 2 r ’s, 1 d , 1 v , 1 k . Number of such sequences is 8 8!    = 3! · 2! · 1! · 1! · 1! = 3360 .    3 , 2 , 1 , 1 , 1 Creator: Malik Magdon-Ismail Advanced Counting: 5 / 11 Overlapping Sets →

  20. Anagrams: All “Words” Using the Letters of aardvark A sequence of 8 letters: 3 a ’s, 2 r ’s, 1 d , 1 v , 1 k . Number of such sequences is 8 8!    = 3! · 2! · 1! · 1! · 1! = 3360 .    3 , 2 , 1 , 1 , 1 Exercise. What is the coefficient of x 2 y 3 z 4 in the expansion of ( x + y + z ) 9 ? [Hint: Sequences of length 9 (why?) with 2 x ’s, 3 y ’s and 4 z ’s.] Creator: Malik Magdon-Ismail Advanced Counting: 5 / 11 Overlapping Sets →

  21. Extending the Sum Rule to Overlapping Sets | A ∪ B | = | A | + | B | − | A ∩ B | . A ∩ B A ∩ B A ∩ B (Breaks A ∪ B into smaller sets.) Creator: Malik Magdon-Ismail Advanced Counting: 6 / 11 Inclusion-Exclusion →

  22. Extending the Sum Rule to Overlapping Sets | A ∪ B | = | A | + | B | − | A ∩ B | . A ∩ B A ∩ B A ∩ B (Breaks A ∪ B into smaller sets.) Example. How many numbers in 1 , . . . , 10 are divisible by 2 or 5. Creator: Malik Magdon-Ismail Advanced Counting: 6 / 11 Inclusion-Exclusion →

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend