Lecture#16 Discrete Mathematics. Recursion Now, 1 is an odd positive integer by the definition base. With k = 1, 1 + 2 = 3, so 3 is an odd positive integer.

Slides:



Advertisements
Similar presentations
Copyright © Cengage Learning. All rights reserved. CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION.
Advertisements

Induction and Recursion. Odd Powers Are Odd Fact: If m is odd and n is odd, then nm is odd. Proposition: for an odd number m, m k is odd for all non-negative.
CN College Algebra Ch. 11: Sequences 11.3: Geometric Sequences Goals: Determine if a sequence is geometric. Find a formula for a geometric sequence. Find.
Kavita Math231 Recursion and Iteration. Kavita Math231 We use Recursion when we have to perform a complex task that can be broken into the several subtasks.
Recursive Definitions Rosen, 3.4. Recursive (or inductive) Definitions Sometimes easier to define an object in terms of itself. This process is called.
Recursion. Recursive Solutions Recursion breaks a problem into smaller identical problems – mirror images so to speak. By continuing to do this, eventually.
Copyright © 2007 Pearson Education, Inc. Slide 8-1 Warm-Up Find the next term in the sequence: 1, 1, 2, 6, 24, 120,…
Analysis of Recursive Algorithms October 29, 2014
Applied Discrete Mathematics Week 9: Relations
Introduction to sequences and series A sequence is a listing of numbers. For example, 2, 4, 6, 8,... or 1, 3, 5,... are the sequences of even positive.
Lecture 9. Arithmetic and geometric series and mathematical induction
Induction and recursion
Chapter 4: Induction and Recursion
1 © 2010 Pearson Education, Inc. All rights reserved © 2010 Pearson Education, Inc. All rights reserved Chapter 11 Further Topics in Algebra.
Section 5.3. Section Summary Recursively Defined Functions Recursively Defined Sets and Structures Structural Induction.
Section 2.4. Section Summary Sequences. Examples: Geometric Progression, Arithmetic Progression Recurrence Relations Example: Fibonacci Sequence Summations.
Chapter 5: Sequences, Mathematical Induction, and Recursion 5.6 Defining Sequences Recursively 1 So, Nat’ralists observe, a Flea/Hath smaller Fleas on.
1 © 2010 Pearson Education, Inc. All rights reserved © 2010 Pearson Education, Inc. All rights reserved Chapter 10 Further Topics in Algebra.
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,
Fall 2015 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1.
Copyright © 2007 Pearson Education, Inc. Slide 8-1.
Copyright © 2011 Pearson Education, Inc. Slide Sequences A sequence is a function that has a set of natural numbers (positive integers) as.
What is the next shape/number for each? 1. 5, 3, 1, -1, -3, ____
Copyright © 2011 Pearson Education, Inc. Slide
March 3, 2015Applied Discrete Mathematics Week 5: Mathematical Reasoning 1Arguments Just like a rule of inference, an argument consists of one or more.
12.1 Sequences and Series ©2001 by R. Villar All Rights Reserved.
Introduction to sequences and series
Sequences and Summations
Section 2.4. Section Summary Sequences. Examples: Geometric Progression, Arithmetic Progression Recurrence Relations Example: Fibonacci Sequence Summations.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Ver Recursive Solutions Recursion is an extremely powerful problem-solving.
9.1 Sequences and Series. A sequence is a collection of numbers that are ordered. Ex. 1, 3, 5, 7, …. Finding the terms of a sequence. Find the first 4.
Sequences and Summations Section 2.4. Section Summary Sequences. – Examples: Geometric Progression, Arithmetic Progression Recurrence Relations – Example:
1 Topics Recursion sections 8.1 – Recursion A recursively defined sequence –First, certain initial values are specified –Later terms of the sequence.
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
Foundations of Discrete Mathematics Chapters 5 By Dr. Dalia M. Gil, Ph.D.
7.2 Solving Linear Recurrence Relations Some of these recurrence relations can be solved using iteration or some other ad hoc technique. However, one important.
Agenda Lecture Content:  Recurrence Relations  Solving Recurrence Relations  Iteration  Linear homogenous recurrence relation of order k with constant.
Infinite Geometric Series Recursion & Special Sequences Definitions & Equations Writing & Solving Geometric Series Practice Problems.
Mathematical Induction Section 5.1. Climbing an Infinite Ladder Suppose we have an infinite ladder: 1.We can reach the first rung of the ladder. 2.If.
Discrete Mathematics Lecture # 22 Recursion.  First of all instead of giving the definition of Recursion we give you an example, you already know the.
CompSci 102 Discrete Math for Computer Science March 13, 2012 Prof. Rodger Slides modified from Rosen.
Chapter 5 With Question/Answer Animations 1. Chapter Summary Mathematical Induction - Sec 5.1 Strong Induction and Well-Ordering - Sec 5.2 Lecture 18.
Chapter 2 1. Chapter Summary Sets The Language of Sets - Sec 2.1 – Lecture 8 Set Operations and Set Identities - Sec 2.2 – Lecture 9 Functions and sequences.
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.
Lecture # 20 Sequence & Series
Fall 2002CMSC Discrete Structures1 Chapter 3 Sequences Mathematical Induction Recursion Recursion.
Mathematics Medicine Sequences and series.
CMSC Discrete Structures
Modeling with Recurrence Relations
Sequences and Series 9.1.
Sequences and Series.
Use mathematical induction to prove that the formula is true for all natural numbers m. {image} Choose the first step of the proof from the following:
Mathematical Induction Recursion
Lecture Outline for Recurrences
Discrete Math (2) Haiming Chen Associate Professor, PhD
Section 9.1 Sequences and Series.
Copyright © Cengage Learning. All rights reserved.
Copyright © Cengage Learning. All rights reserved.
Applied Discrete Mathematics Week 9: Integer Properties
9.1: Introduction to Sequences
CMSC Discrete Structures
9.1 Sequences Sequences are ordered lists generated by a
Applied Discrete Mathematics Week 7: Computation
CMSC Discrete Structures
Recurrence Relations Discrete Structures.
Mathematical Induction
Warm Up Write the first 4 terms of each sequence:
Chapter 4 (Part 2): Mathematical Reasoning, Induction & Recursion
Recursion.
Presentation transcript:

