1 RECURRENCE 1. Sequence 2. Recursively defined sequence 3. Finding an explicit formula for recurrence relation.

Slides:



Advertisements
Similar presentations
Week 6 - Wednesday CS322.
Advertisements

Section 9.1 – Sequences.
Discrete Mathematics Lecture 8 Alexander Bukharovich New York University.
Appendix B Solving Recurrence Equations : With Applications to Analysis of Recursive Algorithms.
Sequences Ordered Patterns. 8/31/2013 Sequences 2 The art of asking the right questions in mathematics is more important than the art of solving them.
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.
Discrete Structures Chapter 6 Recurrence Relations
1 Recursion, Recurrences and Induction Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong.
Recursion Lecture 17: Nov 11. Quiz int hello(int n) { if (n==0) return 0; else printf(“Hello World %d\n”,n); hello(n-1); } 1.What would the program do.
A geometric sequence is a list of terms separated by a constant ratio, the number multiplied by each consecutive term in a geometric sequence. A geometric.
Analysis of Recursive Algorithms October 29, 2014
Expressing Sequences Explicitly By: Matt Connor Fall 2013.
11.3 – Geometric Sequences.
Applied Discrete Mathematics Week 9: Relations
Advanced Counting Techniques
Sequences and Series It’s all in Section 9.4a!!!.
1 © 2010 Pearson Education, Inc. All rights reserved 10.1 DEFINITION OF A SEQUENCE An infinite sequence is a function whose domain is the set of positive.
Pg. 417/425 Homework Pg. 395#43, 60 Pg. 589#1 – 8 all, 17, 18, 21, 22.
Chapter 8. Section 8. 1 Section Summary Introduction Modeling with Recurrence Relations Fibonacci Numbers The Tower of Hanoi Counting Problems Algorithms.
Copyright © Cengage Learning. All rights reserved. CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION.
Chapter 8 With Question/Answer Animations 1. Chapter Summary Applications of Recurrence Relations Solving Linear Recurrence Relations Homogeneous Recurrence.
Copyright © 2011 Pearson Education, Inc. Sequences Section 8.1 Sequences, Series, and Probability.
Solving Recurrence Lecture 19: Nov 25. Some Recursive Programming (Optional?)
Solving Second-Order Recursive Relations Lecture 36 ½ Section 8.3 Wed, Apr 19, 2006.
RECURRENCE Sequence Recursively defined sequence
Lesson 2.2 Finding the nth term
Sequences and Summations
Fall 2015 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1.
13.4 Geometric Sequences and Series Example:3, 6, 12, 24, … This sequence is geometric. r is the common ratio r = 2.
after UCI ICS/Math 6A, Summer AdvancedCounting -1 Recurrence Relations (RRs) A “Recurrence Relation”
Sequences and Summations Section 2.4. Section Summary Sequences. – Examples: Geometric Progression, Arithmetic Progression Recurrence Relations – Example:
Fall 2015 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1.
1 CSE 20 Lecture 13: Analysis of Recursive Functions CK Cheng.
Pg. 417/425 Homework Pg. 395#43, 60 Find the “derivative” of y = sin x Pg. 589#1 – 8 all, 17, 18, 21, 22 #23 #85Graph #860 < Ɵ < π #87Ɵ = = 54.72°
1 Topics Recursion sections 8.1 – Recursion A recursively defined sequence –First, certain initial values are specified –Later terms of the sequence.
Recursion Algorithm : Design & Analysis [3]. In the last class… Asymptotic growth rate The Sets ,  and  Complexity Class An Example: Maximum Subsequence.
Discrete Mathematics Recurrence Relations Chapter 5 R. Johnsonbaugh
Section 11.1 Sequences. Sequence – list of values following a pattern Arithmetic – from term to term there is a common difference we’ll call d Geometric.
Chapter 8 Recursion. 8.3 More Recurrence Second-Order Recurrence Definition – A second-order linear homogeneous recurrence relation with constant coefficients.
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.
CSE 2813 Discrete Structures Solving Recurrence Relations Section 6.2.
Solving Recurrence Relations by Iteration Lecture 36 Section 8.2 Mon, Apr 17, 2006.
Agenda Lecture Content:  Recurrence Relations  Solving Recurrence Relations  Iteration  Linear homogenous recurrence relation of order k with constant.
RECURRENCE Sequence Recursively defined sequence
Arithmetic Sequences Sequence is a list of numbers typically with a pattern. 2, 4, 6, 8, … The first term in a sequence is denoted as a 1, the second term.
STROUD Worked examples and exercises are in the text Programme 10: Sequences PROGRAMME 10 SEQUENCES.
+ Lesson 3B: Geometric Sequences + Ex 1: Can you find a pattern and use it to guess the next term? A) 3, 9, 27, … B) 28, 14, 7, 3.5,... C) 1, 4, 9, 16,...
+ 8.4 – Geometric Sequences. + Geometric Sequences A sequence is a sequence in which each term after the first is found by the previous term by a constant.
Unit 10: Sequences & Series By: Saranya Nistala. Unit Goal: I can find and analyze arithmetic and geometric sequences and series. Key Concepts:  Define.
Mathematical Analysis of Recursive Algorithm CSG3F3 Lecture 7.
Chapter 2 Fundamentals of the Analysis of Algorithm Efficiency Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Advanced Algorithms Analysis and Design By Dr. Nazir Ahmad Zafar Dr Nazir A. Zafar Advanced Algorithms Analysis and Design.
Section Recursion  Recursion – defining an object (or function, algorithm, etc.) in terms of itself.  Recursion can be used to define sequences.
8.1 – Sequences and Series. Sequences Infinite sequence = a function whose domain is the set of positive integers a 1, a 2, …, a n are the terms of the.
1 Lecture Outline for Recurrences Already Covered: Recursive definition of sequences Recursive definition of sets Recursive definition of operations Recursive.
CSG523/ Desain dan Analisis Algoritma
CSG523/ Desain dan Analisis Algoritma
CMSC Discrete Structures
Recursion and Recurrence Relations
Geometric Sequences and Series
Ch. 8 – Sequences, Series, and Probability
9.4 Sequences.
CMSC Discrete Structures
Solving Recurrence Relations
Solving Recurrence Relations by Iteration
CMSC Discrete Structures
Recurrence Relations Discrete Structures.
Module 3 Arithmetic and Geometric Sequences
Unit 3: Linear and Exponential Functions
Sequences.
Presentation transcript:

