CIS 160 - Spring 2018 (instructor Val Tannen) Lecture 09 Tuesday, February 13 PROOFS and COUNTING Figure 1: Too Many Pigeons Theorem 9.1 (The Pigeonhole Principle (PHP)) If k + 1 or more pigeons fly to roost in k pigeonholes then there is at least one pigeonhole that shelters at least two or more pigeons. or, equivalently, If f : A B is a function such that A > B then there exist at least two elements x 1, x 2 A such that x 1 x 2 but f(x 1 ) = f(x 2 ). (Why are these two formulations equivalent?) 1 From the second formulation we see that the Pigeonhole Principle is the contrapositive of the Injection Rule that we encountered before. We continue to accept them without proof. 1 In France, they say Principle of the Drawers instead of PHP. It might be easier to place k + 1 pieces of underwear in k drawers than to persuade k + 1 pigeons to fly into k pigeonholes together. 1
For example, the (PHP) can be used to conclude that in any group of thirteen people there are at least two who are born in the same month. Example 9.2 A drawer in a dark room contains red socks, green socks, blue socks, and orange socks. How many socks must you take from the drawer to be sure that you have at least one matching pair? (We assume that any two socks of the same color form a matching pair.) Solution: PHP can be applied by letting the pigeonholes correspond to the four colors: red, green, blue, and orange and the pigeons correspond to the socks. If we pick five or more socks we are guaranteed to have a matching pair. A weird application much beloved by some textbook authors is to prove that in NYC (or another big enough city) there exist two people with exactly the same number of hairs on their head. Surely, the premed students among you already know that the number of hairs on a person s head is at most 200,000. Actually, this only requires a city with 200,000 non-bald inhabitants. With 1M or 10M such inhabitants we can say more, by generalizing PHP as follows. But first, we ll need to formalize a couple concepts. In general, for integers r and n, the division r/n may not yield an integer. The notation r/n is called ceiling and can be defined for any real number, together with its dual, floor: Definition 9.3 Let x R. The ceiling of x, denoted x is the smallest integer z such that z x. Note that: x x < x + 1 The floor of x, denoted x is the largest integer z such that z x. Note that: x 1 < x < x With this definition in hand, we may now generalize PHP. Theorem 9.4 (The Generalized PHP) r objects are placed into n boxes. For any integer k such that r > k n there is at least one box containing at least k + 1 objects. or, equivalently, If f : A B is a function and k is an positive integer such that A > k B then there exist at least k + 1 pairwise distinct elements x 1,..., x k+1 A such that f(x 1 ) = = f(x k+1 ). or, equivalently, If r objects are placed into n boxes then there is at least one box containing at least r/n objects. Proof: Here is a proof of the last formulation of the three for the GPHP (the generalized PHP). You should prove on your own that the first two formulation are equivalent to the last one. 2
We prove the contrapositive. That is, we will show that if each box contains at most r/n 1 objects then the total number of objects is not equal to r. Assume that each box contains at most r/n 1 objects. Then, the total number of objects is at most ( r ) ( r ) n 1 < n n n + 1 1 = r Thus we have shown that the total number of objects is strictly less than r. Using the generalized pigeonhole principle we can conclude that among 100 people, there are at least 100/12 = 9 who are born in the same month. Example 9.5 Suppose each point in the plane is colored either red or blue. Show that there always exist two points of the same color that are exactly one foot apart. Solution: Consider an equilateral triangle with the length of each side being one feet. The three corners of the triangle are colored red or blue. By PHP, two of these three points must have the same color. (Note that the set of points in the plane is infinite, but we do not apply PHP to an infinite set!) Example 9.6 Given a sequence of n integers, show that there exists among them some integers which appear in consecutive positions in the sequence and whose sum is a multiple of n. Solution: Let x 1, x 2,..., x n be the sequence of n integers. Consider the following n sums. x 1, x 1 + x 2, x 1 + x 2 + x 3,..., x 1 + x 2 + + x n If any of these n sums is divisible by n, then we are done. Otherwise, each of the n sums have a non-zero remainder when divided by n. There are at most n 1 different possible remainders: 1, 2,... n 1. Since there are n sums, by PHP, at least two of the n sums have the same remainder, call it r, when divided by n and let x 1 + x 2 + + x p and x 1 + x 2 + + x q with p q, be the two sums that give remainder r. Then, for some integers c 1 and c 2, x 1 + x 2 + + x p = c 1 n + r and x 1 + x 2 + + x q = c 2 n + r W.l.o.g. assume p < q. Subtracting the two sums, we get x p+1 + + x q = (c 2 c 1 )n Hence, x p+1 + + x q is divisible by n. 3
Example 9.7 Show that in any group of six people there are three mutual friends or three mutual strangers. (The unrealistic assumption here is that any two people are either friends or strangers.) Solution: Consider one of the six people, say A. The remaining five people are either friends of A or they do not know A. By PHP, at least 3 of the five people are either friends of A or are unacquainted with A. In the former case, if any two of the three people are friends then these two along with A would be mutual friends, otherwise the three people would be strangers to each other. The proof for the latter case, when three or more people are unacquainted with A, proceeds in the same manner. (BTW, this is a particular case of a famous theorem of Ramsey. We will come back to this later in the course.) Theorem 9.8 (Erdös-Szekeres) Let n be a positive integer. Every sequence of n 2 + 1 distinct integers must contain a monotone (increasing or decreasing) subsequence of length n + 1. Proof: Subsequence means that some of the elements are chosen and listed in the same order. The elements of the subsequence need not be consecutive or adjacent in the sequence. Suppose we have a sequence of distinct integers. (We don t need this in the proof, but w.l.o.g. you can assume that they are positive; why?) For each integer x in the sequence let u x be the length of a longest increasing subsequence that starts at x (we count x in the length) and let d x be the length of a longest decreasing subsequence that starts at x (again we count x in the length). Lemma 9.9 If x y are distinct integers in the sequence such that x occurs before y then (u x, d x ) (u y, d y ). Proof: Indeed, if x < y then u x > u y (why?) and if x > y then d x > d y. Now we prove the theorem by contradiction. Suppose that all monotone subsequences have length at most n. Then for each x in the sequence we have u x, d x [1..n]. We use PHP with the pairs (i, j) [1..n] [1..n] as pigeonholes, with the integers in the sequence as pigeons, and with pigeon x being placed in pigeonhole (u x, d x ). Since we have n 2 + 1 integers in the sequence but only n 2 pairs in [1..n] [1..n], we must have (u x, d x ) = (u y, d y ) for some distinct x y. This contradicts the Lemma. 2 2 Paul Erdös was one of the most famous mathematicians of the 20th century, google Erdos and read the Wikipedia page. 4
PROOFS: INDUCTION The Principle of (Ordinary) Induction of the form is a way (not the only way!) of proving statements for all natural numbers n we have P (n) where P (n) is a predicate whose truth depends on n. Examples of P (n) s of interest: (A) P (n) is 2 0 + 2 1 + + 2 n = 2 n+1 1 (B) P (n) is 1 + 2 + 3 + + n = n(n + 1)/2 (C) P (n) is 1 2 + 2 2 + 3 2 + + n 2 = n(n + 1)(2n + 1)/6 Proof Pattern (BASE CASE) Prove P (0). (INDUCTION STEP) Let k be an arbitrary natural number. Prove P (k) P (k + 1). Then you can conclude that for all natural numbers n we have P (n) (i.e., n N P (n)). The P (k) inside the box in the induction step is called the INDUCTION HYPOTHESIS (IH). The IH only makes sense within the induction step because it refers to a k that is quantified at the beginning of the induction step with let k be.... To understand a proof by induction it helps if the proof writer clearly identifies the IH. We shall accept the Principle of Ordinary Induction without proof. (It is very close to the axioms of Mathematics itself.) We shall see later the Principle of Strong Induction, hence the need for the adjective ordinary, and below the Well-Ordering Principle. These three are logically equivalent to each other, a fact that is not so hard to prove. Try it. Example 9.10 ((A) from above) Prove the following: n N 2 0 + 2 1 + + 2 n = 2 n+1 1 Solution: Here P (n) is 2 0 + 2 1 + + 2 n = 2 n+1 1. (BASE CASE) 2 0 = 1 and 2 0+1 1 = 2 1 = 1. Check. 5
(INDUCTION STEP) Let k be an arbitrary natural number. Assume 2 0 + 2 1 + + 2 k = 2 k+1 1. (This is the IH.) (And WTS 2 0 + 2 1 + + 2 k+1 = 2 k+2 1.) We manipulate the LHS of the equality we want to show: 2 0 + 2 1 + + 2 k+1 = (2 0 + 2 1 + + 2 k ) + 2 k+1 = 2 k+1 1 + 2 k+1 (by IH) = 2 2 k+1 1 = 2 k+2 1 BTW, this identity gives the summation of the geometric progression with ration 2. Sometimes the predicate P (n) used in a proof by induction is not true for n = 0, it is not even defined for n = 0, as is the case in the Examples (B) and (C) above. The following variation on the induction proof pattern takes care of such situations. Proof Pattern (BASE CASE) Prove P (n 0 ). (INDUCTION STEP) Let k N such that k n 0. Prove P (k) P (k + 1). Then you can conclude that for all natural numbers n n 0 we have P (n) (i.e., n N n n 0 P (n)). Using this proof pattern you should try to prove (B) and (C), with n 0 = 1. We will do a slightly more complicated example. Example 9.11 For big enough natural numbers n we have n 2 < 2 n. Part of the problem is to make precise big enough. Solution: To figure out the big enough we try n = 0, 1, 2, 3, 4, 5, 6 and we guess that it can be n 5. (BASE CASE) n = 5. 5 2 = 25 < 32 = 2 5. Check. (INDUCTION STEP) Let k 5. Assume (IH) k 2 < 2 k. (And WTS (k + 1) 2 < 2 k+1.) Note that (k + 1) 2 = k 2 + 2k + 1 and that 2 k+1 = 2 2 k = 2 k + 2 k. We already know by IH that k 2 < 2 k. So it would suffice to also show 2k + 1 k 2. We make this into a separate Lemma: 6
Lemma 9.12 For big enough m N we have 2m + 1 < m 2. Solution: Here, as above, we will assume that m 5. We then see that: 1 < m = 2m + 1 < 2m + m = 3m Similarly, we see that: Combining these two results, we have 3 < m = 3m < m 2 2m + 1 < 3m < m 2 as desired. In fact, we could have proven this Lemma with induction! We leave it as an exercise for the reader. Returning to the main proof, we have that: (k + 1) 2 = k 2 + 2k + 1 < k 2 + k 2 < 2 k + 2 k = 2 k+1 We have shown that n 5 n 2 < 2 n. 7