Discrete Math For Computing II. Contact Information B. Prabhakaran Department of Computer Science University of Texas at Dallas Mail Station EC 31, PO.

Slides:



Advertisements
Similar presentations
Week 6 - Wednesday CS322.
Advertisements

Chapter Recurrence Relations
Fall 2002CMSC Discrete Structures1 Now it’s Time for… RecurrenceRelations.
section 6.2 Solving Recurrence Relations
CS 2210 (22C:19) Discrete Structures Advanced Counting
Discrete Structures Chapter 6 Recurrence Relations
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.
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.
Chapter 8 With Question/Answer Animations 1. Chapter Summary Applications of Recurrence Relations Solving Linear Recurrence Relations Homogeneous Recurrence.
1 Linear Recurrence Relations Part I Jorge Cobb The University of Texas at Dallas.
Applied Discrete Mathematics Week 9: Relations
7.2 Solving Recurrence Relations. Definition 1 (p. 460)- LHRR-K Def: A linear homogeneous recurrence relations of degree k with constant coefficients.
Advanced Counting Techniques
Jessie Zhao Course page: 1.
Chapter 8. Section 8. 1 Section Summary Introduction Modeling with Recurrence Relations Fibonacci Numbers The Tower of Hanoi Counting Problems Algorithms.
Chap. 7 (c) , Michael P. Frank1 Chapter 7: Advanced Counting Techniques.
Copyright © Cengage Learning. All rights reserved. CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION.
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.
4.6.2 Exponential generating functions
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.
Recurrence Relation. Outline  What is a recurrence relation ?  Solving linear recurrence relations  Divide-and-conquer algorithms and recurrence relations.
CSE 2813 Discrete Structures Recurrence Relations Section 6.1.
Module #20 - Recurrences 1 Ch. 7 Recurrence Relations Rosen 6 th ed., §§7.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., §
Solving Second-Order Recursive Relations Lecture 36 ½ Section 8.3 Wed, Apr 19, 2006.
RECURRENCE Sequence Recursively defined sequence
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.
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.
after UCI ICS/Math 6A, Summer AdvancedCounting -1 Recurrence Relations (RRs) A “Recurrence Relation”
Fall 2015 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1.
Advanced Counting Techniques CSC-2259 Discrete Structures Konstantin Busch - LSU1.
Chapter 6.1: Recurrence Relations Discrete Mathematical Structures: Theory and Applications.
Module #20 - Recurrences Solving Recurrences Rosen 6 th ed., §7.2.
Discrete Mathematics Recurrence Relations Chapter 5 R. Johnsonbaugh
22C:19 Discrete Math Advanced Counting Fall 2010 Sukumar Ghosh.
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.
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.
Recurrence Relations. Outline Recurrence relationsSolving recurrence relationsRecurrence and Divide-and-conquer algorithmsGenerating functions
RECURRENCE Sequence Recursively defined sequence
Mathematical Analysis of Recursive Algorithm CSG3F3 Lecture 7.
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
MATH10001 Project 3 Difference Equations 1
CMSC Discrete Structures
Modeling with Recurrence Relations
Introduction to Recurrence Relations
UNIT-6 Recurrence Relations
Module #17: Recurrence Relations
Module #17: Recurrence Relations
Recursion and Recurrence Relations
CS 2210 Discrete Structures Advanced Counting
CMSC Discrete Structures
Solving Recurrence Relations
CMSC Discrete Structures
Recurrence Relations Discrete Structures.
Chapter 7 Advanced Counting Techniques
Recurrence Relations Rosen 5th ed., §6.2 5/22/2019
ICS 253: Discrete Structures I
Presentation transcript:

Discrete Math For Computing II

Contact Information B. Prabhakaran Department of Computer Science University of Texas at Dallas Mail Station EC 31, PO Box Richardson, TX Phone: ; Fax: URL: Office: ES Office Hours: 1-2pm Tuesdays, Thursdays Other times by appointments through Announcements: Made in class and on course web page. TA: TBA.

