CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.

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 MATH Prof. Shachar Lovett Clicker frequency: CA.
CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.
CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.
Prof. Shachar Lovett Clicker frequency: CA CSE 20 Discrete math Prof. Shachar Lovett
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.
CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.
CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.
CSE115/ENGR160 Discrete Mathematics 02/28/12
CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.
1 Intro to Induction Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong.
CSE115/ENGR160 Discrete Mathematics 03/22/12 Ming-Hsuan Yang UC Merced 1.
CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.
CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.
CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.
CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.
CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.
CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.
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)
CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.
Mathematical Induction
Induction (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.
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.
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!
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
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 311 Foundations of Computing I Lecture 15 Recursive Definitions and Structural Induction Autumn 2011 CSE 3111.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
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 for Computer Science Prof. Shachar Lovett.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
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.
Discrete Structures & Algorithms More on Methods of Proof / Mathematical Induction EECE 320 — UBC.
CompSci 102 Discrete Math for Computer Science March 1, 2012 Prof. Rodger Slides modified from Rosen.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
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.
Year 9 Proof Dr J Frost Last modified: 19 th February 2015 Objectives: Understand what is meant by a proof, and examples.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 223 – Advanced Data Structures Math Review 1.
CSE373: Data Structures and Algorithms Lecture 2: Proof by Induction Linda Shapiro Winter 2015.
1 CMSC 341 Math Review. 2 Exponents Identities (X A ) B = X AB X A * X B = X A+B X A / X B = X A-B X A + X B  X A+B.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
Methods of Proof Lecture 4: Sep 20 (chapter 3 of the book, except 3.5 and 3.8)
1 Discrete Mathematical Mathematical Induction ( الاستقراء الرياضي )
INDUCTION David Kauchak CS52 – Spring to-1 multiplexer control control_negate and_out1 input0 input1 and_out2 output.
Section 9.4 – Mathematical Induction Mathematical Induction: A method to prove that statements involving natural numbers are true for all natural numbers.
Induction and Recursion CSC-2259 Discrete Structures Konstantin Busch - LSU1.
Section Recursion 2  Recursion – defining an object (or function, algorithm, etc.) in terms of itself.  Recursion can be used to define sequences.
Chapter 5 1. Chapter Summary  Mathematical Induction  Strong Induction  Recursive Definitions  Structural Induction  Recursive Algorithms.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett
CSE 311: Foundations of Computing
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett
Chapter 5 Induction and Recursion
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett
Notes 9.5 – Mathematical Induction
Follow me for a walk through...
CSE 373 Data Structures and Algorithms
Follow me for a walk through...
Follow me for a walk through...
Presentation transcript:

CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA

Todays topics Proof by induction: Set sizes equality Paying using 3 and 5 cent coins Section 3.6 in Jenkyns, Stephenson

Set sizes

3-cent and 5-cent coins We will prove the following theorem Theorem: For all prices p ≥ 8 cents, the price p can be paid using only 5-cent and 3-cent coins today

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 price p=____. Inductive step: Assume [or “Suppose”] that WTS that So the inductive step holds, completing the proof.

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 price p=________. Inductive step: Assume [or “Suppose”] that WTS that So the inductive step holds, completing the proof. A.0 cents B.1 cent C.2 cents D.3 cents E.Other/none/more than one

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 price p=8. Inductive step: Assume [or “Suppose”] that WTS that So the inductive step holds, completing the proof.

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 price p=8. Inductive step: Assume [or “Suppose”] that WTS that So the inductive step holds, completing the proof. A.Theorem is true for p=8. B.Theorem is true for some p>8. C.Theorem is true for some p  8. D.Theorem is true for some p>0. E.Theorem is true for all p>8.

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 price p=8. Inductive step: Assume [or “Suppose”] that theorem is true for some p  8. WTS that So the inductive step holds, completing the proof.

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 price p=8. Inductive step: Assume [or “Suppose”] that theorem is true for some p  8. WTS that So the inductive step holds, completing the proof. A.Theorem is true for p=8. B.Theorem is true for some p>8. C.Theorem is true for p+1. D.Theorem is true for p+8.

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 price p=8. Inductive step: Assume [or “Suppose”] that theorem is true for some p  8. WTS that theorem is true for price p+1. So the inductive step holds, completing the proof.

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 price p=8. Inductive step: Assume [or “Suppose”] that theorem is true for some p  8. WTS that theorem is true for price p+1. So the inductive step holds, completing the proof. ???

3-cent and 5-cent coins Inductive step: Assume price p  8 can be paid using only 3-cent and 5-cent coins. Need to prove that price p+1 can be paid using only 3-cent and 5- cent coins. Main idea: “reduce” from price p+1 to price p.

Making change If we have cent coins, and cent coins (for a total of p = $8.00), how can we modify the number of 5- cent and 3-cent coins so that we can make the p+1 price (p+1 = $8.01)? A cent coins cent coins B cent coins cent coins C cent coins cent coins

Making change If we have cent coins, and cent coins (for a total of p = $8.00), how can we modify the number of 5- cent and 3-cent coins so that we can make the p+1 price (p+1 = $8.01)? A cent coins cent coins B cent coins cent coins C cent coins cent coins

Turning our modification scheme into a generic algorithm If we have n 5-cent coins, and m 3-cent coins (for a total of p = 5n+3m), how can we modify the number of 5-cent and 3-cent coins so that we can make the p+1 price (p+1 = 5n+3m+1)? A. n+1 5-cent coins + m-2 3-cent coins B. n-1 5-cent coins + m+2 3-cent coins C. n+1 5-cent coins + m+2 3-cent coins D. No generic way

Turning our modification scheme into a generic algorithm If we have n 5-cent coins, and m 3-cent coins (for a total of p = 5n+3m), how can we modify the number of 5-cent and 3-cent coins so that we can make the p+1 price (p+1 = 5n+3m+1)? A. n+1 5-cent coins + m-2 3-cent coins B. n-1 5-cent coins + m+2 3-cent coins C. n+1 5-cent coins + m+2 3-cent coins D. No generic way

What if we don’t have any 5-cent coins to subtract?? If we have 0 5-cent coins, and m 3-cent coins (for a total of p = 3m), how can we modify the number of 5-cent and 3-cent coins so that we can make the p+1 price (p+1 = 3m+1)? A. You can’t B. You can [explain to your group how]

What if we don’t have any 5-cent coins to subtract?? If we have 0 5-cent coins, and m 3-cent coins (for a total of p = 3m), how can we modify the number of 5-cent and 3-cent coins so that we can make the p+1 price (p+1 = 3m+1)? Remove three 3-cent coins, add two 5-cent So: two 5-cent coins, m-3 3-cent points, for a total of 2*5+3*(m-3)=3m+1=p+1

That algorithm relies on being able to subtract three 3-cent coins. What if we don’t have that many? (only 1 or 2?) A. Uh-oh, our proof can not work as we’ve done it so far B. That could never happen [explain why not] C. That could happen, and we need to make a 3 rd (or more) case(s) to handle it

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. 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 x=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

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)

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) 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 = 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! 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 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

Next class Strong induction Read section in Jenkyns, Stephenson