CSE 20 – Discrete Mathematics Dr. Cynthia Bailey Lee Dr. Shachar Lovett Peer Instruction in Discrete Mathematics by Cynthia Leeis licensed under a Creative.

Slides:



Advertisements
Similar presentations
CSE 20 – Discrete Mathematics Dr. Cynthia Bailey Lee Dr. Shachar Lovett Peer Instruction in Discrete Mathematics by Cynthia Leeis licensed under a Creative.
Advertisements

CSE 20 – Discrete Mathematics Dr. Cynthia Bailey Lee Dr. Shachar Lovett Peer Instruction in Discrete Mathematics by Cynthia Leeis licensed under a Creative.
CSE 20 – Discrete Mathematics Dr. Cynthia Bailey Lee Dr. Shachar Lovett Peer Instruction in Discrete Mathematics by Cynthia Leeis licensed under a Creative.
CSE 20 – Discrete Mathematics Dr. Cynthia Bailey Lee Dr. Shachar Lovett Peer Instruction in Discrete Mathematics by Cynthia Leeis licensed under a Creative.
Prof. Shachar Lovett Clicker frequency: CA CSE 20 Discrete math Prof. Shachar Lovett
22C:19 Discrete Structures Induction and Recursion Fall 2014 Sukumar Ghosh.
Mathematical Induction II Lecture 14: Nov
CSE 20 – Discrete Mathematics Dr. Cynthia Bailey Lee Dr. Shachar Lovett Peer Instruction in Discrete Mathematics by Cynthia Leeis licensed under a Creative.
CSE 20 – Discrete Mathematics Dr. Cynthia Bailey Lee Dr. Shachar Lovett Peer Instruction in Discrete Mathematics by Cynthia Leeis licensed under a Creative.
CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.
Algorithms Recurrences. Definition – a recurrence is an equation or inequality that describes a function in terms of its value on smaller inputs Example.
Week 5 - Friday.  What did we talk about last time?  Sequences  Summation and production notation  Proof by induction.
Induction and Recursion. Odd Powers Are Odd Fact: If m is odd and n is odd, then nm is odd. Proposition: for an odd number m, m k is odd for all non-negative.
Induction Lecture 5: Sep 21 (chapter of the book and chapter of the notes)
CSE 20 – Discrete Mathematics Dr. Cynthia Bailey Lee Dr. Shachar Lovett Peer Instruction in Discrete Mathematics by Cynthia Leeis licensed under a Creative.
Induction and recursion
1.  The set N = {1,2,3,4,……..} is known as natural numbers or the set of positive integers  The natural numbers are used mainly for :  counting  ordering.
Recursive Definitions Rosen, 3.4. Recursive (or inductive) Definitions Sometimes easier to define an object in terms of itself. This process is called.
Induction Sections 4.1 and 4.2 of Rosen Fall 2010
CSE115/ENGR160 Discrete Mathematics 03/31/11
1 Section 3.3 Mathematical Induction. 2 Technique used extensively to prove results about large variety of discrete objects Can only be used to prove.
Methods of Proof Lecture 4: Sep 16 (chapter 3 of the book)
1 Strong Mathematical Induction. Principle of Strong Mathematical Induction Let P(n) be a predicate defined for integers n; a and b be fixed integers.
Induction (chapter of the book and chapter of the notes)
Induction and recursion
CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.
CSE 20 – Discrete Mathematics Dr. Cynthia Bailey Lee Dr. Shachar Lovett Peer Instruction in Discrete Mathematics by Cynthia Leeis licensed under a Creative.
Lecture 9. Arithmetic and geometric series and mathematical induction
Induction and recursion
Discrete Mathematics, 1st Edition Kevin Ferland
CSE 20 – Discrete Mathematics Dr. Cynthia Bailey Lee Dr. Shachar Lovett Peer Instruction in Discrete Mathematics by Cynthia Leeis licensed under a Creative.
Mathematics Review Exponents Logarithms Series Modular arithmetic Proofs.
Mathematical Induction. F(1) = 1; F(n+1) = F(n) + (2n+1) for n≥ F(n) n F(n) =n 2 for all n ≥ 1 Prove it!
1 Introduction to Abstract Mathematics Chapter 4: Sequences and Mathematical Induction Instructor: Hayk Melikya 4.1- Sequences. 4.2,
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
Methods of Proof. This Lecture Now we have learnt the basics in logic. We are going to apply the logical rules in proving mathematical theorems. Direct.
CSE 20 – Discrete Mathematics Dr. Cynthia Bailey Lee Dr. Shachar Lovett Peer Instruction in Discrete Mathematics by Cynthia Leeis licensed under a Creative.
1 CMSC 250 Chapter 4, con't., Inductive Proofs. 2 CMSC 250 Description l Inductive proofs must have: –Base case: where you prove that what it is you are.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
Methods of Proof Lecture 3: Sep 9. This Lecture Now we have learnt the basics in logic. We are going to apply the logical rules in proving mathematical.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
CSE 20 – Discrete Mathematics Dr. Cynthia Bailey Lee Dr. Shachar Lovett Peer Instruction in Discrete Mathematics by Cynthia Leeis licensed under a Creative.
CSE 20 – Discrete Mathematics Dr. Cynthia Bailey Lee Dr. Shachar Lovett Peer Instruction in Discrete Mathematics by Cynthia Leeis licensed under a Creative.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
Section 3.3: Mathematical Induction Mathematical induction is a proof technique that can be used to prove theorems of the form:  n  Z +,P(n) We have.
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
October 3, 2001CSE 373, Autumn Mathematical Background Exponents X A X B = X A+B X A / X B = X A-B (X A ) B = X AB X N +X N = 2X N 2 N +2 N = 2 N+1.
Mathematical Induction Section 5.1. Climbing an Infinite Ladder Suppose we have an infinite ladder: 1.We can reach the first rung of the ladder. 2.If.
CompSci 102 Discrete Math for Computer Science March 13, 2012 Prof. Rodger Slides modified from Rosen.
Chapter 5. Section 5.1 Climbing an Infinite Ladder Suppose we have an infinite ladder: 1.We can reach the first rung of the ladder. 2.If we can reach.
Methods of Proof Lecture 4: Sep 20 (chapter 3 of the book, except 3.5 and 3.8)
1 Discrete Mathematical Mathematical Induction ( الاستقراء الرياضي )
CSE 20 – Discrete Mathematics Dr. Cynthia Bailey Lee Dr. Shachar Lovett Peer Instruction in Discrete Mathematics by Cynthia Leeis licensed under a Creative.
CSE 20 – Discrete Mathematics Dr. Cynthia Bailey Lee Dr. Shachar Lovett Peer Instruction in Discrete Mathematics by Cynthia Leeis licensed under a Creative.
6/12/2016 Prepared by Dr.Saad Alabbad1 CS100 : Discrete Structures Proof Techniques(2) Mathematical Induction & Recursion Dr.Saad Alabbad Department of.
Chapter 5 With Question/Answer Animations 1. Chapter Summary Mathematical Induction - Sec 5.1 Strong Induction and Well-Ordering - Sec 5.2 Lecture 18.
Section Recursion 2  Recursion – defining an object (or function, algorithm, etc.) in terms of itself.  Recursion can be used to define sequences.
Fall 2002CMSC Discrete Structures1 Chapter 3 Sequences Mathematical Induction Recursion Recursion.
Chapter 5 1. Chapter Summary  Mathematical Induction  Strong Induction  Recursive Definitions  Structural Induction  Recursive Algorithms.
Advanced Algorithms Analysis and Design
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett
Induction and recursion
Mathematical Induction Recursion
Chapter 5 Induction and Recursion
Induction and recursion
Applied Discrete Mathematics Week 9: Integer Properties
Follow me for a walk through...
Induction Chapter
Advanced Analysis of Algorithms
Follow me for a walk through...
Presentation transcript:

