Proof by Induction CSC 172 SPRING 2002 LECTURE 7.

Slides:



Advertisements
Similar presentations
Mathematical Induction
Advertisements

22C:19 Discrete Structures Induction and Recursion Spring 2014 Sukumar Ghosh.
Copyright © Cengage Learning. All rights reserved. CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION.
1 Mathematical Induction. 2 Mathematical Induction: Example  Show that any postage of ≥ 8¢ can be obtained using 3¢ and 5¢ stamps.  First check for.
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.
Fall 2007CS 2251 Proof by Induction. Fall 2007CS 2252 Proof by Induction There are two forms of induction Standard Induction –Prove the theorem is true.
General Announcements Project Due Friday, 1/30 Labs start Wednesday & Thursday – Java review – Weiss 1.19, 1.20 – You may show up & hand in Workshops.
Lecture 12 Oct 13, 2008 Some simple recursive programs recursive problem solving, connection to induction Some examples involving recursion Announcements.
TR1413: INTRO TO DISCRETE MATHEMATICS LECTURE 2: MATHEMATICAL INDUCTION.
CSE115/ENGR160 Discrete Mathematics 03/22/12 Ming-Hsuan Yang UC Merced 1.
Chapter 10 Sequences, Induction, and Probability Copyright © 2014, 2010, 2007 Pearson Education, Inc Mathematical Induction.
DAST 2005 Tirgul 6 Heaps Induction. DAST 2005 Heaps A binary heap is a nearly complete binary tree stored in an array object In a max heap, the value.
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.
22C:19 Discrete Math Induction and Recursion Fall 2011 Sukumar Ghosh.
Algorithm Design and Analysis (ADA)
Recursive Definitions and Structural Induction
ICS 253 Presents Mathematical Induction Sultan Almuhammadi muhamadi
MATH 224 – Discrete Mathematics
Inductive Proof (the process of deriving generalities from particulars) Mathematical Induction (reasoning over the natural numbers)
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!
College Algebra Fifth Edition James Stewart Lothar Redlin Saleem Watson.
CSNB143 – Discrete Structure Topic 5 – Induction Part I.
Discrete Maths Objective to introduce mathematical induction through examples , Semester 2, Mathematical Induction 1.
CSE 311 Foundations of Computing I Lecture 16 Recursively Defined Sets and Structural Induction Spring
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,
CSC201 Analysis and Design of Algorithms Asst.Proof.Dr.Surasak Mungsing Oct-151 Lecture 2: Definition of algorithm and Mathematical.
Discrete Maths: Induction/1 1 Discrete Maths Objective – –to introduce mathematical induction through examples , Semester
9.4 Mathematical Induction
Theory of Computation, Feodor F. Dragan, Kent State University 1 TheoryofComputation Spring, 2015 (Feodor F. Dragan) Department of Computer Science Kent.
Mathematical Induction Digital Lesson. Copyright © by Houghton Mifflin Company, Inc. All rights reserved. 2 Mathematical induction is a legitimate method.
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
1 Recursive Definitions and Structural Induction CS 202 Epp section ??? Aaron Bloomfield.
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.
Classifications LanguageGrammarAutomaton Regular, right- linear Right-linear, left-linear DFA, NFA Context-free PDA Context- sensitive LBA Recursively.
CSE373: Data Structures and Algorithms Lecture 2: Proof by Induction Linda Shapiro Winter 2015.
Section 8.4 Mathematical Induction. Mathematical Induction In this section we are going to perform a type of mathematical proof called mathematical induction.
1 Discrete Mathematical Mathematical Induction ( الاستقراء الرياضي )
Mathematical Induction. The Principle of Mathematical Induction Let S n be a statement involving the positive integer n. If 1.S 1 is true, and 2.the truth.
ALGORITHMS PROVING ALGORITHMS (PROGRAMS) CORRECT WITH AND WITHOUT INDUCTION.
Hubert Chan (Chapters 1.6, 1.7, 4.1)
11.7 – Proof by Mathematical Induction
MATH 224 – Discrete Mathematics
Analysis of Algorithms CS 477/677
Inductive Proof (the process of deriving generalities from particulars) Mathematical Induction (reasoning over the natural numbers)
CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis Catie Baker Spring 2015.
Advanced Algorithms Analysis and Design
CS2210:0001Discrete Structures Induction and Recursion
Chapter 3 The Real Numbers.
CSE 311: Foundations of Computing
Hubert Chan (Chapters 1.6, 1.7, 4.1)
Discrete Structures for Computer Science
Proving algorithms (programs) correct with induction
CSE373: Data Structures and Algorithms Lecture 2: Proof by Induction
CSE373: Data Structures and Algorithms Lecture 2: Proof by Induction
This Lecture Substitution model
CS200: Algorithm Analysis
CSE 373: Data Structures & Algorithms
Mathematical Induction
Mathematical Induction
Follow me for a walk through...
This Lecture Substitution model
Advanced Analysis of Algorithms
Chapter 11: Further Topics in Algebra
Mathematical Induction
This Lecture Substitution model
Mathematical Induction
Follow me for a walk through...
Copyright © Cengage Learning. All rights reserved.
Useful GCD Fact If a and b are positive integers, then gcd(a,b) = gcd(b, a mod b) Proof: By definition of mod, a = qb+ (a mod b) for.
11.4 Mathematical Induction
Presentation transcript:

