CSE 311: Foundations of Computing. Lecture 16: Recursion & Strong Induction Applications: Fibonacci & Euclid
|
|
- Bethany Watson
- 5 years ago
- Views:
Transcription
1 CSE 311: Foundations of Computing Lecture 16: Recursion & Strong Induction Applications: Fibonacci & Euclid
2 Midterm A week today (Monday, May 7) in class Closed book, closed notes You will get lists of inference rules & equivalences Covers material up to end of ordinary induction. Practice problems & practice midterm on the website Solutions later this week Prof. Beame will run a review session Sunday, May 6, 3:30-5:30 pm in EEB 105.
3 More Recursive Definitions Suppose that h: N R. Then we have familiar summation notation: h = h(0) h = h h for 0 There is also product notation: h = h(0) h = h( + 1) h for 0
4 Fibonacci Numbers = 0 = 1 = + for all 2
5 Strong Inductive Proofs In 5 Easy Steps 1. Let ()be.... We will show that ()is true for all integers by strong induction. 2. Base Case: Prove () 3. Inductive Hypothesis: Assume that for some arbitrary integer, (!) is true for every integer! from to 4. Inductive Step: Prove that ( + 1)is true: Use the goal to figure out what you need. Make sure you are using I.H. (that (),, () are true) and point out where you are using it. (Don t assume ( + 1)!!) 5. Conclusion: ()is true for all integers
6 Bounding Fibonacci I: < 2 for all 0 $ % = % $ & = & $ ' = $ '& + $ '( for all ' (
7 Bounding Fibonacci I: < 2 for all 0 1. Let P(n)be f n < 2 n. We prove that P(n)is true for all integers n 0 by strong induction. 2. Base Case: f 0 =0 <1= 2 0 so P(0)is true. 3. Inductive Hypothesis: Assume that for some arbitrary integer k 0,P(j)is true for every integer jfrom 0to k. 4. Inductive Step: Goal: Show P(k+1); that is, f k+1 2 k+1 Case k+1 = 1: Then f 1 = sop(k+1)is true here. Case k+1 2: Then f k+1 =f k + f k-1 by definition 2 k +2 k-1 by the IH 2 k +2 k = 2 2 k = 2 k+1 sop(k+1)is true in this case. 5. Therefore by strong induction, f n 2 n for all integers n 0. $ % = % $ & = & $ ' = $ '& + $ '( for all ' (
8 Bounding Fibonacci I: < 2 for all 0 1. Let P(n)be f n < 2 n. We prove that P(n)is true for all integers n 0 by strong induction. 2. Base Case: f 0 =0 <1= 2 0 so P(0)is true. 3. Inductive Hypothesis: Assume that for some arbitrary integer k 0,P(j)is true for every integer jfrom 0to k. 4. Inductive Step: Goal: Show P(k+1); that is, f k+1 < 2 k+1 Case k+1 = 1: Then f 1 = sop(k+1)is true here. Case k+1 2: Then f k+1 =f k + f k-1 by definition 2 k +2 k-1 by the IH 2 k +2 k = 2 2 k = 2 k+1 sop(k+1)is true in this case. 5. Therefore by strong induction, f n 2 n for all integers n 0. $ % = % $ & = & $ ' = $ '& + $ '( for all ' (
9 Bounding Fibonacci I: < 2 for all 0 1. Let P(n)be f n < 2 n. We prove that P(n)is true for all integers n 0 by strong induction. 2. Base Case: f 0 =0 <1= 2 0 so P(0)is true. 3. Inductive Hypothesis: Assume that for some arbitrary integer k 0,P(j)is true for every integer jfrom 0to k. 4. Inductive Step: Goal: Show P(k+1); that is, f k+1 < 2 k+1 Case k+1 = 1: Then f 1 = sop(k+1)is true here. Case k+1 2: Then f k+1 =f k + f k-1 by definition 2 k +2 k-1 by the IH 2 k +2 k = 2 2 k = 2 k+1 sop(k+1)is true in this case. 5. Therefore by strong induction, f n 2 n for all integers n 0. $ % = % $ & = & $ ' = $ '& + $ '( for all ' (
10 Bounding Fibonacci I: < 2 for all 0 1. Let P(n)be f n < 2 n. We prove that P(n)is true for all integers n 0 by strong induction. 2. Base Case: f 0 =0 <1= 2 0 so P(0)is true. 3. Inductive Hypothesis: Assume that for some arbitrary integer k 0,P(j)is true for every integer jfrom 0to k. 4. Inductive Step: Goal: Show P(k+1); that is, f k+1 < 2 k+1 Case k+1 = 1: Then f 1 = 1 < 2 = 2 1 sop(k+1)is true here. Case k+1 2: Then f k+1 =f k + f k-1 by definition < 2 k +2 k-1 by the IHsincek-1 0 < 2 k +2 k = 2 2 k = 2 k+1 sop(k+1)is true in this case. These are the only cases so P(k+1) follows. 5. Therefore by strong induction, f n < 2 n for all integersn 0. $ % = % $ & = & $ ' = $ '& + $ '( for all ' (
11 Bounding Fibonacci II: 2 for all 2 $ % = % $ & = & $ ' = $ '& + $ '( for all ' (
12 Bounding Fibonacci II: 2 for all 2 1. Let P(n)be f n 2 n/2-1. We prove that P(n)is true for all integers n 2 by strong induction. 2. Base Case: f 2 = f 1 + f 0 = 1 and2 2/2 1 = 2 0 = 1 so P(2)is true. 3. Inductive Hypothesis: Assume that for some arbitrary integer k 2,P(j)is true for every integer jfrom 2to k. 4. Inductive Step: Goal: Show P(k+1); that is, f k+1 2 (k+1)/2-1 Case k+1 = 3: Then f k+1 =f 3 = f 2 + f 1 =2 2 1/2 = 2 3/2-1 =2 (k+1)/2-1 Case k+1 4: f k+1 =f k + f k-1 by definition 2 k/ (k-1)/2-1 by the IHsincek (k-1)/ (k-1)/2-1 = 2 (k-1)/2 = 2 (k+1)/2-1 SoP(k+1)is true in both cases. 5. Therefore by strong induction, f n 2 n/2-1 for all integersn 0. $ % = % $ & = & $ ' = $ '& + $ '( for all ' (
13 Bounding Fibonacci II: 2 for all 2 1. Let P(n)be f n 2 n/2-1. We prove that P(n)is true for all integers n 2 by strong induction. 2. Base Case: f 2 = f 1 + f 0 = 1 and2 2/2 1 = 2 0 = 1 so P(2)is true. 3. Inductive Hypothesis: Assume that for some arbitrary integer k 2,P(j)is true for every integer jfrom 2to k. 4. Inductive Step: Goal: Show P(k+1); that is, f k+1 2 (k+1)/2-1 Case k+1 = 3: Then f k+1 =f 3 = f 2 + f 1 =2 2 1/2 = 2 3/2-1 =2 (k+1)/2-1 No need for cases for the definition here: Case f k+1 4: f k+1 =f k + f k-1 by definition k+1 = f k + f k-1 since k+1 2 Now just want 2 to k/2-1 apply +2 (k-1)/2-1 the IH by to the getp(k)and IHsincek-1 P(k-1): 2 2 (k-1)/ (k-1)/2-1 = 2 (k-1)/2 = 2 (k+1)/2-1 Problem: Though we can get P(k)since k 2, SoP(k+1)is true k-1may in both only cases. be 1so we can t conclude P(k-1) 5. Therefore Solution: by strong Separate induction, cases for f n when 2 n/2-1 for k-1=1(or all integersn k+1=3). 0. $ % = % $ & = & $ ' = $ '& + $ '( for all ' (
14 Bounding Fibonacci II: 2 for all 2 1. Let P(n)be f n 2 n/2-1. We prove that P(n)is true for all integers n 2 by strong induction. 2. Base Case: f 2 = f 1 + f 0 = 1 and2 2/2 1 = 2 0 = 1 so P(2)is true. 3. Inductive Hypothesis: Assume that for some arbitrary integer k 2,P(j)is true for every integer jfrom 2to k. 4. Inductive Step: Goal: Show P(k+1); that is, f k+1 2 (k+1)/2-1 Case k = 2: Then f k+1 =f 3 = f 2 + f 1 =2 2 1/2 = 2 3/2-1 =2 (k+1)/2-1 Case k 3: f k+1 =f k + f k-1 by definition 2 k/ (k-1)/2-1 by the IHsincek (k-1)/ (k-1)/2-1 = 2 (k-1)/2 = 2 (k+1)/2-1 SoP(k+1)is true in both cases. 5. Therefore by strong induction, f n 2 n/2-1 for all integersn 0. $ % = % $ & = & $ ' = $ '& + $ '( for all ' (
15 Bounding Fibonacci II: 2 for all 2 1. Let P(n)be f n 2 n/2-1. We prove that P(n)is true for all integers n 2 by strong induction. 2. Base Case: f 2 = f 1 + f 0 = 1 and2 2/2 1 = 2 0 = 1 so P(2)is true. 3. Inductive Hypothesis: Assume that for some arbitrary integer k 2,P(j)is true for every integer jfrom 2to k. 4. Inductive Step: Goal: Show P(k+1); that is, f k+1 2 (k+1)/2-1 Case k = 2: Then f k+1 =f 3 = f 2 + f 1 =2 2 1/2 = 2 3/2-1 =2 (k+1)/2-1 Case k 3: f k+1 =f k + f k-1 by definition 2 k/ (k-1)/2-1 by the IHsincek (k-1)/ (k-1)/2-1 = 2 (k-1)/2 = 2 (k+1)/2-1 SoP(k+1)is true in both cases. 5. Therefore by strong induction, f n 2 n/2-1 for all integersn 0. $ % = % $ & = & $ ' = $ '& + $ '( for all ' (
16 Bounding Fibonacci II: 2 for all 2 1. Let P(n)be f n 2 n/2-1. We prove that P(n)is true for all integers n 2 by strong induction. 2. Base Case: f 2 = f 1 + f 0 = 1 and2 2/2 1 = 2 0 = 1 so P(2)is true. 3. Inductive Hypothesis: Assume that for some arbitrary integer k 2,P(j)is true for every integer jfrom 2to k. 4. Inductive Step: Goal: Show P(k+1); that is, f k+1 2 (k+1)/2-1 Case k = 2: Then f k+1 =f 3 = f 2 + f 1 =2 2 1/2 = 2 3/2-1 =2 (k+1)/2-1 Case k 3: f k+1 =f k + f k-1 by definition 2 k/ (k-1)/2-1 by the IHsincek (k-1)/ (k-1)/2-1 = 2 (k-1)/2 = 2 (k+1)/2-1 SoP(k+1)is true in both cases. 5. Therefore by strong induction, f n 2 n/2-1 for all integersn 0. $ % = % $ & = & $ ' = $ '& + $ '( for all ' (
17 Running time of Euclid s algorithm Theorem: Suppose that Euclid s Algorithm takes steps for gcd (-, )with - > 0. Then, -. An informal way to get the idea: Consider ann stepgcd calculation starting with r n+1 =a andr n =b: r n+1 = q n r n + r n-1 r n = q n-1 r n-1 + r n-2 r 3 = q 2 r 2 + r 1 r 2 = q 1 r 1 For all k 2, r k-1 = r k+1 mod r k Nowr 1 1 and each q k must be 1. If we replace all the q K sby1 and replacer 1 by1, we can only reduce the r k s. After that reduction, r k =f k for every k.
18 Running time of Euclid s algorithm Theorem: Suppose that Euclid s Algorithm takes steps for gcd (-, )with - > 0. Then, -. We go by strong induction on n. Let P(n)be gcd(a,b)witha b>0 takes nsteps a f n+1 for all n 1. Base Case: n=1 If Euclid s Algorithm on a, b witha b > 0 takes 1step, then a=q 1 bfor some q 1 and a b 1=f 2 andp(1) holds Induction Hypothesis: Suppose that for some integerk 1, P(j) is true for all integersj s.t.1 j k Inductive Step: We want to show: ifgcd(a,b) witha b > 0takes k+1 steps, thena f k+2.
19 Running time of Euclid s algorithm Induction Hypothesis: Suppose that for some integerk 1, P(j) is true for all integersj s.t.1 j k Inductive Step: We want to show: ifgcd(a,b) witha b>0 takes k+1 steps, thena f k+2. Now if k+1=2,then Euclid s algorithm on aand bcan be written as a = q 2 b + r 1 b = q 1 r 1 andr 1 > 0. Also, since a b>0 we must haveq 2 1 and b 1. Soa = q 2 b + r 1 b + r = 2 = f 3 = f k+2 as required.
20 Running time of Euclid s algorithm Induction Hypothesis: Suppose that for some integerk 1, P(j) is true for all integersj s.t.1 j k Inductive Step: We want to show: ifgcd(a,b) witha b>0 takes k+1 steps, thena f k+2. Next suppose that k+1 3so for the first 3 steps of Euclid s algorithm on aand bwe have a = q k+1 b + r k b = q k r k + r k-1 r k = q k-1 r k-1 + r k-2 and there are k-2more steps after this. Note that this means that thegcd(b,r k )takes ksteps and gcd(r k,r k-1 )takes k-1steps and b>r k >r k-1. So since k, k-1 1 by the IH we haveb f k+1 and r k f k. Also, since a b we must haveq k+1 1. Soa = q k+1 b + r k b + r k f k+1 +f k = f k+2 as required.
21 Running time of Euclid s algorithm Theorem: Suppose that Euclid s Algorithm takes steps for gcd (-, )with - > 0. Then, -. Why does this help us bound the running time of Euclid s Algorithm? We already proved that 2 so 2 () Therefore: if Euclid s Algorithm takes steps for gcd (-, )with - > 0 then - 2 () so ( 1)/2 log - or 1 + 2log - i.e., # of steps twice the # of bits in -.
22 Recursive Definition of Sets Recursive Definition Basis Step: 0 S Recursive Step: If x S, then x + 2 S Exclusion Rule: Every element in S follows from basis steps and a finite number of recursive steps.
23 Recursive Definitions of Sets Basis: 6 S, 15 S Recursive: If x,y S, then x+y S Basis: [1, 1, 0] S, [0, 1, 1] S Recursive: If [x, y, z] S, then [αx,αy, αz] S for all α R If [x 1, y 1, z 1 ] S and [x 2, y 2, z 2 ] S, then [x 1 + x 2, y 1 + y 2, z 1 + z 2 ] S. Powers of 3:
24 Recursive Definitions of Sets Basis: 6 S, 15 S Recursive: If x,y S, then x+y S Basis: [1, 1, 0] S, [0, 1, 1] S Recursive: If [x, y, z] S, then [αx,αy, αz] Sfor all α R If [x 1, y 1, z 1 ] S and [x 2, y 2, z 2 ] S, then [x 1 + x 2, y 1 + y 2, z 1 + z 2 ] S. Powers of 3: Basis: 1 S Recursive: If x S, then 3x S.
25 Recursive Definitions of Sets: General Form Recursive definition Basis step: Some specific elements are in 5 Recursive step: Given some existing named elements in 5some new objects constructed from these named elements are also in 5. Exclusion rule: Every element in 5 follows from basis steps and a finite number of recursive steps
26 Strings An alphabetσis any finite set of characters The set Σ*of stringsover the alphabet Σis defined by Basis: ℇ Σ (ℇis the empty string) Recursive: if 7 Σ*, - Σ, then 7- Σ*
27 Palindromes Palindromes are strings that are the same backwards and forwards Basis: ℇis a palindrome and any - Σis a palindrome Recursive step: If 8is a palindrome then -8-is a palindrome for every - Σ
28 All Binary Strings with no 1 s before 0 s
29 All Binary Strings with no 1 s before 0 s Basis: ℇ S Recursive: If x S,then 0x S If x S,then x1 S
30 Function Definitions on Recursively Defined Sets Length: len(ℇ) = 0 len(wa) = 1 + len(w) for w Σ *, a Σ Reversal: ℇ R = ℇ (wa) R = aw R for w Σ *, a Σ Concatenation: x ℇ= x for x Σ * x wa = (x w)a for x Σ *, a Σ
Fall 2015 Lecture 14: Modular congruences. cse 311: foundations of computing
Fall 2015 Lecture 14: Modular congruences cse 311: foundations of computing If a and b are positive integers, then gcd a, b = gcd (b, a mod b) Useful GCD Fact Proof: By definition a = a div b b + (a mod
More informationAdam Blank Spring 2017 CSE 311. Foundations of Computing I
Adam Blank Spring 2017 CSE 311 Foundations of Computing I CSE 311: Foundations of Computing Lecture 17: Structural Induction Strings An alphabet Σ is any finite set of characters The set Σ* is the set
More informationFall 2017 Test II review problems
Fall 2017 Test II review problems Dr. Holmes October 18, 2017 This is a quite miscellaneous grab bag of relevant problems from old tests. Some are certainly repeated. 1. Give the complete addition and
More informationCSE 311: Foundations of Computing. Lecture 14: Induction
CSE 311: Foundations of Computing Lecture 14: Induction Mathematical Induction Method for proving statements about all natural numbers A new logical inference rule! It only applies over the natural numbers
More informationSection Summary. Sequences. Recurrence Relations. Summations. Examples: Geometric Progression, Arithmetic Progression. Example: Fibonacci Sequence
Section 2.4 Section Summary Sequences. Examples: Geometric Progression, Arithmetic Progression Recurrence Relations Example: Fibonacci Sequence Summations Introduction Sequences are ordered lists of elements.
More informationInduction and Recursion
. All rights reserved. Authorized only for instructor use in the classroom. No reproduction or further distribution permitted without the prior written consent of McGraw-Hill Education. Induction and Recursion
More informationICS141: Discrete Mathematics for Computer Science I
ICS141: Discrete Mathematics for Computer Science I Dept. Information & Computer Sci., Jan Stelovsky based on slides by Dr. Baek and Dr. Still Originals by Dr. M. P. Frank and Dr. J.L. Gross Provided by
More informationRecurrence Relations and Recursion: MATH 180
Recurrence Relations and Recursion: MATH 180 1: Recursively Defined Sequences Example 1: The sequence a 1,a 2,a 3,... can be defined recursively as follows: (1) For all integers k 2, a k = a k 1 + 1 (2)
More informationDiscrete Mathematics. Spring 2017
Discrete Mathematics Spring 2017 Previous Lecture Principle of Mathematical Induction Mathematical Induction: rule of inference Mathematical Induction: Conjecturing and Proving Climbing an Infinite Ladder
More informationInduction and recursion. Chapter 5
Induction and recursion Chapter 5 Chapter Summary Mathematical Induction Strong Induction Well-Ordering Recursive Definitions Structural Induction Recursive Algorithms Mathematical Induction Section 5.1
More informationChapter Summary. Mathematical Induction Strong Induction Well-Ordering Recursive Definitions Structural Induction Recursive Algorithms
1 Chapter Summary Mathematical Induction Strong Induction Well-Ordering Recursive Definitions Structural Induction Recursive Algorithms 2 Section 5.1 3 Section Summary Mathematical Induction Examples of
More informationWith Question/Answer Animations
Chapter 5 With Question/Answer Animations Copyright McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education. Chapter Summary
More informationRecursive Definitions
Recursive Definitions Example: Give a recursive definition of a n. a R and n N. Basis: n = 0, a 0 = 1. Recursion: a n+1 = a a n. Example: Give a recursive definition of n i=0 a i. Let S n = n i=0 a i,
More informationRecursion: Introduction and Correctness
Recursion: Introduction and Correctness CSE21 Winter 2017, Day 7 (B00), Day 4-5 (A00) January 25, 2017 http://vlsicad.ucsd.edu/courses/cse21-w17 Today s Plan From last time: intersecting sorted lists and
More informationMidterm 2 for CS 170
UC Berkeley CS 170 Midterm 2 Lecturer: Gene Myers November 9 Midterm 2 for CS 170 Print your name:, (last) (first) Sign your name: Write your section number (e.g. 101): Write your sid: One page of notes
More informationHomework #2 Solutions Due: September 5, for all n N n 3 = n2 (n + 1) 2 4
Do the following exercises from the text: Chapter (Section 3):, 1, 17(a)-(b), 3 Prove that 1 3 + 3 + + n 3 n (n + 1) for all n N Proof The proof is by induction on n For n N, let S(n) be the statement
More informationAnnouncements Monday, September 18
Announcements Monday, September 18 WeBWorK 1.4, 1.5 are due on Wednesday at 11:59pm. The first midterm is on this Friday, September 22. Midterms happen during recitation. The exam covers through 1.5. About
More informationClimbing an Infinite Ladder
Section 5.1 Section Summary Mathematical Induction Examples of Proof by Mathematical Induction Mistaken Proofs by Mathematical Induction Guidelines for Proofs by Mathematical Induction Climbing an Infinite
More informationBinomial Coefficient Identities/Complements
Binomial Coefficient Identities/Complements CSE21 Fall 2017, Day 4 Oct 6, 2017 https://sites.google.com/a/eng.ucsd.edu/cse21-fall-2017-miles-jones/ permutation P(n,r) = n(n-1) (n-2) (n-r+1) = Terminology
More informationDivide and Conquer. CSE21 Winter 2017, Day 9 (B00), Day 6 (A00) January 30,
Divide and Conquer CSE21 Winter 2017, Day 9 (B00), Day 6 (A00) January 30, 2017 http://vlsicad.ucsd.edu/courses/cse21-w17 Merging sorted lists: WHAT Given two sorted lists a 1 a 2 a 3 a k b 1 b 2 b 3 b
More informationDiscrete Mathematics. Spring 2017
Discrete Mathematics Spring 2017 Previous Lecture Principle of Mathematical Induction Mathematical Induction: Rule of Inference Mathematical Induction: Conjecturing and Proving Mathematical Induction:
More informationClimbing an Infinite Ladder
Section 5.1 Section Summary Mathematical Induction Examples of Proof by Mathematical Induction Mistaken Proofs by Mathematical Induction Guidelines for Proofs by Mathematical Induction Climbing an Infinite
More informationCarmen s Core Concepts (Math 135)
Carmen s Core Concepts (Math 135) Carmen Bruni University of Waterloo Week 4 1 Principle of Mathematical Induction 2 Example 3 Base Case 4 Inductive Hypothesis 5 Inductive Step When Induction Isn t Enough
More informationINDUCTION AND RECURSION. Lecture 7 - Ch. 4
INDUCTION AND RECURSION Lecture 7 - Ch. 4 4. Introduction Any mathematical statements assert that a property is true for all positive integers Examples: for every positive integer n: n!
More informationRecursion and Induction
Recursion and Induction Themes Recursion Recurrence Definitions Recursive Relations Induction (prove properties of recursive programs and objects defined recursively) Examples Tower of Hanoi Gray Codes
More informationDiscrete Math in Computer Science Solutions to Practice Problems for Midterm 2
Discrete Math in Computer Science Solutions to Practice Problems for Midterm 2 CS 30, Fall 2018 by Professor Prasad Jayanti Problems 1. Let g(0) = 2, g(1) = 1, and g(n) = 2g(n 1) + g(n 2) whenever n 2.
More informationPractice Midterm Exam Solutions
CSE 311: Foundations of Computing I Practice Midterm Exam Solutions Name: Sample Solutions ID: TA: Section: INSTRUCTIONS: You have 50 minutes to complete the exam. The exam is closed book. You may not
More information1. Induction on Strings
CS/ECE 374: Algorithms & Models of Computation Version: 1.0 Fall 2017 This is a core dump of potential questions for Midterm 1. This should give you a good idea of the types of questions that we will ask
More informationCSE 20 DISCRETE MATH WINTER
CSE 20 DISCRETE MATH WINTER 2016 http://cseweb.ucsd.edu/classes/wi16/cse20-ab/ Today's learning goals Explain the steps in a proof by (strong) mathematical induction Use (strong) mathematical induction
More informationSec$on Summary. Sequences. Recurrence Relations. Summations. Ex: Geometric Progression, Arithmetic Progression. Ex: Fibonacci Sequence
Section 2.4 Sec$on Summary Sequences Ex: Geometric Progression, Arithmetic Progression Recurrence Relations Ex: Fibonacci Sequence Summations 2 Introduc$on Sequences are ordered lists of elements. 1, 2,
More informationNote that r = 0 gives the simple principle of induction. Also it can be shown that the principle of strong induction follows from simple induction.
Proof by mathematical induction using a strong hypothesis Occasionally a proof by mathematical induction is made easier by using a strong hypothesis: To show P(n) [a statement form that depends on variable
More information1 Examples of Weak Induction
More About Mathematical Induction Mathematical induction is designed for proving that a statement holds for all nonnegative integers (or integers beyond an initial one). Here are some extra examples of
More informationAdam Blank Spring 2017 CSE 311. Foundations of Computing I. * All slides are a combined effort between previous instructors of the course
Adam Blank Spring 2017 CSE 311 Foundations of Computing I * All slides are a combined effort between previous instructors of the course HW 3 De-Brief HW 3 De-Brief PROOFS! HW 3 De-Brief Proofs This is
More informationMATH 215 Final. M4. For all a, b in Z, a b = b a.
MATH 215 Final We will assume the existence of a set Z, whose elements are called integers, along with a well-defined binary operation + on Z (called addition), a second well-defined binary operation on
More informationMath 324 Summer 2012 Elementary Number Theory Notes on Mathematical Induction
Math 4 Summer 01 Elementary Number Theory Notes on Mathematical Induction Principle of Mathematical Induction Recall the following axiom for the set of integers. Well-Ordering Axiom for the Integers If
More informationData Structure Lecture#4: Mathematical Preliminaries U Kang Seoul National University
Data Structure Lecture#4: Mathematical Preliminaries U Kang Seoul National University U Kang 1 In This Lecture Set concepts and notation Logarithms Summations Recurrence Relations Recursion Induction Proofs
More informationThe next sequence of lectures in on the topic of Arithmetic Algorithms. We shall build up to an understanding of the RSA public-key cryptosystem.
CS 70 Discrete Mathematics for CS Fall 2003 Wagner Lecture 10 The next sequence of lectures in on the topic of Arithmetic Algorithms. We shall build up to an understanding of the RSA public-key cryptosystem.
More informationShow Your Work! Point values are in square brackets. There are 35 points possible. Some facts about sets are on the last page.
Formal Methods Name: Key Midterm 2, Spring, 2007 Show Your Work! Point values are in square brackets. There are 35 points possible. Some facts about sets are on the last page.. Determine whether each of
More informationCSE 105 Homework 1 Due: Monday October 9, Instructions. should be on each page of the submission.
CSE 5 Homework Due: Monday October 9, 7 Instructions Upload a single file to Gradescope for each group. should be on each page of the submission. All group members names and PIDs Your assignments in this
More informationCMPSCI 311: Introduction to Algorithms Second Midterm Exam
CMPSCI 311: Introduction to Algorithms Second Midterm Exam April 11, 2018. Name: ID: Instructions: Answer the questions directly on the exam pages. Show all your work for each question. Providing more
More informationAdministrivia. COMP9020 Lecture 7 Session 2, 2017 Induction and Recursion. Lecture 6 recap. Lecture 6 recap
Administrivia COMP9020 Lecture 7 Session 2, 2017 Induction and Recursion Guidelines for good mathematical writing Assignment 1 Solutions now available; marks available soon Assignment 2 available on Saturday,
More informationCSE 2001: Introduction to Theory of Computation Fall Suprakash Datta
CSE 2001: Introduction to Theory of Computation Fall 2013 Suprakash Datta datta@cse.yorku.ca Office: CSEB 3043 Phone: 416-736-2100 ext 77875 Course page: http://www.eecs.yorku.ca/course/2001 9/10/2013
More informationCS173 Lecture B, September 10, 2015
CS173 Lecture B, September 10, 2015 Tandy Warnow September 11, 2015 CS 173, Lecture B September 10, 2015 Tandy Warnow Examlet Today Four problems: One induction proof One problem on simplifying a logical
More informationMathematical Induction. Section 5.1
Mathematical Induction Section 5.1 Section Summary Mathematical Induction Examples of Proof by Mathematical Induction Mistaken Proofs by Mathematical Induction Guidelines for Proofs by Mathematical Induction
More informationComputer Science Foundation Exam
Computer Science Foundation Exam August 2, 2002 Section II A DISCRETE STRUCTURES NO books, notes, or calculators may be used, and you must work entirely on your own. Name: SSN: In this section of the exam,
More information1 Recursive Algorithms
400 lecture note #8 [ 5.6-5.8] Recurrence Relations 1 Recursive Algorithms A recursive algorithm is an algorithm which invokes itself. A recursive algorithm looks at a problem backward -- the solution
More informationHarvard CS121 and CSCI E-121 Lecture 2: Mathematical Preliminaries
Harvard CS121 and CSCI E-121 Lecture 2: Mathematical Preliminaries Harry Lewis September 5, 2013 Reading: Sipser, Chapter 0 Sets Sets are defined by their members A = B means that for every x, x A iff
More informationCSI Mathematical Induction. Many statements assert that a property of the form P(n) is true for all integers n.
CSI 2101- Mathematical Induction Many statements assert that a property of the form P(n) is true for all integers n. Examples: For every positive integer n: n! n n Every set with n elements, has 2 n Subsets.
More informationCS173 Strong Induction and Functions. Tandy Warnow
CS173 Strong Induction and Functions Tandy Warnow CS 173 Introduction to Strong Induction (also Functions) Tandy Warnow Preview of the class today What are functions? Weak induction Strong induction A
More informationCSE 311: Foundations of Computing I Autumn 2014 Practice Final: Section X. Closed book, closed notes, no cell phones, no calculators.
CSE 311: Foundations of Computing I Autumn 014 Practice Final: Section X YY ZZ Name: UW ID: Instructions: Closed book, closed notes, no cell phones, no calculators. You have 110 minutes to complete the
More informationannouncements CSE 311: Foundations of Computing Even harder problems
CSE : Foundations of Computing Fall 4 Lecture : Wrap up announcements Hand in Homework 9 now Pick up all old homework and exams now Solutions will be available on-line (username password Turing) by tomorrow.
More informationNote: In any grammar here, the meaning and usage of P (productions) is equivalent to R (rules).
Note: In any grammar here, the meaning and usage of P (productions) is equivalent to R (rules). 1a) G = ({R, S, T}, {0,1}, P, S) where P is: S R0R R R0R1R R1R0R T T 0T ε (S generates the first 0. R generates
More informationCSE 105 Theory of Computation Professor Jeanne Ferrante
CSE 105 Theory of Computation http://www.jflap.org/jflaptmp/ Professor Jeanne Ferrante 1 Announcement & Reminders HW 2: Grades not available yet, will be soon Solutions posted, read even if you did well
More informationCVO103: Programming Languages. Lecture 2 Inductive Definitions (2)
CVO103: Programming Languages Lecture 2 Inductive Definitions (2) Hakjoo Oh 2018 Spring Hakjoo Oh CVO103 2018 Spring, Lecture 2 March 13, 2018 1 / 20 Contents More examples of inductive definitions natural
More information18 Divisibility. and 0 r < d. Lemma Let n,d Z with d 0. If n = qd+r = q d+r with 0 r,r < d, then q = q and r = r.
118 18. DIVISIBILITY 18 Divisibility Chapter V Theory of the Integers One of the oldest surviving mathematical texts is Euclid s Elements, a collection of 13 books. This book, dating back to several hundred
More informationExam in Discrete Mathematics
Exam in Discrete Mathematics First Year at the Faculty of Engineering and Science and the Technical Faculty of IT and Design June 4th, 018, 9.00-1.00 This exam consists of 11 numbered pages with 14 problems.
More informationPreparing for the CS 173 (A) Fall 2018 Midterm 1
Preparing for the CS 173 (A) Fall 2018 Midterm 1 1 Basic information Midterm 1 is scheduled from 7:15-8:30 PM. We recommend you arrive early so that you can start exactly at 7:15. Exams will be collected
More informationRemainders. We learned how to multiply and divide in elementary
Remainders We learned how to multiply and divide in elementary school. As adults we perform division mostly by pressing the key on a calculator. This key supplies the quotient. In numerical analysis and
More informationCSC B36 Additional Notes sample induction and well-ordering proofs. c Nick Cheng
CSC B36 Additional Notes sample induction and well-ordering proofs c Nick Cheng Introduction We present examples of induction proofs here in hope that they can be used as models when you write your own
More informationCounting Palindromes According to r-runs of Ones Using Generating Functions
Counting Palindromes According to r-runs of Ones Using Generating Functions Helmut Prodinger Department of Mathematics Stellenbosch University 7602 Stellenbosch South Africa hproding@sun.ac.za Abstract
More informationIntro to Theory of Computation
Intro to Theory of Computation LECTURE 9 Last time: Converting a PDA to a CFG Pumping Lemma for CFLs Today: Pumping Lemma for CFLs Review of CFGs/PDAs Sofya Raskhodnikova 2/9/2016 Sofya Raskhodnikova;
More informationMATH 324 Summer 2011 Elementary Number Theory. Notes on Mathematical Induction. Recall the following axiom for the set of integers.
MATH 4 Summer 011 Elementary Number Theory Notes on Mathematical Induction Principle of Mathematical Induction Recall the following axiom for the set of integers. Well-Ordering Axiom for the Integers If
More informationFORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
5-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 5-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY YOU NEED TO PICK UP THE SYLLABUS, THE COURSE SCHEDULE, THE PROJECT INFO SHEET, TODAY S CLASS NOTES
More informationCSE373: Data Structures and Algorithms Lecture 2: Math Review; Algorithm Analysis. Hunter Zahn Summer 2016
CSE373: Data Structures and Algorithms Lecture 2: Math Review; Algorithm Analysis Hunter Zahn Summer 2016 Today Finish discussing stacks and queues Review math essential to algorithm analysis Proof by
More informationCOMP 3161/9161 Week 2
Concepts of Programming Languages Judgements, Inference Rules & Proofs Lecturer: Gabriele Keller Tutor: Liam O Connor University of New South Wales School of Computer Sciences & Engineering Sydney, Australia
More informationCSE 311 Lecture 28: Undecidability of the Halting Problem. Emina Torlak and Kevin Zatloukal
CSE 311 Lecture 28: Undecidability of the Halting Problem Emina Torlak and Kevin Zatloukal 1 Topics Final exam Logistics, format, and topics. Countability and uncomputability A quick recap of Lecture 27.
More informationCS1800 Discrete Structures Spring 2018 February CS1800 Discrete Structures Midterm Version A
CS1800 Discrete Structures Spring 2018 February 2018 CS1800 Discrete Structures Midterm Version A Instructions: 1. The exam is closed book and closed notes. You may not use a calculator or any other electronic
More informationData Structure Lecture#4: Mathematical Preliminaries U Kang Seoul National University
Data Structure Lecture#4: Mathematical Preliminaries U Kang Seoul National University U Kang 1 In This Lecture Set Concepts and Notation Relation Logarithm and Summations Recurrence Relations Recursion
More informationOutline. policies for the first part. with some potential answers... MCS 260 Lecture 10.0 Introduction to Computer Science Jan Verschelde, 9 July 2014
Outline 1 midterm exam on Friday 11 July 2014 policies for the first part 2 questions with some potential answers... MCS 260 Lecture 10.0 Introduction to Computer Science Jan Verschelde, 9 July 2014 Intro
More informationCSE 311: Foundations of Computing. Lecture 12: Two s Complement, Primes, GCD
CSE 311: Foundations of Computing Lecture 12: Two s Complement, Primes, GCD n-bit Unsigned Integer Representation Represent integer as sum of powers of 2: If 2 where each {0,1} then representation is b
More informationArithmetic Algorithms, Part 1
Arithmetic Algorithms, Part 1 DPV Chapter 1 Jim Royer EECS January 18, 2019 Royer Arithmetic Algorithms, Part 1 1/ 15 Multiplication à la Français function multiply(a, b) // input: two n-bit integers a
More informationCSE 2001: Introduction to Theory of Computation Fall Suprakash Datta
CSE 2001: Introduction to Theory of Computation Fall 2012 Suprakash Datta datta@cse.yorku.ca Office: CSEB 3043 Phone: 416-736-2100 ext 77875 Course page: http://www.cs.yorku.ca/course/2001 9/6/2012 CSE
More informationStudent Responsibilities Week 8. Mat Section 3.6 Integers and Algorithms. Algorithm to Find gcd()
Student Responsibilities Week 8 Mat 2345 Week 8 Reading: Textbook, Section 3.7, 4.1, & 5.2 Assignments: Sections 3.6, 3.7, 4.1 Induction Proof Worksheets Attendance: Strongly Encouraged Fall 2013 Week
More informationCounting Palindromes According to r-runs of Ones Using Generating Functions
3 47 6 3 Journal of Integer Sequences, Vol. 7 (04), Article 4.6. Counting Palindromes According to r-runs of Ones Using Generating Functions Helmut Prodinger Department of Mathematics Stellenbosch University
More informationannouncements CSE 311: Foundations of Computing highlights: halting problem highlights: always halts problem Hand in Homework 9 now Review session
CSE 3: Foundations of Computing Fall 3 Lecture 9: Wrap up announcements Hand in Homework 9 now Pick up all old homework and exams now Review session Sunday, 3pm, EEB 5 List of Final Exam Topics and sampling
More information12x + 18y = 50. 2x + v = 12. (x, v) = (6 + k, 2k), k Z.
Math 3, Fall 010 Assignment 3 Solutions Exercise 1. Find all the integral solutions of the following linear diophantine equations. Be sure to justify your answers. (i) 3x + y = 7. (ii) 1x + 18y = 50. (iii)
More informationInverses. Today: finding inverses quickly. Euclid s Algorithm. Runtime. Euclid s Extended Algorithm.
Inverses Today: finding inverses quickly. Euclid s Algorithm. Runtime. Euclid s Extended Algorithm. Refresh Does 2 have an inverse mod 8? No. Does 2 have an inverse mod 9? Yes. 5 2(5) = 10 = 1 mod 9. Does
More informationContext-free grammars and languages
Context-free grammars and languages The next class of languages we will study in the course is the class of context-free languages. They are defined by the notion of a context-free grammar, or a CFG for
More informationNOTES ON SIMPLE NUMBER THEORY
NOTES ON SIMPLE NUMBER THEORY DAMIEN PITMAN 1. Definitions & Theorems Definition: We say d divides m iff d is positive integer and m is an integer and there is an integer q such that m = dq. In this case,
More informationThe Pumping Lemma and Closure Properties
The Pumping Lemma and Closure Properties Mridul Aanjaneya Stanford University July 5, 2012 Mridul Aanjaneya Automata Theory 1/ 27 Tentative Schedule HW #1: Out (07/03), Due (07/11) HW #2: Out (07/10),
More informationDiscrete Mathematics: Logic. Discrete Mathematics: Lecture 14. Recursive algorithm
Discrete Mathematics: Logic Discrete Mathematics: Lecture 14. Recursive algorithm recursive algorithms a n = a a a a a a a = a a n-1 power (a, n) = a power (a, n-1) basis step: if n = 0, power(a, 0) =
More informationFoundations of Computer Science Lecture 23 Languages: What is Computation?
Foundations of Computer Science Lecture 23 Languages: What is Computation? A Formal Model of a Computing Problem Decision Problems and Languages Describing a Language: Regular Expressions Complexity of
More informationE.g. The set RE of regular expressions is given by the following rules:
1 Lecture Summary We gave a brief overview of inductively defined sets, inductively defined functions, and proofs by structural induction We showed how to prove that a machine is correct using induction
More informationAlgorithms (II) Yu Yu. Shanghai Jiaotong University
Algorithms (II) Yu Yu Shanghai Jiaotong University Chapter 1. Algorithms with Numbers Two seemingly similar problems Factoring: Given a number N, express it as a product of its prime factors. Primality:
More informationImproving the KMP Algorithm by Using Properties of Fibonacci String
Improving the KMP Algorithm by Using Properties of Fibonacci String Yi-Kung Shieh and R. C. T. Lee Department of Computer Science National Tsing Hua University d9762814@oz.nthu.edu.tw and rctlee@ncnu.edu.tw
More informationCS Analysis of Recursive Algorithms and Brute Force
CS483-05 Analysis of Recursive Algorithms and Brute Force Instructor: Fei Li Room 443 ST II Office hours: Tue. & Thur. 4:30pm - 5:30pm or by appointments lifei@cs.gmu.edu with subject: CS483 http://www.cs.gmu.edu/
More informationSEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION
CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION Copyright Cengage Learning. All rights reserved. SECTION 5.4 Strong Mathematical Induction and the Well-Ordering Principle for the Integers Copyright
More informationLecture 3: String Matching
COMP36111: Advanced Algorithms I Lecture 3: String Matching Ian Pratt-Hartmann Room KB2.38: email: ipratt@cs.man.ac.uk 2017 18 Outline The string matching problem The Rabin-Karp algorithm The Knuth-Morris-Pratt
More informationAlgorithm Analysis Recurrence Relation. Chung-Ang University, Jaesung Lee
Algorithm Analysis Recurrence Relation Chung-Ang University, Jaesung Lee Recursion 2 Recursion 3 Recursion in Real-world Fibonacci sequence = + Initial conditions: = 0 and = 1. = + = + = + 0, 1, 1, 2,
More informationSection 4.2: Mathematical Induction 1
Section 4.: Mathematical Induction 1 Over the next couple of sections, we shall consider a method of proof called mathematical induction. Induction is fairly complicated, but a very useful proof technique,
More informationInduction and recursion. Topics. Induction and Recursion Vojislav Kecman CMSC 302
Induction and recursion are related concepts. VCU, Department of Computer Science CMSC 302 Induction and Recursion Vojislav Kecman Induction is a proof technique, recursion is a related programming concept.
More informationChapter 5.1: Induction
Chapter.1: Induction Monday, July 1 Fermat s Little Theorem Evaluate the following: 1. 1 (mod ) 1 ( ) 1 1 (mod ). (mod 7) ( ) 8 ) 1 8 1 (mod ). 77 (mod 19). 18 (mod 1) 77 ( 18 ) 1 1 (mod 19) 18 1 (mod
More informationSection 4.1: Sequences and Series
Section 4.1: Sequences and Series In this section, we shall introduce the idea of sequences and series as a necessary tool to develop the proof technique called mathematical induction. Most of the material
More informationHow do regular expressions work? CMSC 330: Organization of Programming Languages
How do regular expressions work? CMSC 330: Organization of Programming Languages Regular Expressions and Finite Automata What we ve learned What regular expressions are What they can express, and cannot
More informationFinite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018
Finite Automata Theory and Formal Languages TMV27/DIT32 LP4 28 Lecture 5 Ana Bove March 26th 28 Recap: Inductive sets, (terminating) recursive functions, structural induction To define an inductive set
More informationLecture Notes on Inductive Definitions
Lecture Notes on Inductive Definitions 15-312: Foundations of Programming Languages Frank Pfenning Lecture 2 August 28, 2003 These supplementary notes review the notion of an inductive definition and give
More information201-1A5-MT - Mathematics Summer 2015 HOMEWORK 2 Deadline : Sunday, August 30, 2015 at 12 :30.
01-1A5-MT - Mathematics Summer 015 HOMEWORK Deadline : Sunday, August 30, 015 at 1 :30. Instructions : The assignment consists of five questions, each worth 0 points. Only hardcopy submissions of your
More informationMAT 243 Test 2 SOLUTIONS, FORM A
MAT Test SOLUTIONS, FORM A 1. [10 points] Give a recursive definition for the set of all ordered pairs of integers (x, y) such that x < y. Solution: Let S be the set described above. Note that if (x, y)
More informationProblem Session 5 (CFGs) Talk about the building blocks of CFGs: S 0S 1S ε - everything. S 0S0 1S1 A - waw R. S 0S0 0S1 1S0 1S1 A - xay, where x = y.
CSE2001, Fall 2006 1 Problem Session 5 (CFGs) Talk about the building blocks of CFGs: S 0S 1S ε - everything. S 0S0 1S1 A - waw R. S 0S0 0S1 1S0 1S1 A - xay, where x = y. S 00S1 A - xay, where x = 2 y.
More informationProof Techniques (Review of Math 271)
Chapter 2 Proof Techniques (Review of Math 271) 2.1 Overview This chapter reviews proof techniques that were probably introduced in Math 271 and that may also have been used in a different way in Phil
More information