discrete math by r.s. chang, dept. csie, ndhu1 chapter 9

29
crete Math by R.S. Chang, Dept. CSIE, NDHU Chapter 9

Upload: rosamond-wilson

Post on 18-Jan-2018

227 views

Category:

Documents


0 download

DESCRIPTION

Discrete Math by R.S. Chang, Dept. CSIE, NDHU3 Chapter Introductory Examples Ex. 9.3 How many integer solutions are there for the equation

TRANSCRIPT

Page 1: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 1

Chapter 9

Page 2: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 2

Chapter 99.1 Introductory Examples

Ex. 9.1 Find the number of integer solutions toc c c c c c1 2 3 1 2 312 4 2 2 5 where , , .

c x x x x x c xc x x x x x c xc x x x x c x

x f x c x c x c x

f x generating function

14 5 6 7 8

1

22 3 4 5 6

2

32 3 4 5

3

1 2 3

: ( ): ( ): ( )

( ) ( ) ( ),

The coefficient of in ( ) =which is 14, is the answer.

( ) is called a for the distributions.

12

Page 3: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 3

Chapter 99.1 Introductory Examples

Ex. 9.3 How many integer solutions are there for the equation

c c c c c ic

x x x x

f x x x x

g x x x x xx

x

ii

1 2 3 4

25

2 25 4

2 25 26 4

44

25 0 1 4

1

11

11

, , ?,

.

( )( )

For each the possibility can be described by1 + + Then the answer is the coefficient of in the generating function:

( ) = + + or

( ) = + +

2 25

Page 4: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 4

Chapter 99.2 Definitions and Examples: Calculational Techniques

Def. 9.1 Let be a sequence of real numbers. The

function ( ) = is called the

generating function for the given sequence.

Ex. 9.4 For any Z

so (1 + ) is the generating function for the sequence

0

0

+

a a a

f x a a x a x a x

n xn n

xn

xnn

x

xn n n n

n

ii

i

n n

n

, , ,

, ( )

, , , , , , , , .

1 2

1 22

0

210 1 2

0 1 20 0 0

Page 5: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 5

Chapter 99.2 Definitions and Examples: Calculational Techniques

Ex. 9.5 (a) For Z (1 -

So 1 - x is the generating function for , ,

b) If and | |< 1, 1 = ( - )( + + x

So 1-

is the generating function for 1,1,1, .

(c)

Consequently, 1

+ +

n+1

+ '2

n x x x x

x

n x x x x

xddx x

xx

ddx

x x x x x x

n n

n s

, ) ( )( ).

, , , .

( ).

( )( ) ( )( )

( )

1

1 13

22

2 3 2 3

1 1

111 1 0 0

1 1

11

11 1 1 1

11 1 2 3 4

( - ) is the generating function of 1,2,3, .

21 x

Page 6: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 6

Chapter 99.2 Definitions and Examples: Calculational Techniques

Ex. 9.5 (continued)

And ( - )

is the generating function of 0,1,2,3, .

(d) Continuing from (c),

Hence +

( - ) generates 1 and

( + )

( - ) generates 0 1

2

2 2

x

xddx

x

x

x

xddx

x x x x x xx

xx x

x

1

1

1

10 2 3 1 2 3 4

1

12 3

1

12 3

2

2 3

2 3 2 2 2 2 3

32 2

32 2

( ) ( )( ) .

, , , ,

, , , , .

Page 7: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 7

Chapter 99.2 Definitions and Examples: Calculational Techniques

Ex. 9.6 (a) generating function of 1,1,0,1,1, is 11 - x

The generating function for 1,1,1,3,1,1, is 11 - x

b) Find the generating function for 0,2,6,12,20,30,42,

Therefore, the generating function is

x

x

a a a aax x

x

x

x

x

x

2

3

02

12

22

32

42

3 2 3

2

0 0 0 2 1 1 6 2 2 12 3 320 4 4

1

1 1

2

1

