CSE115/ENGR160 Discrete Mathematics 04/19/12 Ming-Hsuan Yang UC Merced 1.

Slides:



Advertisements
Similar presentations
Fall 2002CMSC Discrete Structures1 Now it’s Time for… RecurrenceRelations.
Advertisements

BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS
CS 2210 (22C:19) Discrete Structures Advanced Counting
April 9, 2015Applied Discrete Mathematics Week 9: Relations 1 Solving Recurrence Relations Another Example: Give an explicit formula for the Fibonacci.
CSE115/ENGR160 Discrete Mathematics 04/21/11 Ming-Hsuan Yang UC Merced 1.
CSE115/ENGR160 Discrete Mathematics 04/03/12 Ming-Hsuan Yang UC Merced 1.
Divide-and-Conquer1 7 2  9 4   2  2 79  4   72  29  94  4.
Divide-and-Conquer1 7 2  9 4   2  2 79  4   72  29  94  4.
Recursive Definitions Rosen, 3.4. Recursive (or inductive) Definitions Sometimes easier to define an object in terms of itself. This process is called.
CSE115/ENGR160 Discrete Mathematics 02/21/12
CSE115/ENGR160 Discrete Mathematics 03/22/12 Ming-Hsuan Yang UC Merced 1.
Recursion.
CSE115/ENGR160 Discrete Mathematics 03/31/11
1 Section 3.3 Mathematical Induction. 2 Technique used extensively to prove results about large variety of discrete objects Can only be used to prove.
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.
CSE115/ENGR160 Discrete Mathematics 03/29/11 Ming-Hsuan Yang UC Merced 1.
Induction and recursion
Analysis of Recursive Algorithms October 29, 2014
1 Linear Recurrence Relations Part I Jorge Cobb The University of Texas at Dallas.
Applied Discrete Mathematics Week 9: Relations
Advanced Counting Techniques
Jessie Zhao Course page: 1.
Chapter 6 Mathematical Induction
Discrete Mathematics, 1st Edition Kevin Ferland
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.
Advanced Counting Techniques CSC-2259 Discrete Structures Konstantin Busch - LSU1.
Chapter 4: Induction and Recursion
Section 2.4. Section Summary Sequences. Examples: Geometric Progression, Arithmetic Progression Recurrence Relations Example: Fibonacci Sequence Summations.
Fuw-Yi Yang1 演算法概論 Introduction to Algorithms Department of Computer Science and Information Engineering, Chaoyang University of Technology 朝陽科技大學資工系 Speaker:
1 Recurrences Algorithms Jay Urbain, PhD Credits: Discrete Mathematics and Its Applications, by Kenneth Rosen The Design and Analysis of.
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.
CSE 2813 Discrete Structures Recurrence Relations Section 6.1.
R. Johnsonbaugh Discrete Mathematics 7 th edition, 2009 Chapter 7 Recurrence Relations Instructor Tianping Shuai.
Solving Second-Order Recursive Relations Lecture 36 ½ Section 8.3 Wed, Apr 19, 2006.
Foundations of Discrete Mathematics Chapters 5 By Dr. Dalia M. Gil, Ph.D.
Chapter 2 Mathematical preliminaries 2.1 Set, Relation and Functions 2.2 Proof Methods 2.3 Logarithms 2.4 Floor and Ceiling Functions 2.5 Factorial and.
Sequences and Summations
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.
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. Chapter Summary Applications of Recurrence Relations Solving Linear Recurrence Relations Homogeneous Recurrence.
Sequences and Summations Section 2.4. Section Summary Sequences. – Examples: Geometric Progression, Arithmetic Progression Recurrence Relations – Example:
Advanced Counting Techniques CSC-2259 Discrete Structures Konstantin Busch - LSU1.
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.
1 Section 6.5 Inclusion/Exclusion. 2 Finding the number of elements in the union of 2 sets From set theory, we know that the number of elements in the.
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)
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.
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.
Advanced Counting Techniques
CSE15 Discrete Mathematics 03/01/17
CMSC Discrete Structures
Modeling with Recurrence Relations
Mathematical Induction Recursion
Discrete Math (2) Haiming Chen Associate Professor, PhD
Chapter 5 Induction and Recursion
Applied Discrete Mathematics Week 9: Integer Properties
CMSC Discrete Structures
Solving Recurrence Relations
Applied Discrete Mathematics Week 7: Computation
1A Recursively Defined Functions
CMSC Discrete Structures
Recurrence Relations Discrete Structures.
Mathematical Induction
Chapter 7 Advanced Counting Techniques
ICS 253: Discrete Structures I
Presentation transcript:

CSE115/ENGR160 Discrete Mathematics 04/19/12 Ming-Hsuan Yang UC Merced 1

