INDUCTION AND RECURSION. Lecture 7 - Ch. 4

Similar documents
Discrete Mathematics. Spring 2017

Induction. Induction. Induction. Induction. Induction. Induction 2/22/2018

Climbing an Infinite Ladder

CSC 344 Algorithms and Complexity. Proof by Mathematical Induction

Climbing an Infinite Ladder

Discrete Mathematics. Spring 2017

Lecture Overview. 2 Weak Induction

Mathematical Induction. Section 5.1

Mathematical Induction Assignments

With Question/Answer Animations

Mathematical Induction

1 Examples of Weak Induction

Induction and Recursion

Induction and recursion. Chapter 5

Chapter Summary. Mathematical Induction Strong Induction Well-Ordering Recursive Definitions Structural Induction Recursive Algorithms

THE ISLAMIC UNIVERSITY OF GAZA ENGINEERING FACULTY DEPARTMENT OF COMPUTER ENGINEERING DISCRETE MATHMATICS DISCUSSION ECOM Eng. Huda M.

We want to show P (n) is true for all integers

ICS141: Discrete Mathematics for Computer Science I

n(n + 1). 2 . If n = 3, then 1+2+3=6= 3(3+1) . If n = 2, then = 3 = 2(2+1)

Mathematical Induction

Note that r = 0 gives the simple principle of induction. Also it can be shown that the principle of strong induction follows from simple induction.

CS 220: Discrete Structures and their Applications. Mathematical Induction in zybooks

CSE373: Data Structures and Algorithms Lecture 2: Proof by Induction. Linda Shapiro Spring 2016

Chapter 2 Section 2.1: Proofs Proof Techniques. CS 130 Discrete Structures

Mathematical Induction. EECS 203: Discrete Mathematics Lecture 11 Spring

Mat Week 8. Week 8. gcd() Mat Bases. Integers & Computers. Linear Combos. Week 8. Induction Proofs. Fall 2013

Finals: Solutions. ECS 20 (Fall 2009) Patrice Koehl May 20, 2016

Student Responsibilities Week 8. Mat Section 3.6 Integers and Algorithms. Algorithm to Find gcd()

EECS 1028 M: Discrete Mathematics for Engineers

Carmen s Core Concepts (Math 135)

Complete Induction and the Well- Ordering Principle

Homework #2 Solutions Due: September 5, for all n N n 3 = n2 (n + 1) 2 4

MATH 55 - HOMEWORK 6 SOLUTIONS. 1. Section = 1 = (n + 1) 3 = 2. + (n + 1) 3. + (n + 1) 3 = n2 (n + 1) 2.

Section 11.1 Sequences

CSE 20 DISCRETE MATH WINTER

Math.3336: Discrete Mathematics. Mathematical Induction

Quiz 3 Reminder and Midterm Results

Mathematical Induction

CISC-102 Fall 2017 Week 3. Principle of Mathematical Induction

Mathematical Induction. Rosen Chapter 4.1,4.2 (6 th edition) Rosen Ch. 5.1, 5.2 (7 th edition)

PRINCIPLE OF MATHEMATICAL INDUCTION

Binomial Coefficient Identities/Complements

Discrete Mathematics & Mathematical Reasoning Induction

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION

Mathematical Induction. Defining Functions. Overview. Notation for recursive functions. Base case Sn(0) = 0 S(n) = S(n 1) + n for n > 0

Lecture 3.2: Induction, and Strong Induction

n n P} is a bounded subset Proof. Let A be a nonempty subset of Z, bounded above. Define the set

1 Recursive Algorithms

Section 4.2: Mathematical Induction 1

CSE 20 DISCRETE MATH SPRING

21 Induction. Tom Lewis. Fall Term Tom Lewis () 21 Induction Fall Term / 14

Proof by Induction. Andreas Klappenecker

Math 324 Summer 2012 Elementary Number Theory Notes on Mathematical Induction

COMP232 - Mathematics for Computer Science