CSE 20 – Discrete Mathematics Dr. Cynthia Bailey Lee Dr. Shachar Lovett Peer Instruction in Discrete Mathematics by Cynthia Leeis licensed under a Creative Commons Attribution- NonCommercial-ShareAlike 4.0 International License. Based on a work at Permissions beyond the scope of this license may be available at LeeCreative Commons Attribution- NonCommercial-ShareAlike 4.0 International Licensehttp://peerinstruction4cs.org

Today’s Topics: 1. Quick wrap-up of Monday’s coin example 2. Strong vs regular induction 3. Strong induction examples:  Divisibility by a prime  Recursion sequence: product of fractions 2

Thm: For all prices p >= 8 cents, the price p can be paid using only 5-cent and 3-cent coins. Proof (by mathematical induction): Basis step: Show the theorem holds for p=8 (by example, e.g. p=3+5) Inductive step: Assume [or “Suppose”] that the theorem holds for some p  8. WTS that the theorem holds for p+1. p  8. So the inductive step holds, completing the proof. 3 Assume that p=5n+3m where n,m  0 are integers. We need to show that p+1=5a+3b for integers a,b  0. Partition to cases: Case I: n  1. In this case, p+1=5*(n-1)+3*(m+2). Case II: m  3. In this case, p+1=5*(n+2)+3*(m-3). Case III: n=0 and m  2. Then p=5n+3m  6 which is a contradiction to p  8.

