Discrete Structures & Algorithms More on Methods of Proof / Mathematical Induction EECE 320 — UBC.

Slides:



Advertisements
Similar presentations
Extensible Networking Platform CSE 240 – Logic and Discrete Mathematics Review: Mathematical Induction Use induction to prove that the sum of the.
Advertisements

22C:19 Discrete Structures Induction and Recursion Spring 2014 Sukumar Ghosh.
22C:19 Discrete Structures Induction and Recursion Fall 2014 Sukumar Ghosh.
Reasoning About Code; Hoare Logic, continued
Introduction to CS Theory Lecture 2 – Discrete Math Revision Piotr Faliszewski
Recursively Defined Functions
Induction and recursion
Discrete Structures & Algorithms More about sets EECE 320 — UBC.
Math 308 Discrete Mathematics Discrete Mathematics deals with “Separated” or discrete sets of objects (rather than continuous sets) Processes with a sequence.
CSE115/ENGR160 Discrete Mathematics 04/05/11 Ming-Hsuan Yang UC Merced 1.
Algorithm Design Techniques: Induction Chapter 5 (Except Section 5.6)
Lecture ,3.3 Sequences & Summations Proof by Induction.
Chapter Mathematical Induction
Section Section Summary Recursive Algorithms Proving Recursive Algorithms Correct Recursion and Iteration (not yet included in overheads) Merge.
Module #1 - Logic 1 Based on Rosen, Discrete Mathematics & Its Applications. Prepared by (c) , Michael P. Frank. Modified By Mingwu Chen Induction.
22C:19 Discrete Math Induction and Recursion Fall 2011 Sukumar Ghosh.
Induction and recursion
Discrete Mathematics CS 2610 March 26, 2009 Skip: structural induction generalized induction Skip section 4.5.
Lecture 9. Arithmetic and geometric series and mathematical induction
Reading and Writing Mathematical Proofs
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Chapter 4 Induction and Recursion 歐亞書局.
1 Introduction to Abstract Mathematics Chapter 4: Sequences and Mathematical Induction Instructor: Hayk Melikya 4.1- Sequences. 4.2,
Week #7 – 7/9/11 October 2002 Prof. Marie desJardins
CSE 311 Foundations of Computing I Lecture 15 Recursive Definitions and Structural Induction Autumn 2011 CSE 3111.
Chapter 3 (Part 3): Mathematical Reasoning, Induction & Recursion  Recursive Algorithms (3.5)  Program Correctness (3.6)
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 4 (Part 3): Mathematical Reasoning, Induction.
INDUCTION AND RECURSION. PRINCIPLE OF MATHEMATICAL INDUCTION To prove that P(n) is true for all positive integers n, where P(n) is a propositional function,
Module #14: Recursion Rosen 5 th ed., §§ In this class, we will study recursion, one of the most important topics in computer science. In the last.
4.4 Recursive Algorithms A recursive algorithm is one which calls itself to solve “smaller” versions of an input problem. How it works: – The current status.
Inductive Proofs. Mathematical Induction A powerful, rigorous technique for proving that a predicate P(n) is true for every natural number n, no matter.
Chapter 5 With Question/Answer Animations. Section 5.1.
Reading and Writing Mathematical Proofs Spring 2015 Lecture 4: Beyond Basic Induction.
Recursive Algorithms &
Chap 3 –A theorem is a statement that can be shown to be true –A proof is a sequence of statements to show that a theorem is true –Axioms: statements which.
Discrete Structures & Algorithms More on Methods of Proof / Mathematical Induction EECE 320 — UBC.
ICS 253: Discrete Structures I Induction and Recursion King Fahd University of Petroleum & Minerals Information & Computer Science Department.
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.
2IS80 Fundamentals of Informatics Fall 2015 Lecture 6: Sorting and Searching.
Recursive Algorithm (4.4) An algorithm is called recursive if it solves a problem by reducing it to an instance of the same problem with smaller input.
Copyright © Zeph Grunschlag, Induction Zeph Grunschlag.
Sum of Arithmetic Sequences. Definitions Sequence Series.
More Induction Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois 1 A Pork-Butchers Shop Seen from a Window Van Gogh.
03/05/13 More Induction Discrete Structures (CS 173) Derek Hoiem, University of Illinois 1 Artist: Frank.
1 Discrete Mathematical Mathematical Induction ( الاستقراء الرياضي )
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.
Section Recursion  Recursion – defining an object (or function, algorithm, etc.) in terms of itself.  Recursion can be used to define sequences.
CSE 311 Foundations of Computing I Lecture 15 Strong Induction and Recursive Definitions Spring
Mathematical Induction EECS 203: Discrete Mathematics Lecture 11 Spring
Mathematical Induction And Recursion Discrete Math Team KS MATEMATIKA DISKRIT (DISCRETE MATHEMATICS ) 1.
Chapter 5 1. Chapter Summary  Mathematical Induction  Strong Induction  Recursive Definitions  Structural Induction  Recursive Algorithms.
Lecture 3.4: Recursive Algorithms CS 250, Discrete Structures, Fall 2015 Nitesh Saxena Adopted from previous lectures by Zeph Grunschlag.
Hubert Chan (Chapters 1.6, 1.7, 4.1)
(Proof By) Induction Recursion
Recursive Algorithms Section 5.4.
Chapter 4 (Part 3): Mathematical Reasoning, Induction & Recursion
CSE15 Discrete Mathematics 04/12/17
Math/CSE 1019C: Discrete Mathematics for Computer Science Fall 2012
Announcements Quiz 4 will be on next Friday (4/3). It will cover materials from Chapter 4. Check your grades on WebCT and notify me promptly if you see.
CS2210:0001Discrete Structures Induction and Recursion
Hubert Chan (Chapters 1.6, 1.7, 4.1)
Rosen 5th ed., §§ ~18 slides, ~1 lecture
Applied Discrete Mathematics Week 9: Integer Properties
Rosen 5th ed., §§ ~18 slides, ~1 lecture
Mathematical Induction
Math/CSE 1019: Discrete Mathematics for Computer Science Fall 2011
Discrete Mathematics and its Applications
Induction and recursion
Discrete Mathematics and its Applications
Presentation transcript:

