Jessie Zhao Course page: 1.

Slides:



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

section 6.2 Solving Recurrence Relations
Permutations and Combinations Rosen 4.3. Permutations A permutation of a set of distinct objects is an ordered arrangement these objects. An ordered arrangement.
Counting Chapter 6 With Question/Answer Animations.
CS 2210 (22C:19) Discrete Structures Advanced Counting
CSE115/ENGR160 Discrete Mathematics 04/19/12 Ming-Hsuan Yang UC Merced 1.
CSE115/ENGR160 Discrete Mathematics 04/17/12
CSE115/ENGR160 Discrete Mathematics 04/21/11 Ming-Hsuan Yang UC Merced 1.
Recursion.
Sequence A list of objects arranged in a particular order.
1 Section 6.1 Recurrence Relations. 2 Recursive definition of a sequence Specify one or more initial terms Specify rule for obtaining subsequent terms.
Recursive Definitions Rosen, 3.4 Recursive (or inductive) Definitions Sometimes easier to define an object in terms of itself. This process is called.
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.
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
Exam 1 Review 5.1, , 8.1, 8.2.
Rev.S08 MAC 1140 Module 12 Introduction to Sequences, Counting, The Binomial Theorem, and Mathematical Induction.
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.
13.2 Recursive Definitions Objective 1) Provide the recursive definition for sequences; 2) Identify the type of a sequence from a recursive definition.
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.
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.
Based on Rosen, Discrete Mathematics & Its Applications, 5e Prepared by (c) Michael P. Frank Modified by (c) Haluk Bingöl 1/18 Module.
CSCI 115 Chapter 3 Counting. CSCI 115 §3.1 Permutations.
Sequences and Summations
Chapter 7 Advance Counting Techniques. Content Recurrence relations Generating function The principle of inclusion-exclusion.
Recurrence Relations: Selected Exercises
1 Binomial Coefficients CS 202 Epp, section ??? Aaron Bloomfield.
Chapter 5 The Binomial Coefficients
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”
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.
Module #20 - Recurrences Solving Recurrences Rosen 6 th ed., §7.2.
Week 6 - Friday.  What did we talk about last time?  Solving recurrence relations.
The Pigeonhole Principle. The pigeonhole principle Suppose a flock of pigeons fly into a set of pigeonholes to roost If there are more pigeons than pigeonholes,
Chapter 8 Recursion. 8.3 More Recurrence Second-Order Recurrence Definition – A second-order linear homogeneous recurrence relation with constant coefficients.
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
CSCI 115 Chapter 3 Counting. CSCI 115 §3.1 Permutations.
CompSci 102 Discrete Math for Computer Science March 13, 2012 Prof. Rodger Slides modified from Rosen.
Section 6.4. Powers of Binomial Expressions Definition: A binomial expression is the sum of two terms, such as x + y. (More generally, these terms can.
Homogeneous Linear Recurrences To solve such recurrences we must first know how to solve an easier type of recurrence relation: DEF: A linear recurrence.
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.
Discrete Math For Computing II. Contact Information B. Prabhakaran Department of Computer Science University of Texas at Dallas Mail Station EC 31, PO.
Recurrence Relations: Selected Exercises. Copyright © Peter Cappello2 Exercise 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded.
CMSC Discrete Structures
Advanced Counting Techniques
Modeling with Recurrence Relations
Applied Discrete Mathematics Week 11: Relations
A Brief Summary for Exam 2
CS 2210 Discrete Structures Advanced Counting
CMSC Discrete Structures
CMSC Discrete Structures
Recurrence Relations Discrete Structures.
Chapter 7 Advanced Counting Techniques
ICS 253: Discrete Structures I
Presentation transcript:

Jessie Zhao Course page: 1

 No more TA office hours  My office hours will be the same ◦ Monday 2-4pm  Solutions for Test 3 is available online.  Check your previous test and assignment marks on line ◦ By the last four digits of your student ID ◦ Available till Dec 10 th.  Assignment 7 will be available to pick up during my office hours  Final Exam: ◦ Coverage: include all materials ◦ Closed book exam 2

 Recall: P(n,r) vs C(n,r)  C(n,r) is also called binomial coefficient.  How many bit strings of length 10 contain ◦ exactly four 1s? C(10,4)=210 ◦ at most three 1s? C(10,0)+C(10,1)+C(10,2)+C(10,3)=176 ◦ at least 4 1s? =848 ◦ an equal number of 0s and 1s? C(10,5)=252 3

 C(n,r) occurs as coefficients in the expansion of (a+b) n  Combinatorial proof: refer to textbook 4

 Examples: ◦ What is the expansion of (x+y)⁴? x 4 +4x 3 y+6x 2 y 2 +4xy 3 +y 4 ◦ What is the coefficient of x 12 y 13 in the expansion of (2x-3y) 25 ? -(25!*2 12 *3 13 )/(13!12!) 5

 Proof: Use the Binomial Theorem with x=y=1 6

C(n+1,k) = C(n,k-1) + C(n,k) for 1≤ k ≤n Total number of subsets = number including + number not including C(n+1,k) = C(n,k-1) + C(n,k) 7

8 C(0,0) C(1,0) C((1,1) C(2,0)C(2,1)C(2,2) C(3,0)C(3,1)C(3,2)C(3,3) C(4,0)C(4,1)C(4,2)C(4,3)C(4,4) n k

 An easy counting problem: How many bit strings of length n have exactly three zeros?  A more difficult counting problem: How many bit strings of length n contain three consecutive zeros? 9

 A recurrence relation (sometimes called a difference equation) is an equation which defines the nth term in the sequence in terms of (one ore more) previous terms  A sequence is called a solution of a recurrence relation if its terms satisfy the recurrence relation  Recursive definition vs. recurrence relation? 10

 Examples: ◦ Fibonacci sequence: a n =a n-1 +a n-2 ◦ Pascal’s identity: C(n+1,k)=C(n,k)+C(n,k-1)  Normally there are infinitely many sequences which satisfy the equation. These solutions are distinguished by the initial conditions. 11

 Suppose the interest is compounded at 11% annually. If we deposit $10,000 and do not withdraw the interest, find the total amount invested after 30 years. ◦ Recurrence relation: P n =P n P n-1 ◦ Initial condition: a 0 =10,000 ◦ Answer: P 30 =10000x(1.11) 30 12

 Find a recurrence relation for the number of bit strings of length n that do not have two consecutive 0s. ◦ a n : # strings of length n that do not have two consecutive 0s. ◦ Case 1: # strings of length n ending with 1 -- a n-1 ◦ Case 2: # strings of length n ending with a n-2 ◦ This yields the recurrence relation a n =a n-1 +a n-2 for n≥3 ◦ Initial conditions: a 1 =2, a 2 =3 13

 Find a recurrence relation for the number of bit strings of length n which contain 3 consecutive 0s.  Let S be the set of strings with 3 consecutive 0s. First define the set inductively. ◦ Basis: 000 is in S ◦ Induction (1): if w∈S, u∈{0,1}*, v∈{0,1}* then ◦ uwv∈S Adequate to define S but NOT for counting. DO NOT count the same string twice. 14

 Find a recurrence relation for the number of bit strings of length n which contain 3 consecutive 0s.  Let S be the set of strings with 3 consecutive 0s. First define the set inductively. ◦ Induction (2): if w∈S, u∈{0,1}*, then ◦ 1w∈S, 01w∈S, 001w∈S, 000u∈S  This yields the recurrence a n =a n-1 +a n-2 +a n-3 +2 n-3  Initial conditions: a 3 =1,a 4 =3,a 5 =8 15

 Solve recurrence relations: find a non- recursive formula for {a n }  Easy: for a n =2a n-1, a 0 =1, the solution is a n =2 n (back substitute)  Difficult: for a n =a n-1 +a n-2, a 0 =0, a 1 =1, how to find a solution? 16

 Linear Homogeneous Recurrence Relations of degree k with constant coefficients ◦ Solving a recurrence relation can be very difficult unless the recurrence equation has a special form a n = c 1 a n-1 +c 2 a n-2 +… +c k a n-k, where c 1, c 2… c k ∈ R and c k ≠0 ◦ Single variable: n ◦ Linear: no a i a j, a i ², a i ³... ◦ Constant coefficients: c i ∈R ◦ Homogeneous: all terms are multiples of the a i s ◦ Degree k: c k ≠0 17

 1. Put all a i ’s on LHS of the equation: a n - c 1 a n-1 - c 2 a n-2 - … - c k a n-k = 0  2. Assume solutions of the form a n =r n, where r is a constant  3. Substitute the solution into the equation: r n - c 1 r n-1 -c 2 r n-2 -…- c k r n-k =0. Factor out the lowest power of r: r k - c 1 r k-1 -c 2 r k-2 -…- c k =0 (called the characteristic equation)  4. Find the k solutions r 1, r 2,..., r k of the characteristic equation (characteristic roots of the recurrence relation)  5. If the roots are distinct, the general solution is a n =α 1 r 1 ⁿ+ α 2 r 2 ⁿ+…+ α k r k ⁿ  6. The coefficients α 1, α 2,..., α k are found by enforcing the initial conditions 18 a n = c 1 a n-1 +c 2 a n-2 +… +c k a n-k where c 1, c 2… c k ∈ R and c k ≠0

 Example: Solve a n+2 =3a n+1, a 0 =4 ◦ a n+2 -3a n+1 =0 ◦ r n r n-1 =0, i.e. r-3=0 ◦ Find the root of the characteristic equation r 1 =3 ◦ Compute the general solution a n =α 1 r 1 ⁿ= α 1 3 ⁿ ◦ Find α 1 based on the initial conditions: a 0 = α 1 ( 3 0 ). Then α 1 =4. ◦ Produce the solution: a n =4( 3 ⁿ ) 19

 Example: Solve a n =3a n-2, a 0 =a 1 =1 ◦ a n - 3a n-2 =0 ◦ r n - 3 r n-2 =0 =0, i.e. r 2 -3=0 ◦ Find the root of the characteristic equation r 1 =√3, r 2 =-√3 ◦ Compute the general solution a n = α 1 (√3) n + α 2 (-√3) n ◦ Find α 1 and α 2 based on the initial conditions: a 0 = α 1 (√3) 0 + α 2 (-√3) 0 = α 1 + α 2 =1 a 1 = α 1 (√3) 1 + α 2 (-√3) 1 =√3 α 1 -√3 α 2 =1 ◦ Solution: a n =(1/2+1/2√3)(√3) n +(1/2-1/2√3)(-√3) n 20

 Example: Find an explicit formula for the Fibonacci numbers ◦ f n -f n-1 -f n-2 =0 ◦ r n – r n-1 -r n-2 =0, i.e. r 2 -r-1=0 ◦ Find the root of the characteristic equation r 1 =(1+√5)/2, r 2 =(1-√5)/2 ◦ Compute the general solution f n =α 1 (r 1 ) n +α 2 (r 2 ) n ◦ Find α 1 and α 2 based on the initial conditions: α 1 =1/√5 α 2 =-1/√5 ◦ Solution: f n =1/√5·((1+√5)/2) n - 1/√5·((1-√5)/2) n 21