
Combinatorics CSE235 Combinatorics Introduction Counting PIE Slides by Christopher M. Bourke Pigeonhole Principle Instructor: Berthe Y. Choueiry Permutations Combinations Binomial Coefficients Generalizations Spring 2006 Algorithms More Examples Computer Science & Engineering 235 Introduction to Discrete Mathematics Sections 4.1-4.6 & 6.5-6.6 of Rosen 1 / 105 [email protected] Combinatorics I Introduction Combinatorics CSE235 Introduction Counting Combinatorics is the study of collections of objects. PIE Specifically, counting objects, arrangement, derangement, etc. Pigeonhole of objects along with their mathematical properties. Principle Permutations Counting objects is important in order to analyze algorithms Combinations and compute discrete probabilities. Binomial Coefficients Originally, combinatorics was motivated by gambling: counting Generalizations configurations is essential to elementary probability. Algorithms More Examples 2 / 105 Combinatorics II Introduction Combinatorics CSE235 Introduction Counting A simple example: How many arrangements are there of a deck PIE of 52 cards? Pigeonhole Principle In addition, combinatorics can be used as a proof technique. Permutations Combinations A combinatorial proof is a proof method that uses counting Binomial Coefficients arguments to prove a statement. Generalizations Algorithms More Examples 3 / 105 Product Rule Combinatorics CSE235 Introduction If two events are not mutually exclusive (that is, we do them Counting separately), then we apply the product rule. PIE Theorem (Product Rule) Pigeonhole Principle Suppose a procedure can be accomplished with two disjoint Permutations subtasks. If there are n1 ways of doing the first task and n2 Combinations ways of doing the second, then there are Binomial Coefficients Generalizations n1 · n2 Algorithms More ways of doing the overall procedure. Examples 4 / 105 Sum Rule I Combinatorics CSE235 Introduction If two events are mutually exclusive, that is, they cannot be Counting done at the same time, then we must apply the sum rule. PIE Pigeonhole Principle Theorem (Sum Rule) Permutations If an event e1 can be done in n1 ways and an event e2 can be Combinations done in n2 ways and e1 and e2 are mutually exclusive, then the Binomial Coefficients number of ways of both events occurring is Generalizations Algorithms n1 + n2 More Examples 5 / 105 Sum Rule II Combinatorics CSE235 There is a natural generalization to any sequence of m tasks; Introduction namely the number of ways m mutually exclusive events can Counting occur is PIE n1 + n2 + ··· nm−1 + nm Pigeonhole Principle Permutations We can give another formulation in terms of sets. Let Combinations A1,A2,...,Am be pairwise disjoint sets. Then Binomial Coefficients |A1 ∪ A2 ∪ · · · ∪ Am| = |A1| + |A2| + ··· + |Am| Generalizations Algorithms In fact, this is a special case of the general Principle of More Examples Inclusion-Exclusion. 6 / 105 Principle of Inclusion-Exclusion (PIE) I Introduction Combinatorics CSE235 Introduction Counting PIE Say there are two events, e and e for which there are n and Examples 1 2 1 Derangements n2 possible outcomes respectively. Pigeonhole Principle Now, say that only one event can occur, not both. Permutations Combinations In this situation, we cannot apply the sum rule? Why? Binomial Coefficients Generalizations Algorithms More Examples 7 / 105 Principle of Inclusion-Exclusion (PIE) II Introduction Combinatorics CSE235 Introduction We cannot use the sum rule because we would be over Counting counting the number of possible outcomes. PIE Examples Instead, we have to count the number of possible outcomes of Derangements e1 and e2 minus the number of possible outcomes in common Pigeonhole Principle to both; i.e. the number of ways to do both “tasks”. Permutations If again we think of them as sets, we have Combinations Binomial Coefficients |A1| + |A2| − |A1 ∩ A2| Generalizations Algorithms More Examples 8 / 105 Principle of Inclusion-Exclusion (PIE) III Introduction Combinatorics CSE235 More generally, we have the following. Introduction Lemma Counting Let A, B be subsets of a finite set U. Then PIE Examples 1 |A ∪ B| = |A| + |B| − |A ∩ B| Derangements Pigeonhole 2 |A ∩ B| ≤ min{|A|, |B|} Principle 3 Permutations |A \ B| = |A| − |A ∩ B| ≥ |A| − |B| Combinations 4 |A| = |U| − |A| Binomial 5 Coefficients |A ⊕ B| = |A ∪ B| − |A ∩ B| = A + B − 2|A ∩ B| = Generalizations |A \ B| + |B \ A| Algorithms 6 |A × B| = |A| × |B| More Examples 9 / 105 Principle of Inclusion-Exclusion (PIE) I Theorem Combinatorics Theorem CSE235 Let A1,A2,...,An be finite sets, then Introduction Counting X |A1 ∪ A2 ∪ · · · ∪ An| = |Ai| PIE i Examples Derangements X − |Ai ∩ Aj| Pigeonhole Principle i<j Permutations X + |Ai ∩ Aj ∩ Ak| Combinations i<j<k Binomial Coefficients − · · · Generalizations n+1 +(−1) |A1 ∩ A2 ∩ · · · ∩ An| Algorithms More Examples Each summation is over all i, pairs i, j with i < j, triples i, j, k with i < j < k etc. 10 / 105 Principle of Inclusion-Exclusion (PIE) II Theorem Combinatorics CSE235 Introduction Counting To illustrate, when n = 3, we have PIE Examples Derangements |A1 ∪ A2 ∪ A3| = |A1| + |A2| + |A3| Pigeonhole Principle − |A1 ∩ A2| + |A1 ∩ A3| + |A2 ∩ A3| Permutations +|A1 ∩ A2 ∩ A3| Combinations Binomial Coefficients Generalizations Algorithms More Examples 11 / 105 Principle of Inclusion-Exclusion (PIE) III Theorem Combinatorics CSE235 To illustrate, when n = 4, we have Introduction Counting |A1 ∪ A2 ∪ A3 ∪ A4| = |A1| + |A2| + |A3| + |A4| PIE h Examples − |A1 ∩ A2| + |A1 ∩ A3| + +|A1 ∩ A4| Derangements i Pigeonhole Principle |A2 ∩ A3| + |A2 ∩ A4| + |A3 ∩ A4| Permutations h + |A1 ∩ A2 ∩ A3| + |A1 ∩ A2 ∩ A4| + Combinations Binomial i Coefficients |A1 ∩ A3 ∩ A4| + |A2 ∩ A3 ∩ A4| Generalizations −|A1 ∩ A2 ∩ A3 ∩ A4| Algorithms More Examples 12 / 105 Principle of Inclusion-Exclusion (PIE) I Example I Combinatorics CSE235 Example Introduction Counting How many integers between 1 and 300 (inclusive) are PIE 1 Divisible by at least one of 3, 5, 7? Examples Derangements 2 Divisible by 3 and by 5 but not by 7? Pigeonhole Principle 3 Divisible by 5 but by neither 3 nor 7? Permutations Combinations Binomial Let Coefficients A = {n | 1 ≤ n ≤ 300 ∧ 3 | n} Generalizations B = {n | 1 ≤ n ≤ 300 ∧ 5 | n} Algorithms C = {n | 1 ≤ n ≤ 300 ∧ 7 | n} More Examples 13 / 105 Principle of Inclusion-Exclusion (PIE) II Example I Combinatorics CSE235 Introduction Counting How big are each of these sets? We can easily use the floor PIE function; Examples Derangements |A| = b300/3c = 100 Pigeonhole |B| = b300/5c = 60 Principle |C| = b300/7c = 42 Permutations Combinations Binomial For (1) above, we are asked to find |A ∪ B ∪ C|. Coefficients Generalizations Algorithms More Examples 14 / 105 Principle of Inclusion-Exclusion (PIE) III Example I Combinatorics CSE235 By the principle of inclusion-exclusion, we have that Introduction Counting |A ∪ B ∪ C| = |A| + |B| + |C| PIE Examples h i Derangements − |A ∩ B| + |A ∩ C| + |B ∩ C| Pigeonhole Principle +|A ∩ B ∩ C| Permutations Combinations It remains to find the final 4 cardinalities. Binomial Coefficients All three divisors, 3, 5, 7 are relatively prime. Thus, any integer Generalizations that is divisible by both 3 and 5 must simply be divisible by 15. Algorithms More Examples 15 / 105 Principle of Inclusion-Exclusion (PIE) IV Example I Combinatorics CSE235 Using the same reasoning for all pairs (and the triple) we have Introduction Counting |A ∩ B| = b300/15c = 20 PIE Examples |A ∩ C| = b300/21c = 14 Derangements |B ∩ C| = b300/35c = 8 Pigeonhole Principle |A ∩ B ∩ C| = b300/105c = 2 Permutations Combinations Therefore, Binomial Coefficients |A ∪ B ∪ C| = 100 + 60 + 42 − 20 − 14 − 8 + 2 = 162 Generalizations Algorithms More Examples 16 / 105 Principle of Inclusion-Exclusion (PIE) V Example I Combinatorics CSE235 Introduction Counting For (2) above, it is enough to find PIE Examples |(A ∩ B) \ C| Derangements Pigeonhole Principle By the definition of set-minus, Permutations Combinations |(A ∩ B) \ C| = |A ∩ B| − |A ∩ B ∩ C| = 20 − 2 = 18 Binomial Coefficients Generalizations Algorithms More Examples 17 / 105 Principle of Inclusion-Exclusion (PIE) VI Example I Combinatorics CSE235 For (3) above, we are asked to find Introduction Counting |B \ (A ∪ C)| = |B| − |B ∩ (A ∪ C)| PIE Examples Derangements By distributing B over the intersection, we get Pigeonhole Principle |B ∩ (A ∪ C)| = |(B ∩ A) ∪ (B ∩ C)| Permutations = |B ∩ A| + |B ∩ C| − |(B ∩ A) ∩ (B ∩ C)| Combinations = |B ∩ A| + |B ∩ C| − |B ∩ A ∩ C| Binomial Coefficients = 20 + 8 − 2 = 26 Generalizations Algorithms So the answer is |B| − 26 = 60 − 26 = 34. More Examples 18 / 105 Principle of Inclusion-Exclusion (PIE) I Example II Combinatorics CSE235 The principle of inclusion-exclusion can be used to count the Introduction number of onto functions. Counting PIE Theorem Examples Derangements Let A, B be non-empty sets of cardinality m, n with m ≥ n. Pigeonhole Then there are Principle Permutations n n n nm − (n−1)m + (n−2)m −· · ·+(−1)n−1 1m Combinations 1 2 n − 1 Binomial Coefficients Pn−1 in m Generalizations i.e. i=0 (−1) i (n − i) onto functions f : A → B. Algorithms More Examples See textbook page 460. 19 / 105 Principle of Inclusion-Exclusion (PIE) II Example II Combinatorics CSE235 Example Introduction How many ways of giving out 6 pieces of candy to 3 children if Counting each child must receive at least one piece? PIE Examples Derangements Pigeonhole This can be modeled by letting A represent the set of candies Principle and B be the set of children. Permutations Combinations Then a function f : A → B can
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages105 Page
-
File Size-