We created an algorithm!  Our proof actually allows us to algorithmically find a way to pay p using 3-cent and 5-cent coins  Algorithm for price p:  start with 8=3+5  For x=8...p, in each step adjust the number of coins according to the modification rules we’ve constructed to maintain price x 4

Algorithm pseudo-code PayWithThreeCentsAndFiveCents: Input: price p  8. Output: integers n,m  0 so that p=5n+3m 1. Let x=8, n=1, m=1 (so that x=5n+3m). 2. While x<p: a) x:=x+1 b) If n  1, set n:=n-1, m:=m+2 c) Otherwise, set n:=n+2, m:=m-3 3. Return (n,m) 5

Algorithm pseudo-code PayWithThreeCentsAndFiveCents: Input: price p  8. Output: integers n,m  0 so that p=5n+3m 1. Let x=8, n=1, m=1 (so that x=5n+3m). 2. While x<p: a) x:=x+1 b) If n  1, set n:=n-1, m:=m+2 c) Otherwise, set n:=n+2, m:=m-3 3. Return (n,m) 6 Invariant: x=5n+3m We proved that n,m  0 in this process always; this is not immediate from the algorithm code

Algorithm run example  8=  9=  10 =  11=  12 = 7 x=8: n=1, m=1 While x<p: a)x:=x+1 b)If n  1, set n:=n-1, m:=m+2 c)Otherwise, set n:=n+2, m:=m-3 Invariant: x=5n+3m

Algorithm properties  Theorem: Algorithm uses at most two nickels (i.e n  2)  Proof: by induction on p  Try to prove it yourself first! 8 x=8: n=1, m=1 While x<p: a)x:=x+1 b)If n  1, set n:=n-1, m:=m+2 c)Otherwise, set n:=n+2, m:=m-3 Invariant: x=5n+3m

Algorithm properties  Theorem: Algorithm uses at most two nickels (i.e n  2). Proof: by induction on p Base case: p=8. Algorithm outputs n=m=1. Inductive hypothesis: p=5n+3m where n  2. WTS p+1=5a+3b where a  2. Proof by cases:  Case I: n  1. So p+1=5(n-1)+3(m+2) and a=n-1  2.  Case II: n=0. So p+1=5*2+3(m-3). a=2. In both cases p+1=5a+3b where a  2. QED 9 x=8: n=1, m=1 While x<p: a)x:=x+1 b)If n  1, set n:=n-1, m:=m+2 c)Otherwise, set n:=n+2, m:=m-3 Invariant: x=5n+3m

