Download presentation
Presentation is loading. Please wait.
1
ICS 253: Discrete Structures I
King Fahd University of Petroleum & Minerals Information & Computer Science Department ICS 253: Discrete Structures I Advanced Counting Techniques
2
Reading Assignment K. H. Rosen, Discrete Mathematics and Its Applications, 6th Ed., McGraw-Hill, 2006. Chapter 7 (Sections 7.1 and 7.2 up to the end of page 464)
3
Section 7.1: Recurrence Relations
A recurrence relation for the sequence {an} is an equation that expresses an in terms of one or more of the previous terms of the sequence, namely, a0, a1, , an – 1, for all integers n with n n0, where n0 is a nonnegative integer. A sequence is called a solution of a recurrence relation if its terms satisfy the recurrence relation.
4
Examples Q1 pp456: Find the first five terms of the sequence defined by each of these recurrence relations and initial conditions. a) an = 6an – 1, a0 = 2 c) an = an – 1 + 3an – 2, a0 = 1, al = 2 e) an = an – 1 + an – 3, a0 = 1, al = 2, a2 = 0
5
Examples Q4 pp 456: Show that the sequence {an} is a solution of the recurrence relation an = – 3an – 1 + 4an – 2 if a) an = 0. b) an = 1. c) an = (– 4)n. d) an = 2(– 4)n + 3.
6
Examples 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 be in the account after 30 years?
7
Examples Find a recurrence relation and give initial conditions for the number of bit strings of length n that do not have two consecutive 0s. How many such bit strings are there of length five?
8
Examples Q23, pp458: Find a recurrence relation for the number of bit strings of length n that contain a pair of consecutive 0s. What are the initial conditions? How many bit strings of length seven contain two consecutive 0s?
9
Examples A computer system considers a string of decimal digits a valid codeword if it contains an even number of 0 digits. For instance, is valid, whereas is not valid. Let an be the number of valid n-digit codewords. Find a recurrence relation for an.
10
Examples Find a recurrence relation for Cn, the number of ways to parenthesize the product of n + 1 numbers, x0 . xl . x xn , to specify the order of multiplication. What is C2? C3? This sequence is called the Catalan Numbers.
11
Section 7.2:Solving Linear Recurrence Equations
We will only consider solving linear homogeneous recurrence equations with constant coefficients. Linear nonhomogeneous recurrence relations with constant coefficients are ommitted. It will be enough for us, especially those related to estimating the complexity of recursive algorithms.
12
Solving Linear Homogeneous Recurrence Relations with Constant Coefficients
A linear homogeneous recurrence relation of degree k with constant coefficients is a recurrence relation of the form where c1, c2, , ck are real numbers, and ck 0.
13
Solving Linear Homogeneous Recurrence Relations with Constant Coefficients
Theorem: Let c1, c2, , ck be real numbers. Suppose that the characteristic equation has k distinct roots r1, r2, , rk. Then a sequence {an} is a solution of the recurrence relation if and only if for n=0,1, 2, … where 1, 2, , k are constants.
14
Example 1 Q3, pp 471: Solve these recurrence relations together with the initial conditions given. (d) an = 4an – 1 – 4an – 2 for n 2, a0 = 6, a1 = 8.
15
Example 2 Q3, pp 471: Solve these recurrence relations together with the initial conditions given. (f) an = 4an – 2 for n 2, a0 = 0, a1 = 4.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.