Title: 4.6.2 Exponential generating functions
1- 4.6.2 Exponential generating functions
- The number of r-combinations of multiset
Sn1a1,n2a2,, nkak C(rk-1,r), - generating function
The number of r-permutation of set Sa1,a2,,
ak p(n,r), generating function
2Definition 2 The exponential generating function
for the sequence a0,a1,,an,of real numbers is
the infinite series
3- Theorem 4.17 Let S be the multiset
n1a1,n2a2,,nkak where n1,n2,,nk are
non-negative integers. Let br be the number of
r-permutations of S. Then the exponential
generating function g(x) for the sequence b1,
b2,, bk, is given by - g(x)gn1(x)g n2(x)gnk(x),where for i1,2,,k,
- gni(x)1xx2/2!xni/ni! .
- (1)The coefficient of xr/r! in gn1(x)g
n2(x)gnk(x) is
4- Example Let S1a1,1a2,,1ak. Determine the
number r-permutations of S. - Solution Let pr be the number r-permutations of
S, and
5- Example Let S?a1,?a2,,?ak,Determine the
number r-permutations of S. - Solution Let pr be the number r-permutations of
S, - gri(x)(1xx2/2!xr/r!),then
- g(x)(1xx2/2!xr/r!)k(ex)kekx
6- ExampleLet S2x1,3x2,Determine the number
4-permutations of S. - Let pr be the number r-permutations of S,
- g(x)(1xx2/2!)(1xx2/2!x3/3!)
- Note pr is coefficient of xr/r!.
- ExampleLet S2x1,3x2,4x3. Determine the
number of 4-permutations of S so that each of the
3 types of objects occurs even times. - Solution Let pr be the number r-permutations of
S, - g(x)(1x2/2!)(1x2/2!)(1x2/2!x4/4!)
7- Example Let S?a1,?a2, ?a3,Determine the
number of r-permutations of S so that a3 occurs
even times and a2 occurs at least one time. - Let pr be the number r-permutations of S,
- g(x)(1xx2/2!xr/r!)(xx2/2!xr/r! )
(1x2/2!x4/4!)ex(ex-1)(exe-x)/2 - (e3x-e2xex-1)/2
8- Example Let S?a1,?a2, ?a3,Determine the
number of r-permutations of S so that a3 occurs
odd times and a2 occurs at least one time. - Let pr be the number r-permutations of S,
- g(x)(1xx2/2!xr/r!)(xx2/2!xr/r! )
(xx3/3!x5/5!) - ex(ex-1)(ex-e-x)/2
94.7 Recurrence Relations
- P13, P100
- Definition A recurrence relation for the
sequencean 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. - Initial condition the information about the
beginning of the sequence.
10- Example(Fibonacci sequence)
- 13 ????????? Fibonacci ??????????????
- A young pair rabbits (one of each sex) is placed
in enclosure. A pair rabbits dose not breed until
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 in the enclosure after n months, assuming
that no rabbits ever die. - Solution Let Fn be the number of pairs of
rabbits after n months, - (1)Born during month n
- (2)Present in month n-1
- FnFn-2Fn-1,F1F21
11- Example (The Tower of Hanoi) There are three
pegs and n circular disks of increasing size on
one peg, with the largest disk on the bottom.
These disks are to be transferred, one at a time,
onto another of the pegs, with the provision that
at no time is one allowed to place a larger disk
on top of a smaller one. The problem is to
determine the number of moves necessary for the
transfer. - Solution Let h(n) denote the number of moves
needed to solve the Tower of Hanoi problem with n
disks. h(1)1 - (1)We must first transfer the top n-1 disks to a
peg - (2)Then we transfer the largest disk to the
vacant peg - (3)Lastly, we transfer the n-1 disks to the peg
which contains the largest disk. - h(n)2h(n-1)1, h(1)1
12- Using Characteristic roots to solve recurrence
relations - Using Generating functions to solve recurrence
relations
134.7.1 Using Characteristic roots to solve
recurrence relations
- Definition A linear homogeneous recurrence
relation of degree k with constant coefficients
is a recurrence relation of the form - anh1an-1h2an-2hkan-k, where hi are constants
for all i1,2,,k,nk, and hk?0. - Definition A linear nonhomogeneous recurrence
relation of degree k with constant coefficients
is a recurrence relation of the form - anh1an-1h2an-2hkan-kf(n), where hi are
constants for all i1,2,,k,nk, and hk?0.
14- Definition The equation xk-h1xk-1-h2xk-2--hk0
is called the characteristic equation of the
recurrence relation anh1an-1h2an-2hkan-k.
The solutions q1,q2,,qk of this equation are
called the characteristic root of the recurrence
relation, where qi(i1,2,,k) is complex number. - Theorem 4.18 Suppose that the characteristic
equation has k distinct roots q1,q2,,qk. Then
the general solution of the recurrence relation
is - anc1q1nc2q2nckqkn, where c1,c2,ck are
constants.
15- Example Solve the recurrence relation
- an2an-12an-2,(n2)
- subject to the initial values a13 and a28.
- characteristic equation
- x2-2x-20,
- roots
- q1131/2,q21-31/2?
- the general solution of the recurrence relation
is - anc1(131/2)nc2(1-31/2)n,
- We want to determine c1 and c2 so that the
initial values - c1(131/2)c2(1-31/2)3,
- c1(131/2)2c2(1-31/2)28
16- Theorem 4.19 Suppose that the characteristic
equation has t distinct roots q1,q2,,qt with
multiplicities m1,m2,,mt, respectively, so that
mi1 for i1,2,,t and m1m2mtk. Then the
general solution of the recurrence relation is
where cij are constants for 1jmi and 1it.
17- Example Solve the recurrence relation
- anan-1-3an-2-5an-3-2an-40,n4
- subject to the initial values a01,a1a20, and
a32. - characteristic equation
- x4x3-3x2-5x-20,
- roots-1,-1,-1,2
- By Theorem 4.19the general solution of the
recurrence relation is - anc11(-1)nc12n(-1)nc13n2(-1)nc212n
- We want to determine cij so that the initial
values - c11c211
- -c11-c12-c132c210
- c112c124c134c210
- -c11-3c12-9c138c212
- c117/9,c12-13/16,c131/16,c211/8
- an7/9(-1)n-(13/16)n(-1)n(1/16)n2(-1)n(1/8)2n
18- the general solution of the linear nonhomogeneous
recurrence relation of degree k with constant
coefficients is - ana'na n
- a'n is the general solution of the linear
homogeneous recurrence relation of degree k with
constant coefficients anh1an-1h2an-2hkan-k - a nis a particular solution of the
nonhomogeneous linear recurrence relation with
constant coefficients - anh1an-1h2an-2hkan-kf(n)
19- Theorem 4.20 If a n is a particular solution
of the nonhomogeneous linear recurrence relation
with constant coefficients - anh1an-1h2an-2hkan-kf(n),
- then every solution is of the form a'na n,
where a n is a general solution of the
associated homogeneous recurrence relation
anh1an-1h2an-2hkan-k. - Keya n
20- (1)When f(n) is a polynomial in n of degree t,
- a nP1ntP2nt-1PtnPt1
- where P1,P2,,Pt,Pt1 are constant coefficients
- (2)When f(n) is a power function with constant
coefficient ?n, if ? is not a characteristic root
of the associated homogeneous recurrence
relation, - a n P??n ,
- where P is a constant coefficient.
- if ? is a characteristic root of the associated
homogeneous recurrence relation with
multiplicities m, - a n P?nm??n ,where P is a constant coefficient.
- Example Find all solutions of the recurrence
relation an2an-1n1,n?1, a02
21- Example Find all solutions of the recurrence
relation h(n)2h(n-1)1, n?2, h(1)1 - Example Find all solutions of the recurrence
relation - anan-17n,n?1, a01
- If let anP1nP2,
- P1nP2-P1(n-1)-P27n
- P17n
- Contradiction
- let anP1n2P2n
224.7.2 Using Generating functions to solve
recurrence relations
Example Solve the recurrence relation anan-19an
-2-9an-3,n3 subject to the initial values a00,
a11, a22
23- Example Solve the recurrence relation
- anan-19an-2-9an-3,n3
- subject to the initial values a00, a11, a22
- Solution Let Generating functions of an be
- f(x)a0a1xa2x2anxn , then
- -xf(x) -a0x-a1x2-a2x3-anxn1-
- -9x2f(x) -9a0x2-9a1x3-9a2x4--9an-2xn-
- 9x3f(x) 9a0x39a1x49an-3xn
- (1-x-9x29x3)f(x)a0(a1-a0)x(a2-a1-9a0)x2
(a3-a2-9a19a0)x3(an-an-1-9an-29an-3)xn
a00,a11, a22,and when n3,an-an-1-9an-29an-30
, (anan-19an-2-9an-3) thus (1-x-9x29x3)f(x)x
x2 f(x)(xx2)/(1-x-9x29x3) (xx2)/((1-x)(13x)(
1-3x))
1/(1-x)1xx2xn 1/(13x)1-3x32x2-(-1)n3
nxn 1/(1-3x)13x32x23nxn
24- Example Find an explicit formula for the
Fibonacci numbers, - FnFn-2Fn-1,
- F1F21?
- Solution Let Generating functions of Fn be
- f(x)F0F1xF2x2Fnxn,then
- -xf(x) -F0x-F1x2-F2x3-Fnxn1-
- -x2f(x) -F0x2-F1x3-F2x4--Fn-2xn-
- (1-x-x2)f(x)F1x(F2-F1)x2(F3-F2-F1)x3(F4-F3-F2)
x4(Fn-Fn-1-Fn-2)xn - F11, F21,and when n3,Fn-Fn-1-Fn-20,
- (FnFn-1Fn-2)
- thus
- (1-x-x2)f(x)x
- f(x)x/(1-x-x2)
Fn-1?0.618Fn? golden section?????
25- Exercise P104 18,20,23.Note By Characteristic
roots, solve recurrence relations 23 By
Generating functions, solve recurrence relations
18,20. - 1.Determine the number of n digit numbers with
all digits at least 4, such that 4 and 6 each
occur an even number of times, and 5 and 7 each
occur at least once, there being no restriction
on the digits 8 and 9. - 2.a)Find a recurrence relation for the number of
ways to climb n stairs if the person climbing the
stairs can take one stair or two stairs at a
time. b) What are the initial conditions? - 3.a) Find a recurrence relation for the number of
ternary strings that do not contain two
consecutive 0s. b) What are the initial
conditions?