1 CSE 20 Lecture 12: Analysis of Homogeneous Linear Recursion CK Cheng May 5, 2011.

Slides:



Advertisements
Similar presentations
Discrete Mathematics Lecture 8 Alexander Bukharovich New York University.
Advertisements

CS 2210 (22C:19) Discrete Structures Advanced Counting
1 Copyright M.R.K. Krishna Rao Solving Recurrence Relations Steps for solving a linear homogeneous recurrence relation of degree 2 : Step #1.
Recursion Sections 7.1 and 7.2 of Rosen Fall 2008 CSCE 235 Introduction to Discrete Structures Course web-page: cse.unl.edu/~cse235 Questions:
Discrete Structures Chapter 6 Recurrence Relations
Analysis of Recursive Algorithms
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.
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.
Expressing Sequences Explicitly By: Matt Connor Fall 2013.
Applied Discrete Mathematics Week 9: Relations
Advanced Counting Techniques
Sequences and Series (T) Students will know the form of an Arithmetic sequence.  Arithmetic Sequence: There exists a common difference (d) between each.
Lecture 9. Arithmetic and geometric series and mathematical induction
Chapter 8. Section 8. 1 Section Summary Introduction Modeling with Recurrence Relations Fibonacci Numbers The Tower of Hanoi Counting Problems Algorithms.
CSE 20 Lecture 12 Induction CK Cheng 1. Induction Outlines Introduction Theorem Examples: The complexity calculation – Tower of Hanoi – Merge Sort – Fibonacci.
Chapter 8 With Question/Answer Animations 1. Chapter Summary Applications of Recurrence Relations Solving Linear Recurrence Relations Homogeneous Recurrence.
Recurrence Relation. Outline  What is a recurrence relation ?  Solving linear recurrence relations  Divide-and-conquer algorithms and recurrence relations.
Module #17: Recurrence Relations Rosen 5 th ed., §
Solving Second-Order Recursive Relations Lecture 36 ½ Section 8.3 Wed, Apr 19, 2006.
RECURRENCE Sequence Recursively defined sequence
Principles of Programming Chapter 11: Recursive Function  In this chapter, you will learn about  Recursion function 1 NI S1 2009/10.
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.
9.1 Notes Geometric Mean. 9.1 Notes Arithmetic mean is another term that means the same thing as average. The second do now question could have been,
Advanced Counting Techniques CSC-2259 Discrete Structures Konstantin Busch - LSU1.
1 CSE 20 Lecture 13: Analysis of Recursive Functions CK Cheng.
Module #20 - Recurrences Solving Recurrences Rosen 6 th ed., §7.2.
12/19/ Non- homogeneous Differential Equation Chapter 4.
CHAPTER TWO RECURRENCE RELATION
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.
Asymptotics and Recurrence Equations Prepared by John Reif, Ph.D. Analysis of Algorithms.
CSE 2813 Discrete Structures Solving Recurrence Relations Section 6.2.
Agenda Lecture Content:  Recurrence Relations  Solving Recurrence Relations  Iteration  Linear homogenous recurrence relation of order k with constant.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 223 – Advanced Data Structures Math Review 1.
Infinite Geometric Series Recursion & Special Sequences Definitions & Equations Writing & Solving Geometric Series Practice Problems.
Math 3120 Differential Equations with Boundary Value Problems
RECURRENCE Sequence Recursively defined sequence
Arithmetic and Geometric Sequences. Determine whether each sequence is arithmetic, geometric, or neither. Explain your reasoning. 1. 7, 13, 19, 25, …2.
Ch 4.2: Homogeneous Equations with Constant Coefficients Consider the nth order linear homogeneous differential equation with constant, real coefficients:
1 RECURRENCE 1. Sequence 2. Recursively defined sequence 3. Finding an explicit formula for recurrence relation.
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.
Solving Linear Homogeneous Recurrence Relations ICS 6D Sandy Irani.
Advanced Algorithms Analysis and Design By Dr. Nazir Ahmad Zafar Dr Nazir A. Zafar Advanced Algorithms Analysis and Design.
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
7.2 GEOMETRIC Sequences.
Recursion and Recurrence Relations
Analysis of algorithms
Modeling with Recurrence Relations
3.5 Recurrence Relations.
Sequences Write down the next 3 terms in each sequence:
A Brief Summary for Exam 2
CS 3343: Analysis of Algorithms
Notes Over 11.5 Recursive Rules
Topic 3: Prob. Analysis Randomized Alg.
CS 2210 Discrete Structures Advanced Counting
CMSC Discrete Structures
Solving Recurrence Relations
Applied Discrete Mathematics Week 7: Computation
CMSC Discrete Structures
At the end of this session, learner will be able to:
Recurrence Relations Discrete Structures.
Module 3 Arithmetic and Geometric Sequences
Recurrence Relations.
Module 3 Arithmetic and Geometric Sequences
INTRODUCTION TO ALOGORITHM DESIGN STRATEGIES
Presentation transcript:

