Introduction to Recurrence Relations

Slides:



Advertisements
Similar presentations
Tower of Hanoi Tower of Hanoi is a mathematical puzzle invented by a French Mathematician Edouard Lucas in The game starts by having few discs stacked.
Advertisements

Chapter Recurrence Relations
section 6.2 Solving Recurrence Relations
1 Recursive Algorithm Analysis Dr. Ying Lu RAIK 283: Data Structures & Algorithms September 13, 2012.
CS 2210 (22C:19) Discrete Structures Advanced Counting
Recursion.
1 Section 6.1 Recurrence Relations. 2 Recursive definition of a sequence Specify one or more initial terms Specify rule for obtaining subsequent terms.
6.Advanced Counting Techniques 1 Copyright M.R.K. Krishna Rao 2003 Ch 6. Recurrence Relations A recurrence relation for the sequence {a n } is an equation.
Chapter 8 With Question/Answer Animations 1. Chapter Summary Applications of Recurrence Relations Solving Linear Recurrence Relations Homogeneous Recurrence.
Copyright © Cengage Learning. All rights reserved.
Applied Discrete Mathematics Week 9: Relations
Advanced Counting Techniques
Time Complexity Dr. Jicheng Fu Department of Computer Science University of Central Oklahoma.
Analysis of Algorithm Lecture 3 Recurrence, control structure and few examples (Part 1) Huma Ayub (Assistant Professor) Department of Software Engineering.
Chapter 8. Section 8. 1 Section Summary Introduction Modeling with Recurrence Relations Fibonacci Numbers The Tower of Hanoi Counting Problems Algorithms.
Advanced Counting Techniques CSC-2259 Discrete Structures Konstantin Busch - LSU1.
13.2 Recursive Definitions Objective 1) Provide the recursive definition for sequences; 2) Identify the type of a sequence from a recursive definition.
Fall 2015 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1.
Chapter 8 With Question/Answer Animations 1. Chapter Summary Applications of Recurrence Relations Solving Linear Recurrence Relations Homogeneous Recurrence.
14.1 CompSci 102© Michael Frank Today’s topics Recurrence relationsRecurrence relations –Stating recurrences –LiHoReCoCo –Divide & conquer –Master’s method.
Proofs, Recursion and Analysis of Algorithms Mathematical Structures for Computer Science Chapter 2 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesProofs,
CSE 2813 Discrete Structures Recurrence Relations Section 6.1.
R. Johnsonbaugh Discrete Mathematics 7 th edition, 2009 Chapter 7 Recurrence Relations Instructor Tianping Shuai.
15.1 CompSci 102© Michael Frank Today’s topics Recurrence relationsRecurrence relations –Stating recurrences –LiHoReCoCo Reading: Sections Reading:
Module #17: Recurrence Relations Rosen 5 th ed., §
Based on Rosen, Discrete Mathematics & Its Applications, 5e Prepared by (c) Michael P. Frank Modified by (c) Haluk Bingöl 1/18 Module.
Chapter 7 Advance Counting Techniques. Content Recurrence relations Generating function The principle of inclusion-exclusion.
Section 2.4. Section Summary Sequences. Examples: Geometric Progression, Arithmetic Progression Recurrence Relations Example: Fibonacci Sequence Summations.
Module #1 - Logic 1 Based on Rosen, Discrete Mathematics & Its Applications. Prepared by (c) , Michael P. Frank and Modified By Mingwu Chen Recurrence.
Chapter 8 With Question/Answer Animations. Chapter Summary Applications of Recurrence Relations Solving Linear Recurrence Relations Homogeneous Recurrence.
Advanced Counting Techniques CSC-2259 Discrete Structures Konstantin Busch - LSU1.
Discrete Mathematics Recurrence Relations Chapter 5 R. Johnsonbaugh
CHAPTER TWO RECURRENCE RELATION
Agenda Lecture Content:  Recurrence Relations  Solving Recurrence Relations  Iteration  Linear homogenous recurrence relation of order k with constant.
ADVANCED ALGORITHMS REVIEW OF ANALYSIS TECHNIQUES (UNIT-1)
Discrete Mathematics Lecture # 22 Recursion.  First of all instead of giving the definition of Recursion we give you an example, you already know the.
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.
Advanced Algorithms Analysis and Design By Dr. Nazir Ahmad Zafar Dr Nazir A. Zafar Advanced Algorithms Analysis and Design.
Advanced Counting Techniques
Discrete Math For Computing II. Contact Information B. Prabhakaran Department of Computer Science University of Texas at Dallas Mail Station EC 31, PO.
Advanced Algorithms Analysis and Design By Dr. Nazir Ahmad Zafar Dr Nazir A. Zafar Advanced Algorithms Analysis and Design.
CSG523/ Desain dan Analisis Algoritma
CSG523/ Desain dan Analisis Algoritma
CMSC Discrete Structures
Modeling with Recurrence Relations
Introduction to the Design and Analysis of Algorithms
Proofs, Recursion and Analysis of Algorithms
A0=0 a1=2 an a2=6 an-1 a3=12 a4=20 a2 a1 a0.
COMP108 Algorithmic Foundations Divide and Conquer
UNIT-6 Recurrence Relations
Class Notes 7: High Order Linear Differential Equation Homogeneous
A second order ordinary differential equation has the general form
Module #17: Recurrence Relations
Ch 5.2: Series Solutions Near an Ordinary Point, Part I
Copyright © Cengage Learning. All rights reserved.
Module #17: Recurrence Relations
Recursion and Recurrence Relations
CS 2210 Discrete Structures Advanced Counting
CMSC Discrete Structures
Solving Recurrence Relations
1A Recursively Defined Functions
CMSC Discrete Structures
Recurrence Relations Discrete Structures.
Chapter 7 Advanced Counting Techniques
Fundamentals of the Analysis of Algorithm Efficiency
Recurrence Relations (RRs)
Recurrence Relations Rosen 5th ed., §6.2 5/22/2019
ICS 253: Discrete Structures I
Presentation transcript:

