4.6 Generating functions Generating functions

10
4.6 Generating functions 4.6.1 Generating functions Let S={n 1 •a 1 ,n 2 •a 2 ,…,n k •a k }, and n=n 1 +n 2 +…+n k =| S| then the number N of r-combinations of S equals (1)0 when r>n (2)1 when r=n (3) N=C(k+r-1,r) when n i r for each i=1,2,…,n. (4)If r<n, and there is, in general, no simple formula for the number of r-combinations of S. A solution can be obtained by the inclusion- exclusion principle and technique of generating functions. 6-combination a 1 a 1 a 3 a 3 a 3 a 4

description

xi1xi2…xik= xi1+i2+…+ik=xr r-combination of S Definition 1: The generating function for the sequence a0,a1,…,an,… of real numbers is the infinite series f(x)=a0+a1x+a2x2+…+anxn+…, and if only if ai=bi for all i=0,1, …n, …

Transcript of 4.6 Generating functions Generating functions

Page 1: 4.6 Generating functions Generating functions

4.6 Generating functions

4.6.1 Generating functions Let S={n1•a1,n2•a2,…,nk•ak}, and n=n1+n2+…+nk=|S| , then

the number N of r-combinations of S equals (1)0 when r>n (2)1 when r=n (3) N=C(k+r-1,r) when ni r for each i=1,2,…,n. (4)If r<n, and there is, in general, no simple formula for the

number of r-combinations of S. A solution can be obtained by the inclusion-exclusion

principle and technique of generating functions. 6-combination a1a1a3a3a3a4

Page 2: 4.6 Generating functions Generating functions

xi1xi2…xik= xi1+i2+…+ik=xr

r-combination of S Definition 1: The generating function for the

sequence a0,a1,…,an,… of real numbers is the infinite series f(x)=a0+a1x+a2x2+…+anxn+…, and

00 i

ii

i

ii xbxa if only if ai=bi for all i=0,1, …n, …

Page 3: 4.6 Generating functions Generating functions

We can define generating function for finite sequences of real numbers by extending a finite sequences a0,a1,…,an into an infinite sequence by setting an+1=0, an+2=0, and so on.

The generating function f(x) of this infinite sequence {an} is a polynomial of degree n since no terms of the form ajxj, with j>n occur, that is f(x)=a0+a1x+a2x2+…+anxn.

Page 4: 4.6 Generating functions Generating functions

Example: (1)Determine the number of ways in which postage of r cents can be pasted on an envelope using 1 1-cent,1 2-cent, 1 4-cent, 1 8-cent and 1 16-cent stamps.

(2)Determine the number of ways in which postage of r cents can be pasted on an envelope using 2 1-cent, 3 2-cent and 2 5-cent stamps.

Assume that the order the stamps are pasted on does not matter.

Let ar be the number of ways in which postage of r cents. Then the generating function f(x) of this sequence {ar} is

(1)f(x)=(1+x)(1+x2)(1+x4)(1+x8)(1+x16) (2)f(x)=(1+x+x2)(1+x2+(x2)2+(x2)3)(1+x5+(x5)2) ) =1+x+2x2+x3+2x4+2x5+3x6+3x7+2x8+2x9+2x10+3x11 +3x12+2x13+

2x14+x15+2x16+x17+x18 。

Page 5: 4.6 Generating functions Generating functions

Example: Use generating functions to determine the number of r-combinations of multiset S={·a1,·a2,…, ·ak }.

Solution: Let br be the number of r-combinations of multiset S. And let generating functions of {br} be f(y) ,

(1+y+y2+…)k=? f(y)

0),1(

)1(1)(

r

rk yrrkC

yyf

Page 6: 4.6 Generating functions Generating functions

Example: Use generating functions to determine the number of r-combinations of multiset S={n1·a1,n2·a2,…,nk·ak}.

Solution: Let generating functions of {br} be f(y) , f(y)=(1+y+y2+…+yn1)(1+y+y2+…+yn2)…(1+y+y2+…+ynk) Example: Let S={·a1,·a2,…,·ak}. Determine the

number of r-combinations of S so that each of the k types of objects occurs even times.

Solution: Let generating functions of {br} be f(y) , f(y)=(1+y2+y4+…)k=1/(1-y2)k

=1+ky2+C(k+1,2)y4+…+C(k+n-1,n)y2n+…

),1,0(120),1,0(2),1( 22

nnrnnrkC

arr

r

Page 7: 4.6 Generating functions Generating functions

Example: Determine the number of 10-combinations of multiset S={3·a,4·b,5·c}.

Solution: Let generating functions of {ar} be f(y) ,

f(y)=(1+y+y2+y3)(1+y+y2+y3+y4)(1+y+y2+y3+y4+y5)

=1+3y+6y2+10y3+14y4+17y5+18y6+17y7+14y8+10y9+6y10+3y11+y12

Page 8: 4.6 Generating functions Generating functions

Example: What is the number of integral solutions of the equation

x1+x2+x3=5 which satisfy 0x1,0x2,1x3? Let x3'=x3-1 , x1+x2+x3'=4, where 0x1,0x2,0x3'

03

222

),2()1(

1

)1)(1)(1()(

r

ryrrCy

yyyyyyyf

Page 9: 4.6 Generating functions Generating functions

Exponential generating functions Recurrence Relations P13, P100

Page 10: 4.6 Generating functions Generating functions

Exercise 1. Let S be the multiset {·e1,·e2,…, ·ek}. Determine the generating function for the sequence a0, a1, …,an, … where an is the number of n-combinations of S with the added restriction:

1) Each ei occurs an odd number of times. 2) the element e2 does not occur, and e1 occurs at

most once. 2. Determine the generating function for the

number an of nonnegative integral solutions of 2e1+5e2+e3+7e4=n