1 RECURRENCE 1. Sequence 2. Recursively defined sequence 3. Finding an explicit formula for recurrence relation

2 Learning Outcomes You should be able to solve first-order and second-order linear homogeneous recurrence relation with constant coefficients

3 Preamble What is recurrence and how does it relate to a sequence?

4 Sequences A sequence is an ordered list of objects (or events). Like a set, it contains members (also called terms)setmembers Sequences can be finite or infinite.finiteinfinite 2,4,6,8, … for i ≥ 1 a i = 2 i (explicit formula) infinite sequence with infinite distinct values -1,1,-1,1, … for i ≥ 1 b i = (-1) i infinite sequence with finite distinct values For 1<= i <=6 c i = i +5 finite sequence (with finite distinct values) 6,7,8,9,10,11

5 Ways to define sequence Write the first few terms: 3,5,7,… Use explicit formula for its nth term a n = 2n for n ≥ 1 Use recursion How to define a sequence using a recursion?

6 Recursively defined sequences Recursion can be used to defined a sequence. This requires: A recurrence relation: a formula that relates each term a k to some previous terms a k-1, a k-2, … ak = a k-1 + 2a k-2 The initial conditions: the values of the first few terms a 0, a 1, … Example: For all integers k ≥ 2, find the terms b 2, b 3 and b 4 : b k = b k-1 + b k-2 (recurrence relation) b 0 = 1 and b 1 = 3 (initial conditions) Solution: b 2 = b 1 + b 0 = = 4 b 3 = b 2 + b 1 = = 7 b 4 = b 3 + b 2 = = 11

7 Explicit formula and recurrence relation Show that the sequence 1,-1!,2!,-3!,4!,…,(-1) n n!,… for n≥0, satisfies the recurrence relation s k = (-k)s k-1 for all integers k≥1. The general term of the sequence: s n =(-1) n n! substitute k and k-1 for n to get s k =(-1) k k! s k-1 =(-1) k-1 (k-1)! Substitute s k-1 into recurrence relation: (-k)s k-1 = (-k)(-1) k-1 (k-1)! = (-1)k(-1) k-1 (k-1)! = (-1)(-1) k-1 k(k-1)! = (-1) k k! = s k

8 Examples of recursively sequence Famous recurrences Arithmetic sequences: e.g. 1,4,7,10,13,… geometric sequences: e.g. 1,3,9,27,… Factorial: f(n) = n. f(n-1) Fibonacci numbers: 1,1,2,3,5,8,… Tower of Hanoi problem

9 Application of recurrence Analysis of algorithm containing recursive function such as factorial function. Algorithm f(n) /input: A nonnegative integer /output: The value of n! If n = 0 return 1 else return f(n-1)*n No. of operations (multiplication) determines the efficiency of algo. Recurrence relation is used to express the no. of operation in the algorithm.

10 Solving Recurrence relation by Iteration It is helpful to know an explicit formula for a sequence. An explicit formula is called a solution to the recurrence relation Most basic method is iteration - start from the initial condition - calculate successive terms until a pattern can be seen - guess an explicit formula

11 Some examples Let a 0,a 1,a 2,… be the sequence defined recursively as follows: For all integers k≥1, (1) a k = a k-1 +2 (2) a 0 = 1 Use iteration to guess an explicit formula for the sequence. a 0 =1 a 1 =a 0 +2 a 2 =a 1 +2=(1+2)+2 = a 3 =a 2 +2=(1+2.2)+2 = a 4 =a 3 +2=(1+3.2)+2 = …. Guess: a n =1+n.2=1+2n The above sequence is an arithmetic sequence.

12

13 Geometric Sequence Let r be a fixed nonzero constant, and suppose a sequence a 0,a 1,a 2,… is defined as follows: a k = ra k-1 for all integers k ≥ 1 a 0 = a Use iteration to guess an explicit formula for the sequence a 0 =a a 1 =ra 0 =ra a 2 =ra 1 =r(ra)=r 2 a a 3 =ra 2 =r(r 2 a)=r 3 a Guess: a n =r n a = ar n for all integers n≥0 The above sequence is geometric sequence and r is a common ratio.

14 Second-Order Linear Homogeneous with constant coefficients A second-order linear homogeneous recur. relation with c.c. is a recur. relation of the form a k = Aa k-1 + Ba k-2 for all integers k ≥ some fixed integer, where A and B are fixed real numbers with B ≠ 0.

15 Terminology a k = Aa k-1 + Ba k-2 Second order: a k contains the two previous terms Linear: a k-1 and a k-2 appear in separate terms and to the first power Homogeneous: total degree of each term is the same (no constant term) Constant coefficients: A and B are fixed real numbers

16 Examples Second-Order Linear Homogeneous with constant coefficients a k = 3a k-1 + 2a k-2 - yes. b k = b k-1 + b k-2 + b k-3 - no d k = (d k-1 ) 2 + d k-1 d k-2 - no; not linear e k = 2e k-2 - yes; A = 0, B = 2. f k = 2f k no; not homogeneous

17 Distinct-Roots Case