Introduction to Recurrence Relations 12 Introduction to Recurrence Relations Discrete Mathematics: A Concept-based Approach

The concept of recurrence relations deals with recursive definitions of mathematical functions or sequences. Solving a recurrence relation involves, in finding "closed form“ solution of the function. Recurrence relations are a fundamental mathematical tool since they can be used to represent mathematical functions/sequences that cannot be easily represented non-recursively. An example, is the Fibonacci sequence. Recurrence relations are largely employed in the design and analysis of algorithms. Discrete Mathematics: A Concept-based Approach

Concept of Recurrence relation : A recurrence relation relates the nth term of a sequence to some of its preceding terms. Consider a function a(n), which is a sequence of terms a0 , a1, … an-1. The term an depends upon the previous terms a0 , a1, … an-1. This way of study is called recurrence relation or difference equations, which is considered discrete counterpart to what is studied in differential equations. The recurrence relations can be adapted to suit the needs of particular counting problems. Example: The recurrence relation that defines the famous Fibonacci sequence 1, 1, 2, 3, 5, 8, 13, …… is given by f(n) = f(n-1) + f(n-2) with initial conditions f(1) = 1, f(0) = 1. Discrete Mathematics: A Concept-based Approach

General Solution: The general solution to the recurrence relation is given as an+1 = d an, where (n  0), d is a constant and a0 = A is unique constant. Given a particular recurrence relation and certain initial conditions, we are supposed to devise a formula for the nth term. Consider the recurrence relation of the form an = r an-1 + s an-2 + f(n) where, r and s are constants and f(n) is some function of n. This type of recurrence relation is called second order linear recurrence relation with constant coefficients. If f(n) = 0, the recurrence relation is called homogeneous. Discrete Mathematics: A Concept-based Approach

Consider the homogeneous recurrence relation an - r an-1 - s an-2 = 0 Consider the homogeneous recurrence relation an - r an-1 - s an-2 = 0. We associate the quadratic equation x2 –rx –s = 0 with the above and is called the characteristic polynomial of the recurrence relation. Its roots are called the characteristics roots of the recurrence relation. For example, the recurrence relation an = 5 an-1 - 6 an-2 has the characteristic equation x2 -5x + 6 = 0 and the characteristic roots are 2 and 3. If x1 and x2 are the roots of the characteristic polynomial x2 –rx –s = 0, then the solution of the recurrence relation an = r an-1 + s an-2, for (n ≥ 2) is expressed as an = c1x1n + c2x2n if x1 ≠ x2 ( for complex roots also i.e. x = a + ib ) = (c1 + c2 n) xn if x1 = x2 = x . c1 and c2 are arbitrary constants determined by initial conditions.0 Discrete Mathematics: A Concept-based Approach

Example: A bank pays 6% interest on savings, compounding the interest monthly. If Shankar deposits Rs 1000 on the first day of May, how much will this deposit be worth after a year later? Solution: The annual interest is 6%, so the monthly interest rate is 6%/12 = 0.5% = 0.005. For 0 ≤ n ≤ 12, let Pn denote the value of Shankar’s deposit after n months. We can write the relation as under. Pn+1 = Pn + (0.005)Pn . Here the term (0.005)Pn is the interest earned on Pn during the month (n+1), for 0 ≤ n ≤ 11 and P0 = Rs 1000. The relation Pn+1 = (1 + 0.005)Pn , Pn = P0 (1.005)n = 1000(1.005)n. The deposit of Shankar at the end of one year is Rs 1061.68. Discrete Mathematics: A Concept-based Approach