Discrete Structures & Algorithms More on Methods of Proof / Mathematical Induction EECE 320 — UBC

2 Announcements First assignment due Friday drop-box Quiz during next lecture

3 Quiz sample 1.) Show that the following statement: For every positive integer n, 2n  n 2 is false 2.) Show that if x is irrational, then sqrt(x) is irrational.

4 What have we explored so far? Propositional logic Rules of inference Methods of proof Proofs by induction

5 The essential elements of mathematical induction are: The proposition of interest The base case The inductive step

6 Example Prove that 2 n 3

7 Example Prove that n 3 -n is divisible by 3 for all integers n Do you need to use ‘strong induction’?

8 Example Consider the following game: Two players. Players take turns removing any positive number of matches from one of two piles of matches. The player who takes the last match(es) wins. Show that if the two piles contain the same number of matches, the second player has a guaranteed winning strategy

9 What’s wrong with the following proof using ‘strong induction’? For all non-negative integer n, 5n=0 Proof: Base case: 5*0=0 Induction step: Suppose that 5j = 0 for all non-negative integers j, 0  j  k. Aim to show that 5(k+1)=0. We can write k+1=i+j with 0  i,j  k. 5(k+1)=5(i+j)=5i+5j=0+0=0.

10 Recursive definitions Series: S n = … + n Can be defined as: S 1 = 1 S n+1 = S n + (n+1)

11 Recursive definitions Sets: S 3 = {n| n>0, n divisible by 3} Can recursively be defined as: Base step: 3  S 3 Recursive step: if x  S 3 and y  S 3 then x+y  S 3

12 Recursive definitions Structures: A list L n …is formed by its cells C 1, C 2,,, C n A list recursively be defined as: Base step: an empty list is a list. Recursive step: L n+1 is a list if it is formed by adding a cell C to a list L n

13 Recursive algorithms Naturally work on all recursive definitions! Example: Insertion sort

14 To insert 12, we need to make room for it by moving first 36 and then Insertion sort

Insertion sort

Insertion sort

17 Insertion sort Procedure sort (List L): if length(L)  1 return L else C = head (L) T = tail (L) return insert (C, sort(T))

18 (auxiliary procedure: Insertion) Procedure insert (Cell C, List L): if length(L) = 0 return list(C) else if C < head (L) return list(C,L) else return list(head(L), insert (C, tail(L))

19 Induction proofs and recursive procedures You can use proofs based on induction to prove: Correctness invariants Complexity limits

20 Insertion sort – correctness Procedure sort (List L): if length(L)  1 return L else C = head (L) T = tail (L) return insert (C, sort(T)) L 1 sorted if L N sorted then L N+1 sorted To prove: L N sorted for all lengths N

21 Insertion sort – complexity Procedure sort (List L): if length(L)  1 return L else C = head (L) T = tail (L) return insert (C, sort(T)) P 1 = 0 P N+1 = P N + complexit y(insert N ) To find: P N – the average number of operations to sort L N

22 In class exercise Give a recursive algorithm to find the maximum of a list of non-negative integers. Use structural induction to prove correctness Analyze complexity

23 Better sorting

24 Procedure mergesort (L=a 1, a 2, ….a n ): if n>1 then m:= n/2 L 1 = a 1, a 2, …. a m L 2 = a m+1, …. a n L = merge (mergesort(L 1 ),mergesort(L 2 )) return L Recursive proof  Correctness  Complexity

25 The essential elements of mathematical induction are: The proposition of interest The base case The inductive step

26 Various uses of induction Normal Strong induction Recursive definitions Induction: To prove correctness properties (invariants) Induction: To analyze algorithm complexity

27 To understand how to perform computations efficiently, we need to know How to count! How to sum a sequence of steps. Reason about the complexity/efficiency of an algorithm. Prove the correctness of our analysis. –Logic –Methods of inference –Proof strategies –Induction –… (and eventually) How to create better algorithms.