Chapter 5. Counting 5.1 The Basic of Counting What is counting? (how many ways of doing things) combinations: how many possible ways to choose 4 people from 10? how many license plates that start with letter A or end digit 0? 1
basic counting principles: The production rule: if a procedure can be broken into a sequence of two tasks, then there are n 1 n 2 ways to do the procedure if there are n 1 ways for doing first task and n 2 ways of doing the second. examples: how many possible vehicle license tags if they are allowed to have 3 letters and 4 digits? how many 1-1 functions between two sets? pages 336-338 A 1 A 2 = A 1 A 2 A 1 A 2... A m = A 1 A 2... A m 2
The sum rule: If a task can be thought of as either of two takes that do not overlap, then there are n 1 + n 2 ways of accomplishing the original task, where n 1 and n 2 are the numbers of ways to finish the two tasks respectively. examples: pages 338-339 A 1 A 2 = A 1 + A 2 A 1 A 2... A m = A 1 + A 2 +... + A m note: A i A j = φ is required. 3
More complex counting problems: examples pages 340-341 The inclusion-exclusion principle examples: (1) number of binary strings of length 8 that begin with 1 and ends with 00 s (2) number of binary strings of length 8 that begin with 1 or ends with 00 s A 1 A 2 = A 1 + A 2 A 1 A 2 The tree diagram examples (pages 343-344) 4
5.2 Pigeonhole Principle Theorem 1 (Pigeonhole Principle) If k + 1 or more objects are placed into k boxes, then there is at least one box containing two or more objects. Corollary 1 A function f from a set with k +1 elements to a set with k elements is not 1-1. examples (page 348) Theorem 2 (Generalized Pigeonhole Principle) If N objects are placed into k boxes, then there is at least one box containing at least N/k objects. examples (pages 349-350) 5
Elegant applicants of the Pigeonhole principles pages 351-352. Example 11: Among any n + 1 positive integers not exceeding 2n, there must be an integer that divides one of the other integers. Proof 1: The set of numbers not exceeding 2n is {1, 2, 3, 4,..., 2n} = {1, 3,..., 2n 1} {2, 4,..., 2n} A rigorous argument: Assume these n + 1 numbers to be a 1, a 2,..., a n+1. a i can be written as 2 k i q i for some odd number q i. So in q 1, q 2,... q n+1, there must be two numbers q j and q k are the same because there are only n odd numbers. So a j can divide a k or the other way. 6
Theorem 3 Every sequence of n 2 + 1 distinct real numbers contains a subsequence of length n+1 that is either strictly increasing or strictly decreasing. Example: 8, 11, 9, 1, 4, 6, 12, 10, 5, 7 10 = 3 2 + 1, here n = 3. increasing subsequence: 1, 4, 6, 10 of length 3 + 1 = 4. The idea of a proof: associate each number a k in the sequence with a pair (i k, d k ), where i k is the length of a longest increasing subsequence beginning from a k and d k is the length of the longest decreasing subsequence beginning from a k 8, 11, 9, 1, 4, 6, 12, 10, 5, 7 (3,3) (2,4) (2,3) (4,1) (3,1) (2,2) (1,3) (1,2) (2,1) (1,1) Assume that theorem is incorrect, then i k n and d k n and the total number of such pairs is at most n 2. So two of such pairs must be the same. Let these two pairs be (i s, d s ) and (i t, d t ) and i s = i t and d s = d t. Suppose a s < a t, then we can build length i s + 1 increasing subsequence starting at a s. This is a contradiction. The same argument applied to the case a s > a t. 7
Ramsey theory: In a group of 6 people, either there are three mutually know each other, or three mutual strangers to each other. Proof: Fixing a person A. Then for the rest 5 people, there can be grouped according to whether knowing A or not. So there must be 5/2 = 3 people such that every one of the three knows A or none of the 3 knows A. In the former case, assume they are B, C, D. If any two of B, C, D, say B, C, know each other, then A, B, C know each other. If no two in B, C, D know each other, then B, C, D are strangers to each other. A similar argument can be made to the latter case that none of B, C, D knows A. 8
5.3 Permutations and Combinations permutation: an ordered arrangement of a set of objects. The number of permutations of n objects is n! how to get this? r-permutation of n element: an arrangement of r objects, denoted by P (n, r) Theorem 1 P (n, r) = n (n 1)... (n r + 1) P (n, r) = n! (n r)! Examples (pages 356-357) 9
r-combination: an unordered selection of r objects. Theorem 2 The number of r-combinations of n objects Proof: C(n, r) = P (n, r) = C(n, r)p (r, r). So n! r!(n r)! C(n, r) = P (n, r)/p (r, r) = P (n.r)/(r!) = n! (n r)! /(r!) = n! r!(n r)! Corollary 2 C(n, r) = C(n, n r). Examples (pages 358-360). Definition: A combinatorial proof of an identity is a proof that uses counting argument to prove the both sides of the identity count the same objects but in different ways. 10