Chapter 5.1: Induction

Discrete Mathematics

A guide to Proof by Induction

CSE 311: Foundations of Computing. Lecture 14: Induction

CS173 Strong Induction and Functions. Tandy Warnow

Now, with all the definitions we ve made, we re ready see where all the math stuff we took for granted, like numbers, come from.

Proofs Not Based On POMI

8. Sequences, Series, and Probability 8.1. SEQUENCES AND SERIES

PUTNAM TRAINING NUMBER THEORY. Exercises 1. Show that the sum of two consecutive primes is never twice a prime.

Introduction to Induction (LAMC, 10/14/07)

Problem Set 5 Solutions

MEETING 9 - INDUCTION AND RECURSION

M381 Number Theory 2004 Page 1

CSCE 222 Discrete Structures for Computing. Review for Exam 2. Dr. Hyunyoung Lee !!!

1. (16 points) Circle T if the corresponding statement is True or F if it is False.

MODEL ANSWERS TO THE SEVENTH HOMEWORK. (b) We proved in homework six, question 2 (c) that. But we also proved homework six, question 2 (a) that

Contradiction MATH Contradiction. Benjamin V.C. Collins, James A. Swenson MATH 2730

Discrete Mathematics and Probability Theory Fall 2013 Vazirani Note 1

Conjectures and proof. Book page 24-30

Proof by induction ME 8

1.2 The Well-Ordering Principle

Induction and recursion. Topics. Induction and Recursion Vojislav Kecman CMSC 302

Exercises. Template for Proofs by Mathematical Induction

Discrete Mathematics & Mathematical Reasoning Induction

CSCE 222 Discrete Structures for Computing. Proof by Induction. Dr. Hyunyoung Lee. !!!!!! Based on slides by Andreas Klappenecker

MODEL ANSWERS TO THE THIRD HOMEWORK. 1. We prove this result by mathematical induction. Let P (n) be the statement that

Proofs Not Based On POMI

Math Circle: Recursion and Induction

Mathematical Induction. How does discrete math help us. How does discrete math help (CS160)? How does discrete math help (CS161)?

Sum of Squares. Defining Functions. Closed-Form Expression for SQ(n)

Consider an infinite row of dominoes, labeled by 1, 2, 3,, where each domino is standing up. What should one do to knock over all dominoes?

Mathematical Structures Combinations and Permutations

Models of Computation,

MATH10040: Numbers and Functions Homework 1: Solutions

Fall 2017 Test II review problems

Every subset of {1, 2,...,n 1} can be extended to a subset of {1, 2, 3,...,n} by either adding or not adding the element n.

Discrete Structures - CM0246 Mathematical Induction

CSCE 222 Discrete Structures for Computing. Dr. Hyunyoung Lee

Mathematical Induction

Induction 1 = 1(1+1) = 2(2+1) = 3(3+1) 2

Lecture 2. Fundamentals of the Analysis of Algorithm Efficiency