1 CSE 20 Lecture 12: Analysis of Homogeneous Linear Recursion CK Cheng May 5, 2011

2 3. Analysis 3.1 Introduction 3.2 Homogeneous Linear Recursion 3.3 Pigeonhole Principle 3.4 Inclusion-Exclusion Principle

3 3.1 Introduction Derive the bound of functions or recursions Estimate CPU time and memory allocation Eg. PageRank calculation Allocation of memory, CPU time, Resource optimization MRI imaging Real time? VLSI design Design automation flow to meet the deadline for tape out? Further Study Algorithm, Complexity

4 3.1 Introduction Derive the bound of functions or recursions Estimate CPU time and memory allocation Example on Fibonacci Sequence: Estimate f n. – Index: – f n :

5 Example: Fibonacci Sequence

6 3.2 Homogeneous Linear Recursion (1) Arithmetic Recursion a, a+d, a+2d, …, a+kd (2) Geometric Recursion a, ar, ar 2, …, ar k (3) Linear Recursion a n = e 1 a n-1 +e 2 a n-2 +…+e k a n-k + f(n)

7 Linear Recursion and Homogeneous Linear Recursion Linear Recursion: There are no powers or products of Homogenous Linear Recursion: A linear recursion with f(n)=0.

8 Solving Linear Recursion Input: Formula and k initial values (1) characteristic polynomial: (2)Find the root of the characteristic polynomial (assuming r i are distinct) (3)Set (4)Determine c i from k initial values

9 Solving Linear Recursion Input: Formula and k initial values (1) characteristic polynomial: Rewrite the formula with n=k Replace a i with x i

10 Solving Linear Recursion Input: Formula and k initial values 2. Find the root of the polynomial Or,

11 Solving Linear Recursion Input: Formula and k initial values 3. Set (assuming that the roots are distinct.) 4. Determine c i from k initial values

12 Solving Linear Recursion Input: Formula and k initial values 3. Set (when the roots are not distinct.) where r i is a root of multiplicity w i

Example on Fibonacci sequence Input: initial values a 0 =0 and a 1 =1; and recursion formula a n =a n-1 +a n-2. Rewrite recursion: a n -a n-1 -a n-2 =0. 1. Characteristic polynomial: x 2 -x-1=0. 2. Roots of the polynomial: Set: a n =c 1 r 1 n +c 2 r 2 n.

Example on Fibonacci sequence Input: initial values a 0 =0 and a 1 =1; and recursion formula a n =a n-1 +a n Determine ci from k initial values a 0 =c 1 r 1 0 +c 2 r 2 0 : c 1 +c 2 =0 a 1 =c 1 r 1 1 +c 2 r 2 1 :c 1 r 1 +c 2 r 2 =1, where 14 Thus, we have

Example 2 Given initial values a 0 =1 and a 1 =1; and recursion formula: a n =a n-1 +2a n-2 Rewrite recursion: a n -a n-1 -2a n-2 =0 1. Characteristic polynomial: x 2 -x-2=0 2. Characteristic roots: r 1 =2 and r 2 = We have a n =c 1 r 1 n +c 2 r 2 n =c 1 2 n +c 2 (-1) n 4. We use two initial values for n=0 and n=1: a 0 =c 1 +c 2 a 1 =c 1 2+c 2 (-1) 15

Example 2 (cont) Two initial values a 0 =c 1 +c 2 :c 1 +c 2 =1 a 1 =2c 1 +(-1)c 2 :2c 1 -c 2 =1 Thus, we have c 1 =2/3, c 2 =1/3. Since a n =c 1 r 1 n +c 2 r 2 n, the formula is a n =2/3*2 n +1/3*(-1) n, 16

Example 3 (identical roots) Given initial values a 0 =1 and a 1 =1; and recursion a n =-2a n-1 -a n-2 Rewrite the recursion: a n +2a n-1 +a n-2 =0 1.Characteristic polynomial: x 2 +2x+1=0 2.Characteristic roots: r 1 =r 2 =-1 3.Formula for roots of multiplicity 2 a n =c 1 r 1 n +c 2 nr 1 n =c 1 (-1) n +c 2 n(-1) n Note the formula is different for roots of multiplicity. 17

Example 3 (identical roots) Given initial values a 0 =1 and a 1 =1; and recursion a n =-2a n-1 -a n-2 4. Two initial conditions: a 0 =c 1 (-1) 0 +c 2 0(-1) 0 =c 1 a 1 =c 1 (-1) 1 +c 2 1(-1) 1 =-c 1 -c 2 with a 0 =1 and a 1 =1 Thus, c 1 = 1 and c 2 = -2. Therefore, a n = (-1) n -2n(-1) n Exercise: verify the sequence a 2, a 3 and a 4. 18