8.1 Recurrence relations Many counting problems can be solved with recurrence relations Example: The number of bacteria doubles every 2 hours. If a colony begins with 5 bacteria, how many will be present in n hours? Let a n =2a n-1 where n is a positive integer with a 0 =5 2

Recurrence relations A recurrence relation for the sequence {a n } is an equation that expresses an in terms of 1 or more of the previous terms of the sequence, i.e., a 0, a 1, …, a n-1, for all integers n with n≥n 0 where n 0 is a nonnegative integer A sequence is called a solution of a recurrence relation if its terms satisfy the recurrence relation 3

Recursion and recurrence A recursive algorithm provides the solution of a problem of size n in terms of the solutions of one or more instances of the same problem of smaller size When we analyze the complexity of a recursive algorithm, we obtain a recurrence relation that expresses the number of operations required to solve a problem of size n in terms of the number of operations required to solve the problem for one or more instance of smaller size 4

Example Let {a n } be a sequence that satisfies the recurrence relation a n =a n-1 – a n-2 for n=2, 3, 4, … and suppose that a 0 =3 and a 1 =5, what are a 2 and a 3 ? Using the recurrence relation, a 2 =a 1 -a 0 =5-3=2 and a 3 =a 2 -a 1 =2-5=-3 5

Example Determine whether the sequence {a n }, where a n =3n for every nonnegative integer n, is a solution of the recurrence relation a n =2a n-1 – a n-2 for n=2, 3, 4, … Suppose a n =3n for every nonnegative integer n. Then for n ≥2, we have 2a n-1 -a n-2 =2(3(n- 1))-3(n-2)=3n=a n. Thus, {a n } where a n =3n is a solution for the recurrence relation 6

Modeling with recurrence relations Compound interest: Suppose that a person deposits $10,000 in a savings account at a bank yielding 11% per year with interest compounded annually. How much will it be in the account after 30 years? Let P n denote the amount in the account after n years. The amount after n years equals the amount in the amount after n-1 years plus interest for the n-th year, we see the sequence {P n } has the recurrence relation P n =P n P n-1 =(1.11)P n-1 7

Modeling with recurrence relations The initial condition P 0 =10,000, thus P 1 =(1.11)P 0 P 2 =(1.11)P 1 =(1.11) 2 P 0 P 3 =(1.11)P 2 =(1.11) 3 P 0 … P n =(1.11)P n-1 =(1.11) n P 0 We can use mathematical induction to establish its validity 8

Modeling with recurrence relations We can use mathematical induction to establish its validity Assume P n =(1.11) n 10,000. Then from the recurrence relation and the induction hypothesis P n+1 =(1.11)P n =(1.11)(1.11) n 10,000=(1.11) n+1 10, 000 n=30, P 30 =(1.11) 30 10,000=228,

8.2 Solving linear recurrence relations 10

From mathematical induction 11

Linear homogenous recurrence relations with constant coefficients 12 characteristic equation

Theorem 1 13

Example 14

Fibonacci numbers 15

16

17

Recurrence relations Play an important role in many aspects of algorithms and complexity Can be used to – analyze the complexity of divide-and-conquer algorithms (e.g., merge sort) – Solve dynamic programming problems (e.g., scheduling tasks, shortest-path, hidden Markov model) – Fractal 18

8.5 Inclusion-exclusion The principle of inclusion-exclusion: For two sets A and B, the number of elements in the union is defined by |A ⋃B|=|A|+|B|-|A⋂B| Example: How many positive integers not exceeding 1000 are divisible by 7 or 11? 19

Principle of inclusion-exclusion Consider union of n sets, where n is a positive integer Let n=3 20

Principle of inclusion-exclusion Let A 1, A 2, …, A n be finite sets. Then Proof: Prove it by showing that an element in the union is counted exactly once by the right-hand side of the equation Suppose that a is a member of exactly r of the sets A 1, A 2, …, A n where 1 ≤r ≤n This element is counted C(r,1) times by ∑|A i | 21

Principle of inclusion-exclusion It is counted C(r,2) times by ∑|A i ⋂ A j | In general, it is counted C(r,m) times by the summation involving m of the sets A i. Thus, this element is counted exactly C(r,1)-C(r,2)+C(r,3)-…+(-1) r+1 C(r,r) Recall, C(r,0)-C(r,1)+C(r,2)-C(r,3)-…+(-1) r C(r,r)=0 Thus, C(r,1)-C(r,2)+C(r,3)-…+(-1) r+1 C(r,r)=C(r,0)=1 Thus, this element a is counted exactly once by the right hand side 22

Principle of inclusion-exclusion Gives a formula for the number of elements in the union of n sets for every positive integer n There are terms in this formula for the number of elements in the intersection of every nonempty subset of the collection of the n sets. Hence there are 2 n -1 terms in the formula Example: 15 terms 23

Example For the union of 4 sets, there are 15 different terms, one for each nonempty subset of {A 1, A 2, A 3, A 4 } 24