Lecture#16 Discrete Mathematics

Recursion

Now, 1 is an odd positive integer by the definition base. With k = 1, = 3, so 3 is an odd positive integer. With k = 3, = 5, so 5 is an odd positive integer and so, 7, 9, 11, … are odd positive integers. REMARK: Recursive definitions can be used in a “generative” manner

Recursion The process of defining an object in terms of smaller versions of itself is called recursion. A recursive definition has two parts: BASE An initial simple definition which cannot be expressed in terms of smaller versions of itself RECURSION The part of definition which can be expressed in terms of smaller versions of itself

Recursion Principle A function is said to be recursively defined if the function refers to itself such that: 1. There are certain arguments, called base values, for which the function does not refer to itself 2. Each time the function does refer to itself, the argument of the function must be closer to a base value

Recursion: Example Suppose that f is defined recursively by f(0) = 3, f(n+1) = 2 f(n) + 3 Findf(1), f(2), f(3) and f(4).

Recursion: Example Find f(2), f(3), and f(4) if f is defined recursively by f(0) = -1, f(1)=2 and for n = 1, 2, 3, … f(n+1) = f(n) + 3 f(n - 1)

Factorial Function N! = N X (N-1) X (N-2) ….. X 2 X 1 Recursive definition of factorial function is: Factorial(0) = 1 Factorial(n) = n Factorial(n-1)

Factorial Function N! = N X (N-1) X (N-2) ….. X 2 X 1 Recursive definition of factorial function is: Factorial(0) = 1 Factorial(n) = n Factorial(n-1)

Sum Function Let S be the function such that S(n) is the sum of the first n positive integers. Give a recursive definition of S(n). Solution: Initial value of this function may be specified as S(0)=0 Since S(n) = n + (n - 1) + (n - 2) + … = n + [(n - 1) + (n - 2) + … ] = n + S(n-1) which defines the recursive step. Accordingly S may be defined as: 1. S(0)= 02. S(n) = n + S(n - 1)for n  1

Sum Function Let a and b denote positive integers. Suppose a function Q is defined recursively as follows: Find the value of Q(2,3) and Q(14,3) What does this function do? Find Q (3355, 7)

Fibonacci Series The Fibonacci sequence is defined as follows. F 0 =1, F 1 =1 F k = F k – 1 + F k – 2 for all integers k  2 F2 = F1 + F0 = = 2 F3 = F2 + F1 = = 3 F4 = F3 + F2 = = 5 F5 = F4 + F3 = = 8..

Recurrence Relation A recurrence relation for a sequence a 0, a 1, a 2,..., is a formula that relates each term a k to certain of its predecessors a k – 1, a k – 2,..., a k – i, where i is a fixed integer and k is any integer greater than or equal to i. The initial conditions for such a recurrence relation specify the values of a 0, a 1, a 2,...,.a i – 1

Recurrence Relation: Example Find the first four terms of the following recursively defined sequence. b 1 = 2 b k = b k – · k, for all integers k  2

Recurrence Relation: Example Find the first five terms of the following recursively defined sequence. t 0 = – 1,t 1 = 1 t k = t k – · t k – 2, for all integers k  2

Recurrence Relation: Example Define a sequence b 0, b 1, b 2,... by the formula b n = 5 n, for all integers n  0. Show that this sequence satisfies the recurrence relation b k = 5b k – 1, for all integers k  1.

Recurrence Relation: Example Show that the sequence 0, 1, 3, 7,..., 2 n – 1,..., for n  0, satisfies the recurrence relation d k = 3d k – 1 – 2d k – 2, for all integers k  2