{ 0! = 1 n! = n(n 1)!, n 1. n! =

MATH 324 Summer 2011 Elementary Number Theory. Notes on Mathematical Induction. Recall the following axiom for the set of integers.

3.1 Induction: An informal introduction

Department of Computer Science University at Albany, State University of New York Solutions to Sample Discrete Mathematics Examination I (Spring 2008)

MAT115A-21 COMPLETE LECTURE NOTES

Transcription:

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! <= n n n3 -n is divisible by 3 a set with n elements has n subsets the sum of the first n positive integers is n(n + 1 ) This chapter goal is to understand the mathematical induction, and how it is used to prove results of this kind

4.1 Mathematical Induction 3 Mathematical Induction is used to show that P(n) is true for every positive integer n. Example: Suppose we have an infinite ladder, and we want to know whether we can reach every step on the ladder. We know two things 1. We can reach the first rung of the ladder.. If we can reach a particular rung of the ladder, then we can reach the next rung.

4.1 Mathematical Induction 4 PRINCIPLE OF MATHEMATICAL INDUCTION To prove that P(n) is true for all positive integers n, where P(n) is a propositional function, we complete two steps. 1. BASIS STEP: We verify that P(1) is true.. INDUCTIVE STEP: We show that the conditional statement P(k) P(k+1) is true for all positive integers k. q The assumption that P(k) is true is called the inductive hypothesis. q To complete the inductive step of a proof using the principle of mathematical induction, we assume that P(k) is true for an arbitrary positive integer k and show that under this assumption, P(k+1) must also be true. The proof technique is stated as [P(1)Λ k(p(k) P(k+1) )] np(n) where the domain is the set of positive integers

5 4.1 Mathematical Induction Show that if n is a positive integer, then Solution: 1 (1 + 1) BASIS STEP: because P(1)=1 (LHS), =1 (RHS). Thus, P(1) is true INDUCTIVE STEP: a) Assume P(k) is true for an arbitrary positive integer k. That is, we assume that P(k)= b) Under assumption (a), it must be shown that P(k+1) is true, i.e.: P(k+1)= Example 1 1+ +... + k = c) Comparing LHS in (a) and (b), we add k+1 to both sides of the equation in P(k) P(k)+k+1= =P(k+1) 1+ +... + k + ( k 1+ +... + k + ( k k( k + 1) + 1) = + 1) = ( k 1+ +... + n + 1)[( k + 1) + 1] k( k + 1) + ( k + 1) = ( k = k( k n( n + 1) = + 1)( k + ) + 1) + ( k + 1) ( k = + 1)( k + ) This shows that P(k+1) is true under the assumption that P(k) is true. 5

4.1 Mathematical Induction Example : 6 For all nonnegative integers n. Use mathematical induction to show that: 1 + + + + n = n+1 1 Solution: BASIS STEP: because P(1)= 0 = 1 (LHS), 1 1 =1 (RHS). Thus, P(1) is true INDUCTIVE STEP: a) Assume P(k) is true for an arbitrary positive integer k. That is, we assume that P(k)= 1 + + + + k = k+1 1 b) Under assumption (a), it must be shown that P(k+1) is true, i.e.: P(k+1)=1 + + + + k + k+1 = (k+1)+1 1 = k+ 1 c) Comparing LHS in (a) and (b), we add k+1 to both sides of the equation in P(k) P(k)+ k+1 = 1 + + + + k + k+1 = ( k+1 1) + k+1 = k+1 1 = k+ 1 =P(k+1) This shows that P(k+1) is true under the assumption that P(k) is true.

4. Strong Induction 7 PRINCIPLE OF STRONG INDUCTION To prove that P(n) is true for all positive integers n, where P(n) is a propositional function, we complete two steps: 1. BASIS STEP : We verify that the proposition P(1) is true.. INDUCTIVE STEP: We show that the conditional statement [P(1) /\ P() /\... /\ P(k)] à P(k + 1) is true for all positive integers k. Note: When we use strong induction to prove that P (n) is true for all positive integers n, our inductive hypothesis is the assumption that P(j) is true for j = 1,,..., k. That is, the inductive hypothesis includes all k statements P(1), P(),..., P(k). Because we can use all k statements P(1), P(),..., P(k) to prove P(k + 1), rather than just the statement P(k) as in a proof by mathematical induction, strong induction is a more flexible proof technique.

