Proofs by Induction Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.1 An Example of Induction Suppose we have a property (say color) of the natural numbers: 0, 1, 2, 3, 4, 5, … Showing that zero is red, and that the successor of any red number is red, proves that all numbers are red! Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.2 The Induction Rule 0 and (from n to n+1) proves 0, 1, 2, 3,…. R(0), ∀n∈N [R(n)→R(n+1)] ∀m∈N R(m) _____ Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.3 Like Dominos… Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.4 Example Induction Proof Let’s prove: n +1 −1 1+ r + r +L + r = r −1 2 Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. n r September 21, 2005 L2-1.5 Proof by Induction Statements in green form a template for inductive proofs: Proof: (by induction on n) The induction hypothesis: n +1 −1 P(n) ::= 1 + r + r + L + r = r −1 2 Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. n September 21, 2005 r L2-1.6 Example Induction Proof Base Case (n = 0): ? r 0+1 − 1 2 0 r2444 r = 1144 + r +4 + L +3 r −1 1 r −1 = Wait: divide by zero bug! This is only true for r ≠ 1 Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. r −1 September 21, 2005 =1 L2-1.7 An Example Proof Revised Theorem: n +1 −1 ∀r ≠ 1 1 + r + r + L + r = r −1 2 r n Revised Induction Hypothesis: n +1 −1 P (n) ::= ∀r ≠ 1 1 + r + r + L + r = r −1 2 Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 n r L2-1.8 An Example Proof Induction Step: Assume P(n) for n ≥ 0 to prove P(n + 1): ∀r ≠ 1 1 + r + r + L + r 2 Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. n +1 September 21, 2005 = r ( n +1) +1 −1 r −1 L2-1.9 An Example Proof Have P(n) by assumption: n +1 −1 1+ r + r +L + r = r −1 2 n r Adding r n+1 to both sides: 1+L + r + r n n +1 = = Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. n +1 − 1 n +1 +r r −1 n +1 n +1 r − 1 + r (r − 1) r −1 r September 21, 2005 L2-1.10 An Example Proof Continued… 1+L + r + r n n +1 = = n +1 n +1 − 1 + r ⋅ r + −r r −1 ( n +1) +1 r −1 r −1 r n +1 Which is just P(n+1) Therefore theorem is true by induction. QED. Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.11 An Aside: Ellipses Ellipses (…) mean that the reader is supposed to infer a pattern. • Can lead to confusion • Summation notation gives more precision, for example: n 1+ r + r +L + r = ∑ r 2 n i i =0 Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.12 Problems Class Problem 1 Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.13 The MIT Stata Center Copyright © 2003, 2004, 2005 Norman Walsh. This work is licensed under a Creative Commons License. Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.14 The Stata Center Plaza Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.15 The Gehry/Gates Plaza Goal: tile the squares, except one in the middle for Bill. Photo courtesy of Ricardo Stuckert/ABr. 2 n 2 Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. n September 21, 2005 L2-1.16 The Gehry/Gates Plaza Gehry specifies L-shaped tiles covering three squares: For example, for 8 x 8 plaza might tile for Bill this way: Photo courtesy of Ricardo Stuckert/ABr. Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.17 The Gehry/Gates Plaza Theorem: For any 2n × 2n plaza, we can make Bill and Frank happy. Proof: (by induction on n) P(n) ::= can tile 2n × 2n with Bill in middle. Base case: (n=0) (no tiles needed) Photo courtesy of Ricardo Stuckert/ABr. Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.18 The Gehry/Gates Plaza Induction step: assume can tile 2n × 2n, prove can handle 2n+1 × 2n+1. 2 2 n n +1 Photo courtesy of Ricardo Stuckert/ABr. Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.19 The Gehry/Gates Plaza Now what? 2 2 n n +1 Photo courtesy of Ricardo Stuckert/ABr. Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.20 The Gehry/Gates Plaza The fix: Prove that we can always find a tiling with Bill in the corner. Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.21 The Gehry/Gates Plaza Note: Once have Bill in corner, can get Bill in middle: Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. Photo courtesy of Ricardo Stuckert/ABr. September 21, 2005 L2-1.22 The Gehry/Gates Plaza Method: Rotate the squares as indicated. Photo courtesy of Ricardo Stuckert/ABr. Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.23 The Gehry/Gates Plaza Method: after rotation have: Photo courtesy of Ricardo Stuckert/ABr. Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.24 The Gehry/Gates Plaza Method: Now group the 4 squares together, and insert a tile. Photo courtesy of Ricardo Stuckert/ABr. Done! Bill in middle Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.25 The Gehry/Gates Plaza Theorem: For any 2n × 2n plaza, we can put Bill in the corner. Proof: (by induction on n) P(n) ::= can tile 2n × 2n with Bill in corner Base case: (n=0) (no tiles needed) Photo courtesy of Ricardo Stuckert/ABr. Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.26 The Gehry/Gates Plaza Induction step: Assume we can get Bill in corner of 2n × 2n. Prove we can get Bill in corner of 2n+1 × 2n+1. 2 n 2 n Photo courtesy of Ricardo Stuckert/ABr. Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.27 The Gehry/Gates Plaza Method: Rotate the squares as indicated. Photo courtesy of Ricardo Stuckert/ABr. Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.28 The Gehry/Gates Plaza Method: Rotate the squares as indicated. after rotation have: Photo courtesy of Ricardo Stuckert/ABr. Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.29 The Gehry/Gates Plaza Method: Now group the squares together, and fill the center with a tile. Done! Photo courtesy of Ricardo Stuckert/ABr. Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.30 Ingenious Induction Hypotheses Note 1: To prove “Bill in middle,” we proved something else: “Bill in corner.” Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.31 Ingenious Induction Hypotheses Note 2: Other times it helps to choose a stronger hypothesis than the desired result. Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.32 Inductive (Recursive) Procedures Note 3: The induction proof of “Bill in corner” implicitly defines a recursive procedure for constructing a 2n+1 × 2n+1 corner tiling from a 2n × 2n corner tiling. Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.33 Problems Class Problem 2 Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.34 A False Proof Theorem: All horses are the same color. Proof: (by induction on n) Induction hypothesis: P(n) ::= any set of n horses have the same color Base case (n=0): No horses so vacuously true! … Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.35 A False Proof (Inductive case) Assume any n horses have the same color. Prove that any n+1 horses have the same color. … n+1 Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.36 A False Proof (Inductive case) Assume any n horses have the same color. Prove that any n+1 horses have the same color. Second set of n horses have the same color … First set of n horses have the same color Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.37 A False Proof (Inductive case) Assume any n horses have the same color. Prove that any n+1 horses have the same color. … Therefore the set of n+1 have the same color! Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.38 A False Proof What is wrong? n =1 Proof that P(n) →P(n+1) is false if n = 1, because the two horse groups do not overlap. Second set of n=1 horses First set of n=1 horses Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.39 A False Proof Proof that P(n) →P(n+1) is false if n = 1, because the two horse groups do not overlap. (But proof works for all n ≠ 1) Copyright © Albert R. Meyer and Ronitt Rubinfeld, 2005. September 21, 2005 L2-1.40