170 likes | 428 Views
5/30/2012 4:32:17 AM. Recurrence Relations. Recurrence RelationsExample: How many bit strings of length n do not contain two consecutive zeros?Example: The number of bacteria in a colony doubles every hour. If a colony begins with 5 bacteria, how many will be present in n hours?Definition. A
E N D
1. CpE602: Applied Discrete Mathematics Advanced Counting Techniques:
Recurrence Relations
Solving Linear Recurrence Relations
Generating Functions
2. 6/2/2012 1:29:47 AM Recurrence Relations Recurrence Relations
Example: How many bit strings of length n do not contain two
consecutive zeros?
Example: The number of bacteria in a colony doubles every hour. If a
colony begins with 5 bacteria, how many will be present in n hours?
Definition. A recursive relation for the sequence {an} is an equation that
expresses an in terms of one or more of the previous terms of the
sequence. A sequence is called a solution of a recurrence relation if its
terms satisfy the recurrence relation.
Example: Let {an} be a sequence that satisfies the recurrence relation
an = an-1 an-2 for n=2,3,4,
, and suppose that a0=3 and a1=5. What
are a2 and a3?
3. 6/2/2012 1:29:47 AM Recurrence Relations Example: Determine whether the sequence {an} where an = 3n for
every nonnegative integer n is a solution of the recurrence relation
an = 2an-1 - an-2 for n = 2,3,4,
. Answer the same question where
an = 2n and an = 5.
The initial conditions for a sequence specify the terms that precede the
first term where recurrence relation takes effect.
Example (Compound Interest): Suppose that a person deposits $10,000
in a savings account at a bank yielding 11% interest compounded
annually. How much will be in the account after 30 years? [$228,922.97]
4. 6/2/2012 1:29:47 AM Recurrence Relations Example (Rabbits and Fibonacci Numbers): This problem was originally
posed by Leonardo Pisano, also known as Fibonacci, in the 13th century
in his book Liber abaci. A young pair of rabbits (one of each sex) is
placed on an island. A pair of rabbits does not breed until they are 2
months old. After they are 2 months old, each pair of rabbits produces
another pair each month. Find a recurrence relation for the number of
pairs of rabbits on the island after n months, assuming that no rabbits
ever die.
Example (The Tower of Hanoi): A popular puzzle posed by the French
mathematician Edouard Lucas. There are three pegs mounted on a board
together with disks of different sizes. Initially, the disks are placed on the first peg
in order of size with the largest on the bottom. The disks can be moved from one
peg to another. However, a disk cannot be placed on top of a smaller one. The
goal is to move all the disks to the second peg. Find and solve a recurrence
relation for the number of moves needed to solve the puzzle.
5. 6/2/2012 1:29:47 AM Recurrence Relations Example: Find the initial conditions for the number of bit strings of length
n that do not have two consecutive 0s. How many such bit strings of
length five are there?
Example (Codeword Enumeration): A computer system considers a string
of decimal digits a valid codeword if it contains an even number of 0
digits. For instance 1230407869 is valid, whereas 120987045608 is not
valid. Let an be the number of valid n-digit codewords. Find a recurrence
relation for an.
Example: Let Cn be the number of ways to parenthesize the product of
n+1 numbers x0, x1,
,xn. Find a recurrence relation for Cn.
6. 6/2/2012 1:29:47 AM Solving Linear Recurrence Relations Definition. A linear homogenous recurrence relation of degree k with
constant coefficients is a recurrence relation of the form
an = c1an-1 + c2an-2 +
+ ckan-k,
where c1, c2,
, ck are real numbers and ck?0.
Example: The recurrence relation Pn = (1.11) Pn-1 is a linear
homogenous recurrence relation with constant coefficients and degree 1.
Example: The recurrence relation an = an-1 + a2n-2 is not linear. The
recurrence relation Hn = 2Hn-1 + 1 is not homogenous. The recurrence
relation Bn = nBn-1 does not have constant coefficients.
7. 6/2/2012 1:29:47 AM Solving Linear Recurrence Relations Let an = c1an-1 + c2an-2 +
+ ckan-k be a linear homogenous
recurrence relation with constant coefficients. The equation
rk - c1rk-1 - c2rk-2 -
- ck = 0
is called the characteristic equation of the recurrence relation, and its
roots are called characteristic roots of the recurrence relation.
Theorem. Let c1 and c2 be real numbers. Suppose that r2-c1r-c2=0 has
two distinct roots r1 and r2. Then, the sequence {an} is a solution to the
recurrence relation an = c1an-1+c2an-2 if and only if an = a1r1n + a2r2n,
where a1 and a2 are constants.
Example: Solve an = an-1 +2an-2 with a0 = 2 and a1 = 7.
Example: Find an explicit formula for the Fibonacci numbers.
8. 6/2/2012 1:29:47 AM Solving Linear Recurrence Relations Theorem. Let c1 and c2 ? 0 be real numbers. Suppose that r2-c1r-c2=0
has a single root r0. Then, the sequence {an} is a solution to the
recurrence relation an=c1an-1+c2an-2 if and only if an=a1r0n + a2nr0n,
where a1 and a2 are constants.
Example: What is the solution of the recurrence relation
an = 6an-1 9an-2
with initial conditions a0 = 1 and a1 = 6?
9. 6/2/2012 1:29:47 AM Solving Linear Recurrence Relations Theorem. Let c1, c2,
, ck be real numbers. Suppose that
rk - c1rk-1 - c2rk-2 -
- ck = 0
has k distinct roots r1, r2 ,
, rk. Then, the sequence {an} is a solution to
the recurrence relation
an = c1an-1 + c2an-2 +
+ ckan-k
if and only if
an = a1r1n + a2r2n +
+akrkn,
where a1,,a2,
, ak are constants.
Example: Find the solution to the recurrence relation
an = 6an-1 11an-2 + 6an-3
with the initial conditions a0 = 2, a1 = 5 and a2 = 15.
10. 6/2/2012 1:29:47 AM Solving Linear Recurrence Relations Theorem. Let c1, c2,
, ck be real numbers. Suppose that the
recurrence relation an = c1an-1 + c2an-2 +
+ ckan-k has t distinct
characteristic roots r1, r2 ,
, rt with multiplicities m1, m2 ,
, mt resp.
Then, the sequence {an} is a solution to the recurrence relation iff
an = (a1,0 + a1,1n +
+ a1,m_1-1nm_1-1)r1n +
+ (at,0 + at,1n +
+ at,m_t-1nm_t-1)rtn,
where all ai,j,are constants.
Example: What is the general solution to a recurrence relation with
characteristic roots 2, 2, 2, 5, 5 and 9?
Example: Find the solution to the recurrence an = -3an-1 3an-2 an-3
with initial conditions a0 = 1, a1 = -2 and a2= -1.
11. 6/2/2012 1:29:47 AM Solving Linear Recurrence Relations Linear Non-homogenous Recurrence Relations
Example: an= an-1+2n, an=an-1+ an-2+n2+n+1, an=3an-1+n3n.
Theorem. If {an(p)} is a particular solution of the non-homogenous linear
recurrence relation with constant coefficients
an = c1an-1 + c2an-2 +
+ ckan-k + F(n),
then every solution is of the form {an(p) + an(h)}, where {an(h)} is a
solution to the associated homogenous recurrence relation
an = c1an-1 + c2an-2 +
+ ckan-k .
Example: Find all solutions of the recurrence relation an= 3an-1+2n.
What is the solution with a1= 3?
Example: Find the solutions of an= 5an-1 6an-2+7n.
12. 6/2/2012 1:29:47 AM Solving Linear Recurrence Relations Theorem. Suppose {an} satisfies the linear non-homogenous
recurrence relation with constant coefficients
an = c1an-1 + c2an-2 +
+ ckan-k + F(n)
where F(n) = (btnt +
+ b1n + b0)sn. Then, there is a particular
solution of the form
(ptnt +
+ p1n + p0)sn
when s is not a characteristic root of the associated homogenous
recurrence relation, and a particular solution of the form
nm(ptnt +
+ p1n + p0)sn
when s is a characteristic root with multiplicity m.
Example: What form does a particular solution of an= 6an-1 9an-2+
F(n) have when F(n) is 3n, n3n, n22n and (n2+1)3n?
Example: Find an expression for the sum of the first n positive integers.
13. 6/2/2012 1:29:47 AM Generating Functions Definition. The generating function for the sequence {an} of real
numbers is the infinite series
Example: Find the generating functions for the sequences with ak = 3,
ak = k + 1, and ak = 2k.
We define the generating function for a finite sequence a0,
, an to be
equal to the generating function of the infinite sequence which is derived
from the finite one by setting an+1 = an+2=
= 0.
Example: What is the generating function for the sequence 1,1,1,1,1,1?
Example: What is the generating function for the sequence {ak}k=0,..,m
where ak=C(m,k)?
14. 6/2/2012 1:29:47 AM Generating Functions Useful Facts About Power Series
Example: f(x) = 1/(1 x) is the generating function of the sequence
1, 1, 1, 1,
.
Example: f(x) = 1/(1 ax) is the generating function of the sequence
1, a, a2, a3,
.
Theorem. Let and . Then
and
Example: Find the coefficients in the expansion of 1/(1 x)2.
15. 6/2/2012 1:29:47 AM Generating Functions Definition. Let u be a real number and k a nonnegative integer. Then the
extended binomial coefficient C(u, k) is defined by
Example: Find the values of C(-2, 3) and C(1/2, 3).
Example: Express the extended binomial coefficient in terms of the
normal binomial coefficient when u is a negative integer.
Theorem (The Extended Binomial Theorem). Let x be a real number with
|x| < 1, and let u be a real number. Then,
16. 6/2/2012 1:29:47 AM Generating Functions Example: Find the coefficients in the expansion of 1/(1 + x)n and
1/(1 x)n.
Solving Counting Problems
Example: Find the number of solutions of e1 + e2 + e3 = 17 when
2 = e1 = 5, 3 = e2 = 6 and 4 = e3 = 7.
Example: In how many different ways can eight identical cookies be
distributed among three distinct children if each child gets at least two
and no more than four cookies?
Example: Use generating functions to determine the number of ways to
insert $1, $2 and $5 tokens into a vending machine to pay for an item
that costs r dollars. Consider both cases, when the order of insertion
does not matter, and when the order matters.
17. 6/2/2012 1:29:47 AM Generating Functions Example: Use generating functions to prove the formula for the number
of k-combinations of a set with n elements.
Example: Use generating functions to prove the formula for the number
of k-combinations of a set with n elements when repetitions are allowed.
Example: Use generating functions to find the number of ways to select r
objects of n different kinds if we must select at least one object of each
kind.
18. 6/2/2012 1:29:47 AM Generating Functions Solving Recurrence Relations
Example: Solve an = 3an-1 when a0 = 2.
Example: Find an expression for the number of n-digit codewords having
an even number of 0s. [ Remark: We already determined the recurrence
relation an = 8an-1 + 10n-1. ]
Proving Identities
Example: Use generating functions to show that
whenever n is a positive integer.