4.5.2 applications of inclusion-exclusion principle the number of r-combinations of multiset s 1....

19
4.5.2 Applications of Inclusion-Exclusion principle The number of r-combinations of multiset S 1. The number of r-combinations of multiset S If r<n, and there is, in general, no simple formula for the number of r-combinations of S. Nonetheless a solution can be obtained by the inclusion-exclusion principle 4.5 .

Upload: loraine-taylor

Post on 02-Jan-2016

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 4.5.2 Applications of Inclusion-Exclusion principle  The number of r-combinations of multiset S  1. The number of r-combinations of multiset S  If

4.5.2 Applications of Inclusion-Exclusion principle

The number of r-combinations of multiset S 1. The number of r-combinations of multiset

S If r<n, and there is, in general, no simple

formula for the number of r-combinations of S. Nonetheless a solution can be obtained by the inclusion-exclusion principle 4.5 .

Page 2: 4.5.2 Applications of Inclusion-Exclusion principle  The number of r-combinations of multiset S  1. The number of r-combinations of multiset S  If

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

Solution : We shall apply the inclusion-exclusion principle to the set Y of all 10-combinations of the multiset D={·a, ·b, ·c}.

Let P1 be the property that a 10-combination of D has more than 3 a’s. Let P2 be the property that a 10-combination of D has mote than 4 b’s. Let P3 be the property that a 10-combination of D has mote than 5 c’s.

For i=1,2,3 let Ai be the set consisting of those 10-combinations of D which have property Pi.

The number of 10-combinations of S is then the number of 10-combinations of D which have none of the properties P1, P2, and P3.

321 AAA

Page 3: 4.5.2 Applications of Inclusion-Exclusion principle  The number of r-combinations of multiset S  1. The number of r-combinations of multiset S  If

The set A1 consists of all 10-combinations of D in which a occurs at least 4 time.

If we take any one of these 10-combinations in A1 and remove 4 a’s, we are left with a 6-combination of D.

Conversely, if we take a 6-combination of D and add 4 a’s to it, we get a 10-combination of D in which a occurs at least 4 times.

Thus the number of 10-combinations in A1 equals the number of 6-combinations of D. Hence, |A1|=C(3+6-1,6)=C(8,6)=C(8,2) ,

Page 4: 4.5.2 Applications of Inclusion-Exclusion principle  The number of r-combinations of multiset S  1. The number of r-combinations of multiset S  If

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

x1+x2+x3=5 which satisfy 0x12,0x22,1x35? Solution: We introduce new variables, x3'=x3-1 and our equation becomes x1+x2+x3'=4. The inequalities on the xi and x3' are satisfied if and

only if 0x12,0x22, 0x3'4. 4-combinations of multiset {2·a,2·b,4·c}

Page 5: 4.5.2 Applications of Inclusion-Exclusion principle  The number of r-combinations of multiset S  1. The number of r-combinations of multiset S  If

2.Derangements A derangement of {1,2,…,n} is a permutation

i1i2…in of {1,2,…,n} in which no integer is in its natural position:

i11,i22,…,inn.

We denote by Dn the number of derangements of {1,2,…,n}.

Theorem 4.15 : For n1,)

!

1)1(

!3

1

!2

1

!1

11(!

nnD n

n

Page 6: 4.5.2 Applications of Inclusion-Exclusion principle  The number of r-combinations of multiset S  1. The number of r-combinations of multiset S  If

Proof: Let S={1,2,…,n} and X be the set of all permutations of S. Then |X|=n!.

For j=1,2,…,n, let pj be the property that in a permutation, j is in its natural position. Thus the permutation i1,i2,…,in of S has property pj

provided ij=j. A permutation of S is a derangement if and only if it has none of the properties p1,p2,…,pn.

Let Aj denote the set of permutations of S with property pj ( j=1,2,…,n).

Page 7: 4.5.2 Applications of Inclusion-Exclusion principle  The number of r-combinations of multiset S  1. The number of r-combinations of multiset S  If

Example:(1)Determine the number of permutations of {1,2,3,4,5,6,7,8,9} in which no odd integer is in its natural position and all even integers are in their natural position.

(2) Determine the number of permutations of {1,2,3,4,5,6,7,8,9} in which four integers are in their natural position.

Page 8: 4.5.2 Applications of Inclusion-Exclusion principle  The number of r-combinations of multiset S  1. The number of r-combinations of multiset S  If

3. Permutations with relative forbidden position

A Permutations of {1,2,…,n} with relative forbidden position is a permutation in which none of the patterns i,i+1(i=1,2,…,n) occurs. We denote by Qn the number of the permutations of {1,2,…,n} with relative forbidden position.

Theorem 4.16 : For n1, Qn=n!-C(n-1,1)(n-1)!+C(n-1,2)(n-2)!-…+(-1)n-1

C(n-1,n-1)1!

Page 9: 4.5.2 Applications of Inclusion-Exclusion principle  The number of r-combinations of multiset S  1. The number of r-combinations of multiset S  If

Proof: Let S={1,2,…,n} and X be the set of all permutations of S. Then |X|=n!.

j(j+1), pj(1,2,…,n-1)

Aj: pj

Qn=Dn+Dn-1

Page 10: 4.5.2 Applications of Inclusion-Exclusion principle  The number of r-combinations of multiset S  1. The number of r-combinations of multiset S  If

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 11: 4.5.2 Applications of Inclusion-Exclusion principle  The number of r-combinations of multiset S  1. The number of r-combinations of multiset S  If

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 12: 4.5.2 Applications of Inclusion-Exclusion principle  The number of r-combinations of multiset S  1. The number of r-combinations of multiset S  If

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 13: 4.5.2 Applications of Inclusion-Exclusion principle  The number of r-combinations of multiset S  1. The number of r-combinations of multiset S  If

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 14: 4.5.2 Applications of Inclusion-Exclusion principle  The number of r-combinations of multiset S  1. The number of r-combinations of multiset S  If

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

yrrkCy

yf

Page 15: 4.5.2 Applications of Inclusion-Exclusion principle  The number of r-combinations of multiset S  1. The number of r-combinations of multiset S  If

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

nnr

nnrkCa

rr

r

Page 16: 4.5.2 Applications of Inclusion-Exclusion principle  The number of r-combinations of multiset S  1. The number of r-combinations of multiset S  If

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 17: 4.5.2 Applications of Inclusion-Exclusion principle  The number of r-combinations of multiset S  1. The number of r-combinations of multiset S  If

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 18: 4.5.2 Applications of Inclusion-Exclusion principle  The number of r-combinations of multiset S  1. The number of r-combinations of multiset S  If

Next: Exponential Generating functions; Recurrence Relations P13, P112 (Sixth) OR P13,P100(Fifth)

Exercise: 1. Determine the number of 12-combinations of the multiset S={4·a,3·b,5·c, 4·d }.

2. Determine the number of solutions of the equation x1+x2+x3+x4=14 in nonnegative integers x1,x2,x3, and x4 not exceeding 8.

3.Determine the number of permutations of {1,2,3,4,5,6,7,8} in which no even integer is in its natural position.

4.Determine the number of permutations of {1,2,…,n} in which exactly k integers are in their natural positions.

5.Eight boys are seated around a carousel. In how many ways can they change seats so that each has a different boy in front of him?

6.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. 7.Determine the generating function for the number an of nonnegative

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

Page 19: 4.5.2 Applications of Inclusion-Exclusion principle  The number of r-combinations of multiset S  1. The number of r-combinations of multiset S  If