(, , , ,

, .( )

( ) ( ) ( )

Page 8: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 8

Chapter 99.2 Definitions and Examples: Calculational Techniques

Extension of binomial coefficientWith , Z and > 0, we have

If R, we use as the definition

of For example, if Z we have -

+

+

n r n rnr

nr n r

n n n n rr

n n n n n rr

nr

nnr

n n n n rr

n n n rr

n rr

r

r

!!( )!

( )( ) ( )!

.

( )( ) ( )!

. ,

( )( )( ) ( )!

( ) ( )( ) ( )!

( )

1 2 1

1 2 1

1 2 1 1 1 1

11

. . And for any real n, define

n0

1

Page 9: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 9

Chapter 99.2 Definitions and Examples: Calculational Techniques

Ex. 9.7 For n Z

Ex. 9.8 Find the coefficient of x in (1 - 2x)

Ex. 9.10 Find the coefficient of x in f(x) = (x

The coefficient of x in

is -47

+

5 -7

15 2

7

, ( ) ( )

.

( ) ( ) ( ) , .

) .

( ) ( )( )

.

( )

1 11

75

2 17 5 1

532 14 784

11

1

1

0

0

5 5

3 4

2 2 4 8

4

4

xn r

rx

nr

x

x

f x x x x x

x

x

n r

r

r

r

r

( )1 1207

Page 10: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 10

Chapter 99.2 Definitions and Examples: Calculational Techniques

Ex. 9.11 In how many ways can we select, with repetitions allowed,r objects from n distinct objects?

For each of the distinct objects, the geometric series+ + represents the possible choices for the

object. Considering all of the objects, the generating functionsis ( ) = ( + + and the required answer is the

coefficient of in ( ). ( ) = ( - )

So the answer is + -

2

-

nx x x

nf x x x x

x f x f x xni

x

n ii

xn r

r

n

r n i

i

i

i

1

1

1

1 1

3

2 3

0

0

) ,

. .

Page 11: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 11

Chapter 99.2 Definitions and Examples: Calculational Techniques

Ex. 9.13 Verify that for all Z

Since (1 + ) by comparison of coefficients,

the coefficient of in ( + ) which is must equal the

coefficient of in and that is

+nn

nni

x x

x xnn

xn n

xnn

x

n nn

n nn

nn

i

n

n n

n n

n n

, .

[( ) ] ,

, ,

,

2

1

12

0 1

0 1 1

2

02 2

2

2

n nr

nn r0

. , With the result

follows.

Page 12: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 12

Chapter 99.2 Definitions and Examples: Calculational Techniques

Ex. 9.14 Determine the coefficient of in ( - )( - )

partial fraction decomposition:

1

( - )( - ) or

1 = ( - ) By comparing coefficients, = , = -1, and = -1. Hence,

1

( - )( - )

2

xx x

x x

Ax

Bx

C

xA x B x x C x

A B C

x x x x x x

x

82

2

2

2 2

1

3 2

3 2 3 2 22 2 3 3

1

3 2

13

12

1

2

13

11 3

12

11 2

14

.

( )( )( ) ( ).

( ) ( / )

( / )

1

1 2 2( ( / ))x

Page 13: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 13

Chapter 99.2 Definitions and Examples: Calculational Techniques

Ex. 9.15 Use generating functions to determine how many four-element subsets of S={1,2,3,...,15} contain no consecutiveintegers.Let { be one such subset with 1 Let

for 2 and Then with 0

and 2 Therefore, the answer is the coefficient of in ( ) = ( + + x

which is -58

1

=

2

a a a aa a a a c a c a a

i c a c c c

c c cx f x x x x x x

i i i

ii

1 2 3 41 2 3 4 1 1

5 41

51 5

2 3 414 2 2 3 3 6 5

8

15 1

4 15 14

1 1

1 495

, , , }. ,

, . ,

, , .) ( ) ( ) ,

( ) .

Page 14: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 14

Chapter 99.2 Definitions and Examples: Calculational Techniques

Ex. 9.16 ( ) =( - )

generates 0,1,2,

and ( ) = ( + )

( - ) generates 0

Then ( ) = ( ) ( ) = where

2

=

f x x

xa a a

g x x x

xb b b

h x f x g x c x

c a b a b a b a b a b a bi k i i k ki i k i

kk

kk k k k k k k

ik

ik

ik

11

11 2

2

2 0 1 2

32 2

0 1 2

00 1 1 2 2 2 2 1 1 0

20

2 20

20

( , , , )

, , , ( , , , )

,

( ) ( )

21

22

1 2 16

12

20

30

2

2

0 1 2 0 1 2

k i i kk k

kk k k

k k a a a b b b

ik

ik ( ) ( )( )

( ) . , , , , , , . Convolution of and

Page 15: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 15

Chapter 99.3 Partitions of Integers

Partition a positive integer n into positive summands and seeking the number of such partitions, without regard to order.For example, p(1)=1: 1 p(2)=2: 2=1+1 p(3)=3: 3=2+1=1+1+1 p(4)=5: 4=3+1=2+2=2+1+1=1+1+1+1 p(5)=7: 5=4+1=3+2=3+1+1=2+2+1=2+1+1+1 =1+1+1+1+1

We should like to obtain p(n) for a given n without having tolist all the partitions. We need a tool to keep track of the numbers of 1's, 2's, ..., n's that are used as summands for n.

Page 16: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 16

Chapter 99.3 Partitions of Integers

keep track of 1's: 1 + +keep track of 2's: 1 + +

keep track of ' s: 1 + +For example, p(10) is the coefficient of in

( ) = ( + +

In general, ( ) = generate the sequence ( ), (1),

2

4

2k

10

2

x x xx x x

k x x xx

f x x x x x x

x x x x x

P xx

p p

k k

ii

ii

3

2 6

3

2 4 10

2 3 10 1

10

1

1 1 11

11

1

1

1

1

1

1

11

10

)( ) ( )

.

Page 17: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 17

Chapter 99.3 Partitions of Integers

Ex. 9.18 Find the generating function for the number of ways anadvertising agent can purchase n minutes of air time if time slotsfor commercials come in blocks of 30, 60, or 120 seconds.

Let 30 seconds represent one time unit. Then the answer is thenumber of integer solutions to the equation + + =with 0 , , . The associated generating function is

( ) = ( + +

and the coefficient of is the answer.

2

a b c na b c

f x x x x x x x

x x xx n

2 4 2

1 1 11

11

1

1

1

2 4 4 8

2 42

)( )( )

Page 18: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 18

Chapter 99.3 Partitions of Integers

Ex. 9.19 Find the generating function for pd(n), the number ofpartitions of a positive integer n into distinct summands.For any Z either is not used as a summand or it is. This can be accounted for by the polynomial 1 +Consequently, the generating function is

the generating function of partitioning into odd summands

+k kx

P x x x x x

xx

x

x

x

x

x

x x xx x x x x x P x

k

di

i

o

,.

( ) ( )( )( ) ( )

( )( )( ) ( )

1 1 1 1

11

1

1

1

1

1

1

11

1

11 1 1

2 3

12 4

2

6

3

8

4 32 3 6 5 10

Page 19: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 19

Chapter 99.3 Partitions of Integers

Ex. 9.21 Partition into odd summands but each such odd summandsmust occur an odd number of times-or not at all.

f x x x x x x x x x

x k i

ik

( ) ( )( )(

) .( )( )

1 1 1

1

3 5 3 9 15 5 15

2 1 2 1

00

Ferrer's graph

14=4+3+3+2+1+1=6+4+3+1

The number of partitions ofan integer n into m summandsis equal to the number ofpartitions where m is the largest summands.

Page 20: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 20

Chapter 99.4 The Exponential Generating Function

ordinary generating functions: selections (order is irrelevant)

( ) ( , ) ( , )!

( )

1

1 00

0 0

x C n r x P n rxr

x C n C nP n P n

n r

r

n r

r

n

n is the ordinary generating function of ( , ), ( ,1),But an exponential generating function for ( , ), ( ,1),

Def. 9.2 For a sequence of real numbers,

( ) =

is called the exponential generating function for the givensequence.

Ex. 9.22 is the ordinary g. f. of 1,1,12!

and

an exponential g. f. of 1,1,1, .

a a a

f x a a x ax

ax

axi

exi

i

i

i

xi

i

0 1 2

0 1 2

2

3

3

0

0

2 3

13

, , ,

! ! !

!,

!,

Page 21: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 21

Chapter 99.4 The Exponential Generating Function

Ex. 9.23 In how many ways can four of the letters in ENGINEbe arranged?For the letter E and N, we use ( + + because thereare 0, 1, or 2 to arrange. For G and I, we use (1 + ).Consequetly, the exponential generating function (of

arrangement) is ( ) = + + And the answer

is the coefficient of !

in ( ).

12

12

1

4

2

2 22

4

xx

x

f x xx

x

xf x

!)

!( ) .

Page 22: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 22

Chapter 99.4 The Exponential Generating Function

Ex. 9.24 e xx x

e xx x

e e x x

e ex

x x

x

x

x x

x x

12 3

12 3

21

2 4

2 3 5

2 3

2 3

2 4

3 5

! !

! !

! !

! !

Ex. 9.25 A ship carries 48 flags, 12 each of the colors red, white,blue, and black. Twelve of these flags are placed on a verticalpole in order to communicate a signal to other ships.

Page 23: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 23

Chapter 99.4 The Exponential Generating Function

Ex. 9.25 (continued)(a) How many of these signals use an even number of blue flags andodd number of black flags?

( ) ( )! ! ! ! !

! !

a

the coefficient of in ( ) yields 411.

f x x x x x x x x

e e e e e e e e e

xi

x f x

xx x x x

x x x x

i

i

12

12 4 3 5

2 214

14

1

14

412

2 2 2 4 3 5

2 2 2 2 4

1

12

Page 24: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 24

Chapter 99.4 The Exponential Generating Function

Ex. 9.25 (continued)(b) How many of these signals have at least three white flags orno white flags at all?

( ) ( )! ! !

!( )

!

! !

!

b

the coefficient of in ( ) yields 10,754,218.

g x xx x x

e e xx

e xex e x

i

xxi

x xi

x g x

x x x xx i

ii

i

i

i

12

13 4

2 24

32

3

12

2 3 3 4

3 24 3

2 3

0

0

2

012

Page 25: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 25

Chapter 9Ex. 9.26 Assign 11 new employees to 4 subdivisions. Eachsubdivision will get at least one new employees..

Each subdivision can be selected from 1 time to 8 times.

Hence the e.g.f. is ( ) +!

The

coefficient of !

is what we want. It is easier to work with

+!

The coefficient of !

is

411

f x xx x x

x

x x x x e e e e

e x

ii

x x x x

x

i

i

2 3 8 4

11

2 3 8 44 4 3 2

11

11 11 11 11

0

4

2 3 8

11

2 3 81 4 6

4 111

4 3 6 2 4 1 14

4

! !.

! !

.

( ) ( ) ( ) ( ) ( )

the number of onto functions

Page 26: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 26

Chapter 99.5 The Summation Operator

The prefix sum sequence of a sequence is Let ( ) be the generating

function of Then ( )-

Therefore, ( )-

is the g. f. of the prefix sum.sequence.

00

0

a a aa a a a a a f x

a a a f xx

a a x a x

x x a a a x a a a xf x

x

, , ,, , , .

, , , .

( ) ( )

1 20 1 0 1 2

1 2 0 1 22

20 0 1 0 1 2

21

1

1

Page 27: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 27

Chapter 99.5 The Summation Operator

Ex. 9.27 Find a formula for 0

The g. f. of 0 is ( + )

( - )Therefore, the g. f. of 0 0 0 is

( + )

( - ) The coefficient of is what we wnat.

( + )

( - )

2

2

2 2 2

1 2

1 2 1

11 1 2

1

11

11

40

41

42

2 2 2

2 23

2 2 2

4

42 4

2 2

nx x

x

x x

xx

x x

xx x x

x x x x

n

.

, , , .

, , ,

.

( )( )

( )

Ansn n

n n n

n n: ( ) ( )

( )( )

41

142

1

1 2 16

1 2

Page 28: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 28

Chapter 9Summaries (m objects, n containers)

Objects Containers Some Number Are Are Containers ofDistinct Distinct May Be Empty Distributions Yes Yes Yes nm Yes Yes No n!S(m,n) Yes No Yes S(m,1)+S(m,2)+...+S(m,n) Yes No No S(m,n) No Yes Yes No Yes No No No Yes (1) p(m), for n=m No No No (2) p(m,1)+p(m,2)+...+p(m,n), n<m p(m,n)

n mm

1n m n

m n

( ) 1

p(m.n):number of partitions of m into exactly n summands

Page 29: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 9

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 29

Chapter 9

Exercise: P390: 6 P399: 18,20 P403: 9,10 P408: 6