Proof by Induction CSC 172 SPRING 2002 LECTURE 7

Lectures on Line

Proof by induction  If I know “something is true for the value 1”  And I know that “if it is true for x, then it must also be true for x+1”  Is it true for 7?  Why?

Review : Sorting an array  Write a Java method that takes an array of ints and sorts it in place  Describe this algorithm in “words”  Describe “selection sort”

Selection Sort public static void selsort(int [] a){ for (j=0;j<a.length;j++){ int maxIndex = j; for (int k = j;k<a.length;k++) if (a[k]>a[maxIndex]) maxIndex = k; int temp = a[j]; a[j] = a[maxIndex]; a[maxIndex] = temp; } }// How many comparisons, as a function of a.length?

Selection Sort jk 0N 1N-1 2N-2... N-11

Total number of comparisons N + (N-1) + (N-2) Reversing N =

 Prove In order to calculate work

Simple Induction  Three Pieces 1. A statement S(n) to be proved  The statement must be about an integer parameter n 2. A basis for the proof  The statement S(b) for some specific integer b  Often b==0 or b==1 3. An inductive step for the proof  Show that “If S(n) is true, then S(n+1) must also be true”  Prove the statement “S(n) implies S(n+1)” for any n.  For this part, you get to “suppose” S(n) is true  “For the sake of argument”  Aka the inductive hypothesis

Prove: 1. Statement: S(n) : For any n>=1

Prove: 2. Basis Select n == 1

Prove: 2. Alternate Basis Select n == 2

Prove: 2. Alternate Basis Select n == 3

Prove: 3. Inductive Step Assume: To show:

Inductive Step We know, by definition: Rewrite it:

Inductive Step “By the Induction hypothesis” (we can make the following substitution)

Inductive Step  The rest is just algebra

Which, of course, is what we set out to prove!

So, what did we do  We showed that it worked for 1  And that if it worked for n, it must work for n+1  So, is it true for n==7?  Why?  Is it true for n== ?

Template for Simple Induction 1. State what S(n) is. 2. Explain what n represents. “any positive integer” or “length of the string” 3. Tell what the value of n is for the basis case n==b 4. Prove S(b) 5. State that you are assuming n>=b and S(n) 6. Prove S(n+1) using the assumptions (say: “B.T.I.H.”) 7. State that due to (4) and (6) you conclude S(n) for all n>=b

Interesting Aside: Visual Proof  Proof is “convincing prose”  Not all proof is “mathematical”

Visual Proof 123..n n

1..n/2..n n

Visual Proof 1..n/ n

Visual Proof 1..n/ n

Visual Proof 1..n/ n

Visual Proof 1..n/ n n+1

More General Induction  More than one basis case  Complete (Strong) indcution  Proof that S(n+1) is true uses any of S(b),S(b+1),…,S(n)  Where b is the lowest basis case

Example  Multiple Basis cases & Strong Induction  Every integer >= 24 can be written as 5a+7b for non-negative integers a and b.  Is this true for 16? For 19? For 23?

Statement  S(n): n ==5a+7b for some a>=0, and b>=0

Basis We need 5 24 == 5x2+7x2 25 == 5x5+7x0 26 == 5x1+7x3 27 == 5x4+7x1 28 == 5x0+7x4

Inductive Step Let (n+1) >= 29 Then (n-4) >= 24, which is the lowest basis case So, assume S(n-4) is true We can write: n-4 == 5a+7b for some a and b Thus: n+1 == 5(a+1)+7b, proving S(n+1)

An Interesting Sequence n What is the pattern? What is it’s value? Why is it interesting?

 How many nodes at each level of a binary tree? So, how many nodes, all told?

Why is it interesting? What does “really mean?” 1× × × ×2 0 == == ==

Binary numbers How much is ? How does a= relate to b= ? Consider the relationship between the binary number formed by n 1’s to the binary number formed by one 1 followed by n 0’s Describe a & b, mathematically

Proof S(n)

Basis S(0)

Inductive Step S(n+1)

B.T.I.H S(n+1)

So S(n+1)

Visual Proof 1..(n+1)/2..n n

Visual Proof 1..(n+1)/2..n n+1 n

Visual Proof 1..(n+1)/2..n n+1 n n/2

Visual Proof 1..(n+1)/2..n n+1 n

Visual Proof 1..(n+1)/2..n n+1 n

Visual Proof 1..(n+1)/2..n n+1 n