Example : A particle is moving in the horizontal direction Example : A particle is moving in the horizontal direction. The distance it travels in each second is equal to 3 times the distance it traveled in the previous second. If an –denotes the position of the particle in the n-th second, determine an ,given that a0 = 3, a3= 10. Solution: Let ar , ar+1 , ar+2 be the positions of the particle in the n-th (n+1)th, and (n+2) th seconds of its motion. Then by the problem ar+2 – ar+1= 3 ( ar+1 - ar). ar+2 –4 ar+1+ 3 ar+1 +3 ar= 0.The characteristic equation is given by m2 - 4m +3 = 0.. m = 1,3.The solution is given by an = c1 (1)n c2 (3)n. Using initial conditions to determine the arbitrary constants, we get c1 = 71/26 , c2 = 7/26. The solution is given by an = 71/26 (1)n + 7/26 (3)n = The distance traveled by a particle in n-th second. Discrete Mathematics: A Concept-based Approach

Non-homogeneous Recurrence Relations: The general form of linear non-homogeneous recurrence relation is given by Where c1,c2, ----ck are constants. The corresponding homogeneous recurrence relation is, The general solution to an inhomogeneous linear recurrence relation takes the form of a particular solution added to an arbitrary linear combination of solutions to the associated homogeneous linear recurrence relation .Once the homogeneous equation has been solved it is relatively easy to find the general solution of the inhomogeneous equation. Discrete Mathematics: A Concept-based Approach

Method of undetermined co-efficient: The following rules helps to find particular solutions in all possible cases. If k– is not a root of the characteristic equation , the particular solution is obtained of the form . If and 1- is not a root of homogeneous recurrence relation, the particular solution is obtained in the form . Discrete Mathematics: A Concept-based Approach

If g(n) = kn and k – is not a root of characteristic equation the particular solution is obtained in the form . If where k- is a root of characteristic equation repeated l-times, the particular solution is obtained in the form If and 1- is a root of characteristic equation repeated l-times, the particular solution is obtained in the form . If g(n) = kn where k- is a root of characteristic equation repeated l-times then particular solution is given an = d0 nl kn. Discrete Mathematics: A Concept-based Approach

Example: Find the general solution of The characteristics equation r (r+5) – 2 (r+5) = 0, r = 2, -5. The solution due to homogeneous equation. anh = c1 (2)n + c2 (-5)n. Let the particular solution be anp = A + B n + Cn2 . Substituting particular solution in the recurrence relation (I). Discrete Mathematics: A Concept-based Approach

Rearranging the terms. Equating the coefficients of powers of n we get A + Bn + C n2 +3 [A + B(n-1) +C(n-1)2] – 10[ A + B (n-2) + C (n-2)2] = n2 +n +1. Rearranging the terms. 6A + 17B - 37C + (-6B +34 C ) n – 6 C n2 = 1 + n + n2 Equating the coefficients of powers of n we get -6A + 17 B-37 C = 1; coefficient of n0 -6B + 34 C = 1 : coefficient of n1 -6C = 1: coefficient of n2 Solving we get The particular solution is given by Discrete Mathematics: A Concept-based Approach

The General solution is given by Discrete Mathematics: A Concept-based Approach

Tower of Hanoi: The Tower of Hanoi is a neat little puzzle invented by the French mathematician Édouard Lucas in 1883. We are given a tower of r disks, initially stacked in decreasing size on one of three pegs. The objective is to transfer an entire tower to one of the other pegs, moving only one disk at a time and never moving a larger one onto a smaller. What is the minimum number of moves required?. It is shown in below. Discrete Mathematics: A Concept-based Approach

Solution: Let Tn be the minimum number of moves that will transfer n disks from one peg to another under Lucas’s rules. It is advantageous to look at small cases first. It is easy to see that T1 = 1 and T2 = 3. Here is one of the methods to transfer n (n ≥ 2) disks: We first transfer the (n – 1) smallest to a different peg (requiring at least Tn − 1 moves), then move the largest (requiring one move), and finally transfer the (n−1) smallest back onto the largest (requiring at least another Tn −1 moves). It follows that Tn ≤ 2Tn − 1 + 1. We now show that there can be no shorter way. No matter what method we use to transfer the disks, at some point we must move the largest disk. Discrete Mathematics: A Concept-based Approach

When we do, then the other n − 1 smaller disks must be on a single peg, and it must have taken at least Tn − 1 moves to put them there. After moving the largest disk, we must transfer the (n – 1) smaller disks (which must again be on a single peg) back onto the largest; this too requires at least Tn − 1 moves. Hence Tn ≥ 2Tn − 1+1. Thus, we have the recurrence relation Tn = 2Tn − 1+1 with initial condition T1 = 1. We shall show later that Tn = 2n − 1 for n = 1, 2, .... Discrete Mathematics: A Concept-based Approach

Summary: The recurrence relations are the extensions of recursive functions and are the useful mathematical concepts in computer science while analyzing the algorithms. Divide and conquer algorithms are analyzed based on recurrence relations. Some of the best-known difference equations have their origins in the attempt to model population dynamics. For example, the Fibonacci numbers were once used as a model for the growth of a rabbit population. In digital signal processing ,recurrence relations can model feedback in a system, where outputs at one time become inputs for future time. These arise in infinite impulse response (IIR) digital filters. Discrete Mathematics: A Concept-based Approach