2. Strong induction examples DIVISIBILITY BY A PRIME 10

Strong vs regular induction  Prove:  n  1 P(n)  Base case: P(1)  Regular induction: P(n)  P(n+1)  Strong induction: (P(1)  …  P(n))  P(n+1)  Can use more assumptions to prove P(n+1) 11 P(1)P(2)P(3)P(n)P(n+1) …… P(1)P(2)P(3)P(n)P(n+1) ……

Example for the power of strong induction  Theorem: For all prices p >= 8 cents, the price p can be paid using only 5-cent and 3-cent coins  Proof:  Base case: 8=3+5, 9=3+3+3, 10=5+5  Assume it holds for all prices 1..p-1, prove for price p when p  11  Proof: since p-3  8 we can use the inductive hypothesis for p-3. To get price p simply add another 3-cent coin.  Much easier than standard induction! 12

3. Strong induction examples DIVISIBILITY BY A PRIME 13

Definitions and properties for this proof  Definitions:  n is prime if  n is composite if n=ab for some 1<a,b<n  Prime or Composite exclusivity:  All integers greater than 1 are either prime or composite (exclusive or—can’t be both).  Definition of divisible:  n is divisible by d iff n = dk for some integer k.  2 is prime (you may assume this; it also follows from the definition). 14

Definitions and properties for this proof (cont.)  Goes without saying at this point:  The set of Integers is closed under addition and multiplication  Use algebra as needed 15

Thm: For all integers n greater than 1, n is divisible by a prime number. Proof (by strong mathematical induction): Basis step: Show the theorem holds for n = ________. Inductive step: Assume [or “Suppose”] that WTS that So the inductive step holds, completing the proof. 16

Thm: For all integers n greater than 1, n is divisible by a prime number. Proof (by strong mathematical induction): Basis step: Show the theorem holds for n = ________. Inductive step: Assume [or “Suppose”] that WTS that So the inductive step holds, completing the proof. 17 A.0 B.1 C.2 D.3 E.Other/none/more than one

Thm: For all integers n greater than 1, n is divisible by a prime number. Proof (by strong mathematical induction): Basis step: Show the theorem holds for n = 2. Inductive step: Assume [or “Suppose”] that WTS that So the inductive step holds, completing the proof. 18 A.For some integer n>1, n is divisible by a prime number. B.For some integer n>1, k is divisible by a prime number, for all integers k where 2  k  n. C.Other/none/more than one

Thm: For all integers n greater than 1, n is divisible by a prime number. Proof (by strong mathematical induction): Basis step: Show the theorem holds for n = 2. Inductive step: Assume [or “Suppose”] that For some integer n>1, k is divisible by a prime number, for all integers k where 2  k  n. WTS that So the inductive step holds, completing the proof. 19 A.n+1 is divisible by a prime number. B.k+1 is divisible by a prime number. C.Other/none/more than one

Thm: For all integers n greater than 1, n is divisible by a prime number. Proof (by strong mathematical induction): Basis step: Show the theorem holds for n=2. Inductive step: Assume that for some n  2, all integers 2  k  n are divisible by a prime. WTS that n+1 is divisible by a prime. Proof by cases:  Case 1: n+1 is prime. n+1 divides itself so we are done.  Case 2: n+1 is composite. Then n+1=ab with 1<a,b<n+1. By the induction hypothesis, since a  n there exists a prime p which divides a. So p|a and a|n+1. We’ve already seen that this implies that p|n+1 (in exam – give full details!) So the inductive step holds, completing the proof. 20

2. Strong induction examples RECURSION SEQUENCE: PRODUCT OF FRACTIONS 21

Definitions and properties for this proof  Product less than one:  Algebra, etc., as usual 22

Definition of the sequence: d 1 = 9/10 d 2 = 10/11 d k = (d k-1 )(d k-2 ) for all integers k  3 Thm: For all integers n>0, 0<d n <1. Proof (by strong mathematical induction): Basis step: Show the theorem holds for n = ________. Inductive step: Assume [or “Suppose”] that WTS that So the inductive step holds, completing the proof. 23