4. Strong Induction Example 1: 8 Show that if n is an integer greater than 1, then n can be written as the product of primes. Solution: BASIS STEP: because the first case is P()= (prime#).thus, P() is true INDUCTIVE STEP: a) The inductive hypothesis is the assumption that P(j) is true for all positive integers j k b) We show that P(k+1) is true under assumption (a), that is, we must show that k+1 is the product of primes. There are two cases to consider: 1. k+1 is prime à P (k+1) is true. k+1 is compositeà P (k+1)= a*b ( a b<k+1) By the inductive hypothesis, both a and b can be written as the product of primes. Thus, if k + 1 is composite, it can be written as the product of primes, namely, those primes in the factorization of a and those in the factorization of b.

4. Strong Induction Example : 9 Use strong induction to show that if you can run one mile or two miles, and if you can always run two more miles once you have run a specified number of miles, then you can run any number of miles. Solution: BASIS STEP: because we are told we can run one mile, so P (1) is true INDUCTIVE STEP: a) The inductive hypothesis is the assumption that P(j) is true; which is we can run any number of miles from 1 to k. [P(j) is true for all positive integers 1 j k] b) We show that P(k+1) is true under assumption (a), that is, we must show that we can run k + 1 miles: If k = 1, then we are already told that we can run two miles. If k > 1, then the inductive hypothesis tells us that we can run k-1 miles, so we can run (k-1) + = k + 1 miles.

10 4.3 Recursive Definitions and Structural Induction Introduction

4.3 Recursive Definitions and Structural Induction 11 Sometimes it s easier to define an object in terms of itself. This process is called Recursion. Example: The sequence of powers of : 1,, 4, 8, 16, 3, 64, 18, can be found by: Using the sequence given by the formula a n = n for n = 0, 1,, Or, using recursion: 1. Find first term of the sequence, namely, a 0 = 1, then. find a term of the sequence from the previous one, namely, a n = a n -1, for n = 1,,.

1 4.3 Recursive Definitions and Structural Induction Recursively Defined Functions Use two steps to define a function with the set of nonnegative integers as its domain: BASIS STEP: Specify that value of the function at zero. (f(0)) RECURSIVE STEP: Give a rule for finding its value at an integer from its values at smaller integers. (f(n)=g(n-1)) Such a definition is called a recursive or inductive definition. Examples: Suppose that f is defined recursively by f(0) = 3, f(n) = f(n-1) + 3 Find f(1), f(), f(3), and f(4). Solution: f(1) = f(0) + 3 = *3 + 3 = 9 f() = f(1) + 3 = *9 + 3 = 1 f(3) = f() + 3 = *1 + 3 = 45 f(4) = f(3) + 3 = *45 + 3 = 93

4.3 Recursive Definitions and Structural Induction 13 Example1: Give an recursive definition of the factorial function f(n) = n!. Then find f(5) Solution: The recursive definition is: Basis Step: f(0) = 1 Recursive Step: f(n) = (n)*f(n-1) F(5) =5 F(4) =5*4F(3) =5*4*3 F() =5 * 4 * 3 * F(1) =5 * 4 * 3 * * 1F(0) = 5 * 4 * 3 * * 1 * 1 = 10

4.3 Recursive Definitions and Structural Induction 14 Example: Give a recursive definition of. n å k = 0 Solution: a k Basis Step: å k = 0 = a 0 + a 1 + a + a 3 + a n 0 å k = 0 a k = a 0 n a k Inductive Step: ' '+, # a % = # a % + a ' %() %()

4.3 Recursive Definitions and Structural Induction 15 DEFINITION 1 The Fibonacci numbers, f 0, f 1, f,, are defined by the equations Basis step: f 0 = 0, f 1 =1 Recursive step: f n = f n-1 + f n- for n =, 3, 4,. Example: Find the Fibonacci numbers f, f 3, f 4, f 5, and f 6. Solution: f = f 1 + f 0 = 1 + 0 = 1, f 3 = f + f 1 = 1 + 1 =, f 4 = f 3 + f = + 1 = 3, f 5 = f 4 + f 3 = 3 + = 5, f 6 = f 5 + f 4 + 5 + 3 = 8. Example: Find the Fibonacci numbers f 7. Solution?

f f 1 f 1 f 0 4.3 Recursive Definitions and Structural Induction 16 f 4 f 3 f f n+1-1 addition to find f n f 1 f 0 (f 5-1) addition to find f 4 = (5-1) = 4 additions