1 / 9

Chapter 1: Introduction

Chapter 1: Introduction. Mathematical Proofs. Mathematical Induction. CS 340. Page 1. Math Review: Mathematical Proofs. How do you prove that something is true about a set of values?. Show that it’s true for every value in the set?. But what if the set is infinite ?.

lapis
Télécharger la présentation

Chapter 1: Introduction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 1: Introduction • Mathematical Proofs • Mathematical Induction CS 340 Page 1

  2. Math Review: Mathematical Proofs How do you prove that something is true about a set of values? • Show that it’s true for every value in the set? • But what if the set is infinite? Prove that nn n! for all positive values for n. Well, 1 = 11 1! = 1 and 4 = 22 2! = 2 and 27 = 33 3! = 6 and 256 = 44 4! = 24 and ... • Show that it’s true for the first few values in the set? • But what if it’s only true for those first few values? Prove that 1,000,000  n 2 for all positive values for n. Well, it’s true for 12 and 22 and 32 and 42 and 52 and 62 and 72 and 82 and ... (… it stops being true at 1001!) • Show that it’s true for several randomly chosen values in the set? • But what if it’s only true for those randomly chosen values? Prove that every positive number n equals the sum of its smaller positive factors. Well, it’s true for 6 = 1+2+3 and 28 = 1+2+4+7+14 and 496 = 1+2+4+8+16+31+62+124+248 and ... (… there are only seven values that work!) CS 340 Page 2

  3. Mathematical Induction One way to successfully prove a theorem about a set of values is by means of mathematical induction. Step One: Prove A Base Case Formally demonstrate that the theorem is true for some small n-value n0 Step Two: Assume An Inductive Hypothesis Assume that the theorem is true for all n-values up to and including k, where k  n0 Step Three: Prove For n = k + 1 Using the inductive hypothesis, prove the theorem for the n-value k+1 CS 340 Page 3

  4. An Intuitive Example Prove that for any value n ≥ 8, it is possible to produce n cents of postage from 3¢ and 5¢ stamps. Looking at a table of stamp combinations, this appears to be true… CS 340 Page 4

  5. Proving It The strategy here will be to prove that there’s a way to produce n + 1 cents of postage by using the solution for n - 2 cents, plus one 3¢ stamp. There is a pitfall with this approach: If n + 1 is 8, 9, or 10, then n - 2 will be less than 8 and might not have a solution. Step One: Prove The Base Cases: n=8, n=9, and n =10 8¢ = 3¢ + 5¢; 9¢ = 3¢ + 3¢ + 3¢; 10¢ = 5¢ + 5¢ Step Two: Assume The Inductive Hypothesis Assume that combinations of 3¢ and 5¢ stamps can be found to make n¢ of postage for all n-values from 8 to k, where k  10 (i.e., n0 = 10) Step Three: Prove For n = k + 1 Since k ≥ 10, k – 2 ≥ 8, so the inductive hypothesis tells us that there is a combination of 3¢ and 5¢ stamps that makes (k – 2)¢ of postage; add one 3¢stamp to that and you’ll have a combination totaling (k+1)¢ CS 340 Page 5

  6. Formal Induction Example Theorem A: i = 1,n i = ½n (n + 1) for all n  1. Proof (by induction): Step One (Prove for a base case): For n = 1,  i = 1,1i = 1 = ½(1)(1+ 1). Step Two (Inductive hypothesis): Assume that it’s been proven for n-values up through k:  i = 1,k i = ½k(k + 1). Step Three (Prove for the next value): Prove for n = k + 1:  i = 1,k+1i = (k + 1) +  i = 1,k i (by commutative law of +) = (k + 1) + ½k(k + 1) (by inductive hypothesis) = ½(2)(k + 1) + ½k(k + 1) (since 1 = ½ * 2) = ½(k + 1)(k + 2) (by distributive law of * over +) = ½(k + 1)((k + 1) + 1). (by associative law of +) CS 340 Page 6

  7. Why Does Induction Work? To prove that  i = 1,n i = ½n (n + 1) for all n  1, we started by proving that it was true for n = 1. Once we accomplished that, we proved that if it had been proven true for some arbitrary value k, then it must be true for the next value: k + 1. In essence, this last proof causes the truth of the theorem to “cascade” through all remaining values. Proof that if it’s true for n = k, then it’s also true for n = k + 1 TRUE FOR n = 1: 1 = ½(1)(2) TRUE FOR n = 2: 1 + 2 = ½(2)(3) TRUE FOR n = 3: 1+2+3 = ½(3)(4) TRUE FOR n = 4: 1+2+3 +4 = ½(4)(5) TRUE FOR n = 5 : 1+2+3 +4+5 = ½(5)(6) Letting k = 1 Letting k = 2 Letting k = 3 Letting k = 4 And so on... CS 340 Page 7

  8. Formal Induction Example #2 Theorem B: i = 1,n i 3 = ( i = 1,n i )2 for all n  1. Proof (by induction): Step One (Prove for a base case): For n = 1,  i = 1,1 i 3 = 1 = ( i = 1,1 i )2. Step Two (Inductive hypothesis): Assume that it’s been proven for n-values through k:  i = 1,k i 3 = ( i = 1,k i )2. Step Three (Prove for the next value): Prove for n = k + 1: ( i = 1,k+1 i)2 = ((k + 1) +  i = 1,k i )2 (by commutative law of +) = (k + 1)2 + 2(k + 1)( i = 1,k i ) + ( i = 1,k i )2 (by distrib. & commut. laws) = (k + 1)2 + 2(k + 1)(½k(k + 1)) + ( i = 1,k i )2 (by Theorem A) = (k + 1)2 + 2(k + 1)(½k(k + 1)) +  i = 1,k i 3 (by inductive hypothesis) = (k + 1)3 +  i = 1,k i 3 (by distrib. & commut. laws) =  i = 1,k+1 i 3. (by commutative law of +) CS 340 Page 8

  9. What’s Wrong With This Induction? Theorem Z:For any group of n students, all n will get the same grade in CS 340. Proof (by induction): Step One (Prove for a base case): For n = 1, the group consists of a single student, so the entire group obviously will get the same grade in CS 340. Step Two (Inductive hypothesis): Assume that it’s been proven for n-values through k: Any group of k students will get the same CS 340 grade. Step Three (Prove for the next value): Prove for n = k + 1: Given a group of k + 1 students, remove one student. The resulting group of k students will, by the inductive hypothesis, get the same grade in CS 340. Reinsert the student that was removed and then remove a different student. The resulting group of k people will also receive the same grade in CS 340. Thus, since all of the unremovedstudents will get the same grade as the second removed student and the same grade as the first removed student, all k + 1 students will have to receive the same grade in CS 340! CS 340 Page 9

More Related