Definition of the sequence: d 1 = 9/10 d 2 = 10/11 d k = (d k-1 )(d k-2 ) for all integers k  3 Thm: For all integers n>0, 0<d n <1. Proof (by strong mathematical induction): Basis step: Show the theorem holds for n = ________. Inductive step: Assume [or “Suppose”] that WTS that So the inductive step holds, completing the proof. 24 A.0 B.1 C.2 D.3 E.Other/none/more than one

Definition of the sequence: d 1 = 9/10 d 2 = 10/11 d k = (d k-1 )(d k-2 ) for all integers k  3 Thm: For all integers n>0, 0<d n <1. Proof (by strong mathematical induction): Basis step: Show the theorem holds for n = 1,2. Inductive step: Assume [or “Suppose”] that WTS that So the inductive step holds, completing the proof. 25 A.For some int n>2, 0<d n <1. B.For some int n>2, 0<d k <1, for all integers k where 3  k  n. C.Other/none/more than one

Definition of the sequence: d 1 = 9/10 d 2 = 10/11 d k = (d k-1 )(d k-2 ) for all integers k  3 Thm: For all integers n>0, 0<d n <1. Proof (by strong mathematical induction): Basis step: Show the theorem holds for n = ________. Inductive step: Assume [or “Suppose”] that theorem holds for n  2 WTS that So the inductive step holds, completing the proof. 26 A.For some int n>0, 0<d n <1. B.For some int n>1, 0<d k <1, for all integers k where 1  k  n. C.0<d n+1 <1 D.Other/none/more than one

Definition of the sequence: d 1 = 9/10 d 2 = 10/11 d k = (d k-1 )(d k-2 ) for all integers k  3 Thm: For all integers n>0, 0<d n <1. Proof (by strong mathematical induction): Basis step: Show the theorem holds for n=1,2. Inductive step: Assume [or “Suppose”] that for some int n  3, the theorem holds for all int k, n  k  3. (i.e. 0<d k <1 for all k between 3 and n, inclusive) WTS that 0<d n+1 <1. By definition, d n+1 =d n d n-1. By the inductive hypothesis, 0<d n-1 <1 and 0<d n <1. Hence, 0<d n+1 <1. So the inductive step holds, completing the proof. 27

3. Fibonacci numbers Verifying a solution 28

Fibonacci numbers  1,1,2,3,5,8,13,21,…  Rule: F 1 =1, F 2 =1, F n =F n-2 +F n-1.  Question: can we derive an expression for the n-th term?  YES! 29

Fibonacci numbers  Rule: F 1 =1, F 2 =1, F n =F n-2 +F n-1.  We will prove an upper bound:  Proof by strong induction.  Base case: 30 A.n=1 B.n=2 C.n=1 and n=2 D.n=1 and n=2 and n=3 E.Other

Fibonacci numbers  Rule: F 1 =1, F 2 =1, F n =F n-2 +F n-1.  We will prove an upper bound:  Proof by strong induction.  Base case: n=1, n=2. Verify by direct calculation 31

Fibonacci numbers  Rule: F 1 =1, F 2 =1, F n =F n-2 +F n-1.  Theorem:  Base cases: n=1,n=2  Inductive step: show… 32 A.F n =F n-1 +F n-2 B.F n  F n-1 +F n-2 C.F n =r n D.F n  r n E.Other

Fibonacci numbers  Inductive step: need to show,  What can we use?  Definition of F n :  Inductive hypothesis:  That is, we need to show that 33

Fibonacci numbers  Finishing the inductive step.  Need to show:  Simplifying, need to show:  Choice of actually satisfied (this is why we chose it!) QED 34

Fibonacci numbers - recap  Recursive definition of a sequence  Base case: verify for n=1, n-2  Inductive step:  Formulated what needed to be shown as an algebraic inequality, using the definition of F n and the inductive hypothesis  Simplified algebraic inequality  Proved the simplified version 35