Example Applications Growth of bank account Initial Amount P 0 =$10,000 After n Years= P n Compound Interest I = 11% Soln: P n =P n-1 +(I/100)P n-1 =(1.11)P n-1 Using Iteration we get, P n =(1.11) n P 0 i.e P 30 =(1.11) 30 10,000=$228,922.97

Example Application Rabbits and Fibonacci Numbers Growth of rabbit population in which each rabbit yields 1 new one every period starting 2 periods after its birth. P n = P n−1 + P n−2 (Fibonacci relation)

Classic Tower of Hanoi Example Problem: Get all disks from peg 1 to peg 2. – Only move 1 disk at a time. – Never set a larger disk on a smaller one.

Hanoi Recurrence Relation Let H n = # moves for a stack of n disks. Optimal strategy: – Move top n−1 disks to spare peg. (H n−1 moves) – Move bottom disk. (1 move) – Move top n−1 to bottom disk. (H n−1 moves) Note: H n = 2H n−1 + 1

Why is H n = 2H n – Only move 1 disk at a time. – Never set a larger disk on a smaller one.

Solving Tower of Hanoi RR H n = 2 H n−1 + 1 = 2 (2 H n−2 + 1) + 1 = 2 2 H n− = 2 2 (2 H n−3 + 1) = 2 3 H n− … = 2 n−1 H n−2 + … = 2 n−1 + 2 n−2 + … (since H 1 =1) = 2 n − 1

§6.2: Solving Recurrences Definition: A linear homogeneous recurrence relation of degree k with constant coefficient is a recurrence relation of the form a n = c 1 a n−1 + … + c k a n−k, where the c i are all real, and c k ≠ 0. The solution is uniquely determined if k initial conditions a 0 …a k−1 are provided

§6.2: Solving Recurrences.. Linear?: Right hand side is sum of multiples of previous terms. Homogenous?: No terms that are NOT multiples of the a j s. Degree?: k-degree since previous k terms are used.

Solving with const. Coefficients Basic idea: Look for solutions of the form a n = r n, where r is a constant. This requires the characteristic equation: r n = c 1 r n−1 + … + c k r n−k, i.e., r k − c 1 r k−1 − … − c k = 0 (Dividing both sides by r n-k and subtracting right hand side from left). The solutions (characteristic roots) can yield an explicit formula for the sequence.

Solving …… Theorem1: Let c 1 and c 2 be real numbers. Suppose that r 2 − c 1 r − c 2 = 0 has two distinct roots r 1 and r 2. Then the sequence {a n } is a solution of the recurrence relation a n = c 1 a n−1 + c 2 a n−2 if and only if a n = α 1 r 1 n + α 2 r 2 n for n≥0, where α 1, α 2 are constants.

Example Solve the recurrence a n = a n−1 + 2a n−2 given the initial conditions a 0 = 2, a 1 = 7. An = rn  rn = r n-1 + 2rn-2  r2 = r +2 Solution: Use theorem 1 – c 1 = 1, c 2 = 2 – Characteristic equation: r 2 − r − 2 = 0 – Solutions: r = [−(−1)±((−1) 2 − 4·1·(−2)) 1/2 ] / 2·1 = (1±9 1/2 )/2 = (1±3)/2, so r = 2 or r = −1. – So a n = α 1 2 n + α 2 (−1) n.

Example Continued… To find α 1 and α 2, solve the equations for the initial conditions a 0 and a 1 : a 0 = 2 = α α 2 (−1) 0 a 1 = 7 = α α 2 (−1) 1 Simplifying, we have the pair of equations: 2 = α 1 + α 2 7 = 2α 1 − α 2 which we can solve easily by substitution: α 2 = 2−α 1 ; 7 = 2α 1 − (2−α 1 ) = 3α 1 − 2; 9 = 3α 1 ; α 1 = 3; α 2 = -1. Final answer:a n = 3·2 n − (−1) n