Generating Functions - Generating Functions In this chapter...

Info iconThis preview shows pages 1–18. Sign up to view the full content.

View Full Document Right Arrow Icon
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 6
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 8
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 10
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 12
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 14
Background image of page 15

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 16
Background image of page 17

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 18
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Generating Functions In this chapter and the next, we continue our study of enumeration, introducing at this time i the important concept of the generating function. , The problem of making selections, with repetitions allowed, was studied in Chapter I. There we sought, for example, the number of integer solutions to the equation cl + c; + c3 + c4 = 25 where c, 2 0 for all 1 5 i 5 4. With the Principle of Inclusion and Exclusion, in Chapter 8, we were able to solve a more restricted version of the problem, such as (:1 + C: + (:3 + C4 : 25 with 0 f c,- < 10 for all 1 5i 5 4. If, in addition, we wanted C3 to be even and C3 to be a multiple of 3, we could apply the results of Chapters 1 and 8 to several subcases. The power of the generating function rests upon its ability not only to solve the kinds of problems we have considered so far but also to aid us in new situations where additional restrictions may be involved. 9.] Introductory Examples EXAMPLE 9.] l Instead of defining a generating function at this point. we shall examine some examples that motivate the idea. While shopping one Saturday, Mildred buys 12 oranges for her children, Grace, Mary, and Frank. In how many ways can she distribute the oranges so that Grace gets at least four, and Mary and Frank get at least two, but Frank gets no more than five? Table 9.1 lists Table 9.1 G M F G M F 4 3 5 6 2 4 4 4 4 6 3 3 4 5 3 ,6 4 2 4 6 2 7 2 3 5 2 5 7 3 2 5 3 4 8 2 2 5 4 3 5 5 2 415 416 EXAMPLE 9.2 Chapter 9 Generating Functions all the possible distributions. We see that we have all the integer solutions to the equation cl +63 +03 :12where45c1.2 §c3,and2503 :5. Considering the first two cases in this table, we find the solutions 4 + 3 + 5 : l2 and 4 + 4 + 4 = 12. Now where in our prior algebraic experiences did anything like this happen? When multiplying polynomials we add the powers of the variable. and here, when we multiply the three polynomials, (x4 + x5 + x6 + x7 +x8)(.\‘2 + x3 + x4 + x5 + 166W2 + F +164 + 1'5). 1 two of the ways to obtain .t‘ 3 are as follows: 1) From the pi‘oductx4x3x5. where .r_4 is taken from (x4 + xi + X6 + .r7 + x8), x3 from (x2 + x3 + x4 + x" + x6), and x3 from (x2 + x3 + )r4 +x*’). 2) From the product .r4x“x4, where the first x4 is found in the first polynomial, the second x4 in the second polynomial, and the third x4 in the third polynomial. Examining the product (x4 + x5 + x6 + x7 + 1C8)(x2 + x3 +x4 4— x5 + Jc6)(,r2 + x3 + 1c"l + x5) more closely, we realize that we obtain the product xix/Ix" for every triple (i, j, k) that appears in Table 9.1. Consequently, the coefficient of x12 in f(x) = (xJr —l— x5 + x6 + x7 + ,r8)(.r2 +x3 + x4 + x5 + ,rf’)(,r2 + x3 + .r‘1 + 2?) counts the number of distributions—namely, 14—that we seek. The function f(x) is called a generating function for the distributions. But where did the factors in this product come from? The factor x4 + x5 + x6 + x7 + x8. for example, indicates that we can give Grace 4 or 5 0r 6 or 7 or 8 of the oranges. Once again we make use of the interplay between the exclusive or and ordinary addition, The coefficient of each power of x is 1 because, considering the oranges as identical objects, there is only one way to give Grace four oranges, one way to give her five oranges, and so on. Since Mary and Frank must each receive at least two oranges, the other terms (xi + x3 + x4 + x5 + x6) and (x2 + x3 + x4 + x5) start with .rZ, and for Frank we stop at P so that he doesn’t receive more than five oranges. (Why does the term for Mary stop at .ré?) Most of us are reasonably convinced now that the coefficient of .r '3 in f(x) yields the answer. Some, however, may be a bit skeptical about this new idea. It seems that we could list the cases in Table 9.1 faster than we could multiply out the three factors in f(x) or calculate the coefficient r” in f (x). At present that may seem true. But as we progress to problems with more unknowns and larger quantities to distribute, the generating function will more than demonstrate its worth. (The reader may realize that the rook polynomials of Chapter 8 are examples of generating functions.) For now we consider two more examples. _——_—I—-——-_—___—_ If there is an unlimited number (or at least 24 of each color) of red, green, white, and black jelly beans, in how many ways can Douglas select 24 of these} candies so that he has an even number of white beans and at least six black ones? The polynomials associated with the jelly bean colors are as follows: 0 red (green): 1 + x + x3 + - ~ v + x24, where the leading 1 is for 1x0, because one possibility for the red (and green) jelly beans is that none of that color is selected (1+x3+x4+x6+~~+x24) (x6+x7+x8+_u+x24) 0 white: 0 black: EXAMPLE 9.3 417 9.] Introductory Examples So the answer to the problem is the coefficient of 1‘24 in the generating function ,/‘(x) = (1+x +x2 + a . ‘ +x34)3(i +x2 +x‘ + ~ - ~ +x24)(x6 +x7 + x - ~ + x34). One such selection is five red, three green, eight white, and eight blackjelly beans. This arises from x3 in the first factor. x3 in the second factor, and x8 in the last two factors. _—-—'—_l—_————_— One more example before closing this section! How many integer solutions are there for the equation 6, + C3 + C3 + 64 = 25 if() f c; for all 1 5i 5 4‘? We can alternatively ask in how many ways 25 (identical) pennies can be distributed among four children. For each child the possibilities can be described by the polynomial l + x + x2 + x3 —l— . > - + x 35. Then the answer to this problem is the coefficient of x35 in the generating function f(x) : (1 +x +x2 + . - . +.t-3>)4. The answer can also be obtained as the coefficient of x25 in the generating function gtx) =(1+x+x3+x3+-.~+x25+x26+...)4, , if we rephrase the question in terms of distributing, from a large (or unlimited) number of pennies, 25 pennies among four children. [Whereas f(x) is a polynomial, got) is apower series in All Note that the terms .r", for all k 3 26, are never used. So why bother with them? Because there will be times when it is easier to compute with a power series than with a polynomial. W 1. For each of the following, determine a generating function and indicate the coefficient in the function that is needed to solve the problem. (Give both the polynomial and power series forms of the generating function, wherever appropriate.) Find the number of integer solutions for the following equa— trons: a) Ci+C2—-C3+C4:20.0§C,E7f0f€1lllfif4 b) Cl 62 C3 + c4 — 20. O 5 C,- for all 1 5 i 5 4, with c; and 63 even i C) C1 Cz+C3lC4 C5T30,256154afld3:Ci58 forallZgigS d) C1+C2+C3+C4’“C5 =30,0:c,- for all l Si :5, with c; even and C3 odd 2. Determine the generating function for the number of ways to distribute 35 pennies (from an unlimited supply) among five children if (a) there are no restrictions; (b) each child gets at least M: (0) each child gets at least 2¢; (d) the oldest child gets at least 10¢; and (e) the two youngest children must each get at least 10¢. 3. 3) Find the generating function for the number of ways to select 10 candy bars from large supplies of six different kinds. b) Find the generating function for the number of ways to select, with repetitions allowed, r objects from a collection ofn distinct objects. 4. a) Explain why the generating function for the number of ways to have 11 cents in pennies and nickels is (1+x +x2+x3 +~-)(l +x5+x10+<~). b) Find the generating function for the number of ways to have )1 cents in pennies, nickels, and dimes. 5. Find the generating function for the number of integer solutions to the equation c1 + CZ + C3 + c4 = 20 where ~3 :61, —3563, ~5 5c; 55,and0§c4. 6. For S I la, b, c}, consider the function we = (1+ ax)(l + bx)(1+ cx) : l +ax +bx—l—cx +abx2 +acx2 + bcx2 + (1170?. Here, in f(x) 0 The coefficient of x0 is 1 — for the subset 0 of S. 0 The coefficient of x1 is a + b + c~for the subsets {a}. {b}, and {c} of S. 0 The coefficient of x2 is ab +ac + lac—for the subsets {(1.17}, {a, c}, and {Z}, c} of S, 418 Chapter 9 Generating Functions 0 The coefficient of x3 is abc—for the subset (a, b, C} = S. 3) Give the generating function for the subsets of Consequently, f (x) is the generating function for the sub— 5 = {as be Q ~ A « a "a 5: ti- SGIS 0f 54 For When we caICUIate f (1), W6 Obtain a sum Wherei“ b) Answer part (a) for selections wherein each element can each of the eight summands corresponds with a subset of S; be rejected or selected as mam, as thme times‘ the summand 1 corresponds with (5. [If we go one step further and set a = b = c = l in f(x), then f(1) = 8, the number of subsets of S.] 9.2 Definition and Examples: Calculational Techniques In this section we shall examine a number of formulas and examples dealing with power series. These will be used to obtain the coefficients of particular terms in a generating function. We start with the following concept. Definition 9.] Let ao, a1. a2, . t . be a sequence of real numbers. The function [x . f(x) : no —|— tax + (12x2 + - - - = Z cit-xi 1:0 is called the generating function for the given sequence. Where could this idea have come from? , 4" EXAMPLE 9.4 For “my ” E Z * (1+x)” = (n) + (">x + (n>x2 + - - - + (")x”, I 0 l 2 n so (i + x)" is the generating function fOr the sequence (so(zinwcimnu m.- (1—xnt‘)=(i—x)(1+x+x3+x3+m+x”). So 1_xn+l =1+x+x2+---+x”, l—x and (1 — x”+‘)/(1 - x) is the generating function for the sequence 1, l, l, . . . , 1, 0, 0, 0, . . . , where the first n + 1 terms are 1‘ 92 Definition and Examples: Calculational Techniques 419 b) Extending the idea in part (a), we find that l :(1—x)(l+x+x2+x3+x4+...)’ SO l l — x is the generating function for the sequence 1, l, l, l, . . . . [Note that l/(l — x) = l + x + x2 + x3 + a - - is valid for all real x where [x] < l; it is for this set of values that the geometric series I + x + x: + x3 + - - - converges. In our work with generating functions we shall be primarily concerned with the coefficients of the powers of x. However, later in Example 9.18, we shall use this and two other related series to evaluate infinite sums for values within the set of values for which each such infinite series converges] c) With 1 00 _ l_x =l+x+x2+x3+---=§x‘, taking the derivative yields d l d l _ l . ~l V I 1 ‘2 I a. dxl_x dx( x) ( )( x) ( ) (l_x)2 0' ~ 7 : d—(1+x+x2+x"+~-) = l+2x+3x"+4x3+~« x Consequently, 1 (1—K)2 is the generating function for the sequence 1, 2, 3, 4, . . . , while ’ a .2 3 4 (1 “XV —O+lx+2x +3x +4x +~~ is the generating function for the sequence 0, l, 2, 3, . . . . (1) Continuing from part (c), d x d _ :_0 ‘22 33 dx(1_x)2 dx( +x+ x + x + ) or + l {Tb—3 21+22x+31x2+42x3+m. Hence, )5 + l (1 —x)3 generates 12, 22, 32, . . . , and x(x +1) (1 —X)3 generates 02, 12, 22, 32, . . . . 420 Chapter 9 Generating Functions e) Now let us take one more look at the results in parts (b), (c), ((1) —along with some extensions. But this time we have a change in the notation: :1+,t~+x3+x3+~- foOC) : l—x . ‘W 61 _ frU) # Xfifofl’c) * (l—x)2 ZO+X+2x2+3.r3+‘-- . _ d . _ x2+x fz(A)VX;l;fr(X) * (l_x)3 = 02 +12x + 22x2 + 32x3 + - ~ d x3+4x2+x f3(X) defzbc) (1_x)4 =03+ l3x+23x2+33x3+-~ x4+ llx3+ llx3+x (lflc)5 = 04 + 14x + 24);: + 34163 + ‘ H d f4(x) ‘xd f3(x) — x Now look at the output for the Maple code in Fig. 9.1. Here we find the numerators for f0(x), f1(x), . . . , f4 (x), along with those for f5 (x) and f6(x) [where the denominators are (l — x)6 and (l — x)7, respectively]. The coefficients for these numerators are exactly the Eulerian numbers we introduced in Example 4.21. We choose not to pursue this here, but the interested reader, who wants to examine this connection further, should look into reference [4]. i> f||0(x) := 1/(1-X); f0(x) 2: l‘x > for i from 1 to 6 do > in(x) := simplify(x*diff(f|[(i—l)(x),x)): > print(sox1:(expand((—1)"(i+1)*numer(fl |i(x))))); > 0d: I x z X +X 7 x3+4x’+x x4+11x3+11x2+x x5+26x4+66x3+26x2+x _ 16+57x5+302x4+302x3+57x2+x Figure 9.1 9.2 Definition and Examples: Calculational Techniques 42] EXAMPLE 9 6 a) Rewriting the result in part (b) of Example 9.5, we have Upon substituting 2x for y, we then learn that 1 2 =l+(2x)+(2x)2+(2x)3+~~=l+2x+22x2+23x3+-~-, — x 7 so 1/(1 — 2x) is the generating function for the sequence 1 (I 20), 2 (2 2‘), 2‘, 23. . . ..Infact,foreacha E R, itfollows that l/(l — ax) = l + (ax) + (ax)2 + (ax)3 + - - - = l + ax + azx2 + a3x3 + - - - , so l/(l w ax) is the generating function for the sequence 1 (= (10), a (= a1), a2, a3, . . . . [Here we want 00 = l for the case where a = 0.] b) Again, from part (b) of Example 9.5, we know that the generating function for the sequence 1, l, l, l, . . . is f(x) = l/(l — x). Therefore the function 1 7 _x— 806) = for) “x2 = l—x is the generating function for the sequence 1, l, O, l, l, l, . . . , while the function hm : f(.r)+2x3 = 1 1 generates the sequence 1, l, l, 3, l, l, . . . . c) Finally, can we use the results of Example 9.5 to find a generating function for the sequence 0, 2, 6, 12, 20, 30, 42, . . . ? Here we observe that a():0:OZ+0, a1:2:l2+l, a2:6=22+2, a3=12:33+3, 04:20:42+4,.... In general, we have (1,1 = n2 + n, for each n 3 0. , Using the results from parts (0) and (d) of Example 9.5, we now find that x(x+l)+ x *x(x+l)+x(l~x) _ 2x (1—103 (1—IC)2 (1—03 (l—x)3 is the generating function for the given sequence. (The solution here depends upon our ability to recognize each an as the sum of n2 and n. If we do not see this, we may be unable to answer the given question. Consequently, in Example 10.6 of the next chapter, we shall examine another technique to help us recognize the formula for an .) ———-————-—_—_——_____ For each n e Z+, the binomial theorem tells us that (1 + x)” = + + (9x2 + - - - + fax". We want to extend this idea to cases where (a) n < 0 and (b) n is not necessarily an integer. 422 Chapter 9 Generating Functions ‘ with“ “fleet 3:2:r»>'0,2weihava 1 n, (,2 / '_,i<z-'(iz’—iit>i<:jzg , ‘ ' " it‘li‘ltn 4r)! i _ .v f', C ’ “a: ; a _ v IfnjeRiwe’usef’q l ‘ ‘ : ~ —j~ 1*)112352)" . <; has. thcdefinifienpf (31).)": .» , a ‘ ’fl’E/Z‘E'Wéhév Thehtiféfeaafiifie “ 1C; 5 111.9532; 4 ' way, + < - . ,n .‘ . EXAMPLE 9.7 For n E Z , the Maclaurin series expansmn for (l + 1:) Is given by (1 l x)‘” — 1+( n)x+( n)( n [Ml/2! + (~n)(—n — l)(—n — 2)x3/3! + . -. ~1+ Z (—n)(—n — l)(—rz ~— 2) ~ O - (—n — r + UK —1 M _ r! x — 1 = Z<—1>”(” J” r:0 r Hence (1 + x)_” = (—0") + (3”)x + (71))? + - « . = :0 (—”)x’. This generalizes the u r binomial theorem of Chapter 1 and shows us that (1 +x)“" is the generating function for the sequence (“0”), (—1”), (3"), . . . . Find the coefficient of x5 in (1 — 2x)”. 1 EXAMPLE 9'8 With y = —2x, use the result in Example 9.7 to write (1 — 2x)“7 = (1+ y)‘7 = :10 (77)y’ = :0 (77)(—2x)’. Consequently, the coefficient of x5 is (—57)(——2)5 = (—1)5(7+§— 1)(—32) = (32mg) 2 14,784. For each real number n, the Maclaurin series expansion for (1 + x)” is EXAMPLE 9.9 1+ nx + n(n —1)x2/21-+ n(n —-1)(n — 2)x3/3! + - ‘- w 00n(n—1)(n——2)-~(n—r+l)r —1+; r! x. EXAMPLE 9.10 EXAMPLE 9.“ l EXAMPLE 9.12 l 423 9.2 Definition and Examples: Calculational Techniques Therefore, (1 + 3104/3 : 1 + Z («1/3><~4/3)(~7/3) - < ‘ ((—3r + 2>/3> r=l 21+ (*l)(—4)(—7) ‘ ' ‘ (—3r + 2%,, r:l (3x)r r! rl and (1+ 3,’c)‘l/3 generates the sequence 1, —l, (~l)(~4)/2l. ('~l)(—4)(\—7)/3l, . . ., (—l)(—4)(—7) - ‘ - (-3r + 2)/r!, . a .. ——--—-—-————_—___________ Determine the coefficient of x15 in f(.r) = (x2 + x3 + x4 + - v 04‘ Since ()62 +163 +264 + ~ - ‘) = x2(l +x +x2 + ~ - -) = XZ/(l — x), the coefficient of x15 in for) is the coefficient of x15 in (xZ/(l — .r))4 : xg/(l — M4. Hence the coefficient sought is that ofx7 in (1 — x)"4, namely, (7‘)(~1)7 : (—1)7(4+;‘1)(—l)7 = (170) z 120. In general, for n e ZT, the coefficient of x” in f(x) is 0, when 0 5 n 5 7‘ For all n 3 8, the coefficient of x” in f(x) is the coefficient of x”_8 in (l ~x)‘4, which is (":48) - (—1)“; 2 (2:33} -——-——-—————_—_____ Before continuing, we collect the identities shown in Table 9.2 (on page 424) for future reference. The next two examples show how generating functions can be applied to derive some of our earlier results. In how many ways can we select, with repetitions allowed, r objects from n distinct objects? For each of the n distinct objects, the geometric series 1 + x + x2 + x3 + ‘ - - represents the possible choices for that object (namely none, one, two, . . .) . Considering all of the n distinct objects, the generating function is foe) =(1+x+x2+x3+~-)", and the required answer is the coefficient of x’ in f (x). Now from identities 5 and 8 in Table 9.2 we have ‘ l n l 00 n+i~l r 1 2 3 ...”= : _..__..: J1! (“H H + ) (1—x> (l—x)" 2( i )‘ i=0 so the coefficient of x’ is the result We found in Chapter 1. W Once again we consider the problem of counting the compositions of a positive integer n — this time using generating functions. Start with x =x+x2+x3+x4+'~ l—x 424 Chapter 9 Generating Functions Table 9.2 "in a six)“ S=‘ (3) (9x 4: (W +- -’ 4+ (axe-:1 : . . i “an wee-(31* (riax‘ne (%)a2x?+ than , i 3) ea— e (a) + in“ +~(3)x2t + (i: xmfi‘ * ‘ * .4)“ («tears/<1: ~.,x.>,.~—~;1 fl’+ x? "M". ' j ’ 71; 5) C1y(:1ji;x)‘:g{1,+.x 12x24” x3,+ .p.‘,.f:‘ ; . é)Elf/{ism}:mice)etaxfiejfraee;, ' " where, for example, the coefficient of x4 is 1, for the one—summand composition of 4w namely, 4, To obtain the number of compositions of n where there are two summands, we need the coefficient ofx” in (x +x2 + x3 +x4 + - - -)2 = [x/(l — X)l2 = xZ/(l — x)2, Here, for instance, we obtain x4 in (x + x2 + x3 + x4 + - < -)2 from the products x1 ~ x3, x2 -x2, and x3 -xl. So the coefficient of x4 in xZ/(l — x)2 is 3—for the three two- summand compositions l + 3, 2 + 2, and 3 + 1 (of 4). Continuing with the three-summand compositions we now examine (x + )c2 —l— x3 + x4 —l— - «- 3 : [x/(l — x)]3 2 x3/(1— x)3. Once again we look at the ways x4 comes about— namely, from the products x1 ‘ x1 ~ x2, x1 ~ x2 < x1, x2 - xl - x1. So here the coefficient of x4 is 3, which accounts for the composi- tions 1 + 1 —l— 2, l + 2 + 1, and 2 + 1 + l (of 4). Finally, the coefficient of):4 in (x + x2 + x3 + x4 +-~)*1 = [x/(l — x)]4 = x4/(l — x)4 is l—for the one four-summand compo— sition1+ 1+1+1(0f4), The results in the previous paragraph tell us that the coefficient ofx4 in 1 [x /(1 — x)]i is l + 3 + 3 + 1 = 8 (= 23), the number of compositions of 4. In fact, this is also the coefficient of x4 in Zillx/ (1 — x)]i. Generalizing the situation we find that the number of compositions of a positive integer n is the coefficient of x” in the generating function 9.2 Definition and Examples: Calculational Techniques 425 f(.r) = 2:1[x/(l — Ml". But if we set y = x/(l — x), it then follows that Iii/“4:” “(1 it) ‘(1 il—i—i:>l H (l l l X/(1 * Zr) =.r[1+(2x)+(2x)2 + (2,03 + . . .] = 20x + Z‘x2 —l— 22x3 + 23x4 + . . . _ So the number of compositions ofa positive integer n is the coefficient ofx” in f(x) — and this is 2”“‘ (as we found earlier in Examples 1.37. 3.11, and 4.12.) Ml Before we look at any specific compositions, let us start by examining identity 4 in Table ' 9.2. When x is replaced by 2 in this identity, the result tells us that for all 11 E Z+, 1 + 2 —l— 22 + - . . + 2" : (1 ~ 2”“)/(1 — 2) : 2”“ — 1. [This result was also established by the Principle of Mathematical Inductionwin part (a) of Exercise 2 for Section 4.1.] All well and good~but where would one ever use such a formula? In Table 9.3 we find the special compositions of 6 and 7 that read the same left to right as right to left. These are the palindromes of6 and 7. We find that for7 there are 1 + (1 + 2 + 4) = l + (l —|— 21 + 22) = l —l— (23 — l) = 23 palindromes. There is one palindrome with one summand~namely, 7. There is also one palindrome Where the center summand is 5 and where we place the one composition of 1 on either side of this summand. TableQJ 1) 6 (I) l)‘ 7 (1) 2) 1+4+1 (l) 2) l+5+1 (1) 3 2+2+2 3 2+3 2 ) <2) ) + (2) 4) 1+1+2+1+1 4) 1+1+3+1+1 5) 3+3 5) 3+l+3 6) l+2+2+l 6) 1+2+1+2+1 (4) (4) 7) 2+1+1+2 7) 2+i+1+1+2 8)l+l+1+l+1+l 1’8) i+1+1+1+i+i+1 ‘ J For the center summand 3 we place one of the two compositions of 2 on the right (of 3) and then match it on the left, with the same composition, in reverse order. This procedure provides the third and fourth palindromes of 7 in the table. Finally, when the center summand is 1, we put a given composition of 3 on the right of this 1 and match it on the left with the same composition, in reverse order. There are 23‘1 = 4 compositions of 3, so this procedure results in the last four palindromes of 7 in the table. The situation is similar for the palindromes of 6 except for the case where, instead of 0 as the center summand. a plus sign appears in the center. Here we obtain the last 23“1 = 4 palindromes of 6 in the table—one for each composition of 3. Summarizing for n = 6 we have i) Center summand 6 1 palindrome ii) Center summand 4 1 (I 21") palindrome iii) Center summand 2 2 (= 22‘1) palindromes iv) Plus sign at the center 4 (= 23—1) palindromes 426 Chapter 9 Generating Functions So there are 1+ (1 + 21 + 23) = l + (23 — l) 2 23 palindromes for 6. Now we look at the general situation. For n 2 1 there is one palindrome. If n : 2k + l, for k e Z+, then there is one palindrome with center summand n. For 1 5 t 5 k, there are 2’” palindromes of n with center summand n — 2t. (One palindrome for each of the 2’” compositions of t.) Hence the total number of palindromes of n is l + (l + 2l + 22 + - ~ - + 2"”) = 1+ (2" — l) : 2" = 2(”"”/2. Now consider n even, say n = 2k, for k E Z+. Here there is also one palindrome with center summand n and, for l f s f k + 1, there are 25‘[ palindromes of n with center summand n — 25. (One palindrome for each of the 2*1 compositions of S.) In addition, there are 2"” palindromes where a plus sign is at the center. (One palindrome for each of the 2’"1 compositions of k.) In total, n has 1+ (1 + 21+ 22 + 3 - a + 2’"2 + 2"”) = 1+ (2" — 1) I 2" = 2’”2 palindromes. The preceding results can be simplified. Observe that for n 6 2+, n has 2W2J palin— dromes. Having dealt with compositions (once again)“and palindromes, we continue at this point with some additional examples dealing with generating functions. In how many ways can a police captain distribute 24 rifie shells to four police officers so ' that each officer gets at least three shells, but not more than eight? The choices for the number of shells each officer receives are given by x3 + x"L + ~ - e + x8. There are four officers, so the resulting generating function is f(x) = (x3 +x4 + ~ - - +x8)4_ We seek the coefficient ofx24 in f(x). With (x3 + x4 + < . - + r8)4 : x13(l + + x2 + ~ - +x5)4 = xlz((l — x6)/(1 — x))4, the answer is the coefficient of x” in (l — x6)4 - (1— “‘4 =11 — (W6 + (3%12 " (9)618 + 1524] ii?) + (34%”) + (3419“: + ‘ ' ‘lv Whichis liii)<“1)12 ‘ (ili24)(—U6 + (3mm 2 l 1’?) * (3(2) +191 : 125- Verify that for all n e z+, (2,7) = 2;, (7)2. Since (1 + x)2” = [(1 + x)"]2, by comparison of coefficients (of like powers of x), the coefficient of x” in (1+x)2”, which is (2”), must equal the coefficient of x” in fl [(3) + (ax + (9162+ ‘ - - + (:W and this is (on) + (mm + (3)912) + - - - + . With (it) 2 (air), for 21110 E r E n, the result follows. . . . 1 Determine the coefficrent of x8 in EXAMPLE 9.16 (x ~— 3)(x — 2)2' Sinai 1/06 ~ a)=(—1/a)(1/(1—(x/a))) =(—l/a)[l+(x/a)+(Jc/Ct)2 + ~ ~ -1 for any a 75 0, we could solve this problem by finding the coefficient of x8 in 1/[(x — 3)(x — 2)2] expressed as (—1/3)[1 + (x/3) + (X/3)2 + ~ ~ ~](1/4) [(32) + (flex/2) + (flex/2V + a - -]-' An alternative technique uses the partial fraction decomposition: i _ A + B + C ()c-—3)()c—2)2 x—3 x—Z (Jr—2)? This decomposition implies that 1: A(x —2)2+B(x —2)(x —3)+C(x ~3), EXAMPLE 9.17 427 9.2 Definition and Examples: Calculational Techniques 01‘ 0-x2+ 0-x+l=1=(A+B)x2+(—4A—SB+C)x+(4A+6B—3C). By comparing coefficients (for x2, x, and 1, respectively), we find that A + B = 0, —4A — SB + C 2 O, and 4A + 63 — 3C = 1. Solving these equations yields A = 1, B = —1, and C = —1. Hence 1 _ 1 1 1 x—2 (x——2)2 (x H W — 2P _ (31> 1— (Ix/31 + 1—ix/2i +01) <1—<:/2)>2 =(e‘>:(2>‘+e>:e>’ 7 + (2—1) {(32) if?) (a) +6) (if-)1}- The coefficient Ofxg is (~1/3)(1/3)8 + (1/2)(1/2)8 +(—1/4)(;§)(w1/2)8 = — [(1/3)9 + 7(1/2)‘0]. x—3 Use generating functions to determine how many four—element subsets of S = {1, 2, 3, . . . , 15} contain no consecutive integers. 3) Consider one such subset (say {1, 3, 7, 10}), and write 1 5 1 < 3 < 7 < 10 5 15. We see that this set of inequalities determines the differences 1 ~ 1 = O, 3 — l 2 2, 7 ~ 3 = 4, 10 -— 7 = 3, and 15 — 10 = 5, and these differences sum to 14. Considering another such subsetfisay {2, 5, 11, 15}, we write 1 5 2 < 5 < 11 < 15 5 15; these inequalities yield the differences 1, 3, 6, 4, and O, which also sum to 14. Turning things around, we find that the nonnegative integers 0, 2, 3, 2, and 7 sum to 14 and they are the differences that arise from the inequalities 1 5 1 < 3 < 6 < 8 5 15 (for the subset {1, 3, 6, 8}). These examples suggest a one-to-one correspondence between the four-element subsets to be counted and the integer solutions to C; + cz + C3 + C4 + cs = 14 where O 5 c1, C5, and 2 5 Q, C3, C4. (Note: Here c2, C3, C4 3 2 guarantee that there are no consecutive integers in the subset.) The answer is the coefficient of x14 in f(x) =(1+x+x2+x3+---)(x2+x3+x4+-i-)3(1+x+x2+x3+~i) = x6(1—— x)_5. This then is the coefficient of x8 in (1 —x)-5, which is (-85)(—1)8 = (“3* 1) = (1,2) = 495. b) Another way to look at the problem is as follows. For the subset {1, 3, 7, 10}, we examine the strict inequalities 0 < l < 3 < 7 < 10 < 16 and consider how many integers there are strictly between each successive pair of these numbers. Here we get 0, l, 3, 2, and 5: 0 because there is no integer between 0 and 1, 1 for the integer 2 between 1 and 3, 3 for the integers 4, 5, 6 between 3 and 7, and so on. These five integers sum to 11. When we do the same thing for the subset {2, 5, ll, 15}, the strict inequalities O < 2 < 5 < 11 < 15 < 16 yield the results 1, 2, 5, 3, and 0, which also sum to 11. 428 EXAMPLE 9.181 I ChaPter 9 Generating Functions On the other hand, we find that the nonnegative integers 0, l, 2, l, and 7 add up to ll and they arise as the numbers of distinct integers between the integers in the five successive strict inequalities 0 < l < 3 < 6 < 8 < 16. These correspond to the subset { l. 3, 6, 8}. These results suggest a one—to—one correspondence between the desired subsets and the integer solutions to bi + b; + [93 + b; + [95 = ll, where 0 _<_ b1, b5 and l 5 b2, [93, [74. (Note: In this case, [21, b3. b3 3 l guarantee that there are no consecutive integers in the subset.) The number of these solutions is the coefficient of x ” in g(x) =(1+x+x2+<~)(x+x3+x3+~~)3(l+x+x2+~-) =.r3(l —x)“5. The answer is (—85) (— l)8 = 495, as above. (The reader may now wish to look back at Supplementary Exercise 15 in Chapter 3.) encountered the idea of the sample space. But now that we know about generating functions we will be able to deal with a sample space that is discrete but not finite — that is, a countany infinite+ sample space. a) Suppose that Brianna takes an actuarial examination until she passes it, Further, sup- pose the probability that Brianna passes the examination on any given attempt is 0.8 and that the result of each attempt, after the first, is .independent of any previous at~ tempt. If we let Pdenote “pass” and F denote “fail”. for any given attempt, then here our sample space may be expressed as 3] 2 (P, FP, FFP, FFFP, . . .}, where, for example, Pr (FFP) — the probability Brianna fails the exam twice before she passes it ~ is given by (0.2)Z(0.8). In addition, the sum of the probabilities for the outcomes in 9’ is (0.8) + (0.2)(0.8) + (0.2)3(0.8) + (0.2)3(0.8) + a - - = :O(O.Z)i(0.8) = (0.8) 2:0(02fl = (0.8) (I 102) = (0.8) I l, as it should be —— for according to the second axiom of probability (in Section 3.5) we expect Pr(5f) = 1. [Note that S_l‘19':()(0.2)i = I 10.2 follows from the result in part (b) of Example 9.5. The given geometric series con— verges to 1_10_2 because {0.2! < 1.] b) Now suppose we want to know the probability Brianna passes the exam on an even- numbered attempt. That is, we want Pr(A) where A is the event {FR FFFP, . . .}. At this point let us introduce the discrete random variable Y where Y counts the num- ber of attempts up to and including the one where Brianna passes the exam. Then the probability distribution for Y is given by Pr(Y = y) = (0.2)y’1(0.8), y 3 1. So Pr(A) can be determined as follows: Pr(A) : {:1 Pr(Y = 21') = :1(0.2)2i‘1(0.8) = (0.8) 2,240.2)2H : 0.8[(0.2) + (0.2)3 + (0.2)5 + . - .1 = (O.8)(0.2)[1+(O.2)2 + (0.2)4 + - ~ .1 = (0.8)(0.2) I _ (‘W = = 61. And once again we have used the 0.96 result in part (b) ofExample 9.5, this time withx = (0.2)2, where [(0.2)21 = {0.04} < 1. TThe reader can learn more about countany infinite sets from the material in Appendix 3. iThis example uses material from the optional sections of Chapter 3. It may be skipped without any loss of continuity. 9.2 Definition and Examples: Calculational Techniques 429 c) Continuing with Y, now we’d like to find E (Y ). the number of times Brianna expects to take the actuarial exam before she passes it. To determine E (Y) we’ll start with the formula l/(l — t) = l + t + t2 + l3 + - ‘ - and go one step further. Taking the derivative of both sides, we find [as in Example 9.5(c)] that _2 _ 1 _d l g 2 3 H (on t) (1) “ml dt[1_t] 1+2t+3t+4r+- . where this series likewise convergesT for it] < 1. Therefore, E(Y) : Z yPr(Y = y) = Z y(o.2)~‘“‘(0.8) Fl i=1 2 (0.8) 2 y(0.2)y—l = (0.8)[1 + 2(02) + 3(0.2)2 + 4(0).)3 + A . ~] yzl 1 ~ (0 8) l _ l _ 5 (l - 0.2)2 ' (0.8)2 0.8 4 So Brianna expects to take the exam 1.25 times before she passes it. d) Finally, to determine Var(Y) we first want to find E ( Y2). To do so we first multiply the result in part (c) by t and find [as in Example 9.5(c)] that t (I —t)2 Differentiating both sides of this equation now gives us <1—r>2'<1>—t(2)(1«o<~1)_ 1+; d[ t ] — (0.8) — 1.25. :t+2t2+3t3+4t4+-~. (1 —r)4 (I ~03 A d: (l —r)2 =12+22z+32r3+42z3+m. and this series is also convergenti for [II < 1. So now we have EM) : Z szr(Y = y) 2 Z yZ(0.2)«"*‘<0.8> y=1 y=1 = (0.8) 2 flow—1 = (0.8)[12 + 23(02) + 32(02)2 + 42(02)3 + - < .1 y=l _' 1+o.2 _ 1.2 _is (amid—0.33] (0.8)3 8' 1LUsing the Ratio Test from calculus, one finds that . (n + 1)!" 11111 “900' ntn—l = mg}; " :1 2 m Ange (I + = M0) = ltl- When I 2 i l, lim,Hoe nt"‘1 75 0, so the series does not converge for t = i 1. Consequently, converges for M < 1. :0nce again we use the Ratio Test from calculus. Here this infinite series (11 + 1 Ft” lim n2tn—l "-900 Z 2 2m lim ("+0 2m lim (1+3 =ltl(1)2=ltl. n—>oo "2 name When I = i l,lim,1_>00 rlzz"“1 75 0, so the series does not converge for t = i 1. Consequently, this infinite series converges for M < l. 430 Chapter 9 Generating Functions Consequently, to trial, after the first, is independent of the outcome for a bility of success for each Bernoulli trial is p, If we let the random variable Y count the n then Y is a discrete random variable with pro ny previous trial. Further, the proba— and the probability of failure is q = l — p. umber of trials until we are finally successful, bability distribution given by Pr(Y =y) :6]"T1p, y = 1, 2‘ 3, In addition, we find that 1 E(Y) = — and Var(Y) = 31;. p I p- The following example uses the last identity in Table 9.2. (This identity was used earlier in Examples 9.14 and 9‘ 15 ~ but rather implicitly.) EXAMPLE 9.19 Let f(x) = x/(l ~ x)“. This IS the generating function for the sequence a0, a1, a2, . . . , where ak = k for all k E N. The function g(x) = x(x + l)/(l — x)3 generates the sequence b0, 191,173, .r .,forbk 2 k3, keN. The function h(x) = f (x)g(x) consequently gives us (10/90 + (610171 + a1b0)x + ((10192 + (21191 + 03170))62 + - ~ -, so h(x) is the generating function for the sequence c0, c1, 62, . . . , where for each k E N, Ck =a0bk +albk~l +azbk—2 +"‘+ak~2b2 +Clk—ibi +akb0< Here, for example, we find that 0020-0220 c1 20-12+1-02:0 c~2:0-22+l<12+2-03=l c3=0<32+1-22+2-12+3~02=6 and, in general, ck : Section Exercises.) Whenever a sequence c0, c1, Cg, . . . arises from two generating functions f (x) [for a0, a1, a2, . . .lanngc) [forb0, b1, b2, . . .], as in this example, the sequence c0, cl, c2, . .. is called the convolution of the sequences a0, a1, azt . . . and b0, bi, b2, . . . . —‘\ Our last example provides one more instance of the convolution of sequences. EXAMPLE9.20 F3“ f(x):“(1‘)”:1+x+xz+x3+w and 8(x)=1/(1+x)=l—x+x2— x +~-,wefindthat f(X)g(x)=1/l(1—x)(1+x)l=1/(1—X2)=1+x2+x4+x6+-~. {LO i (k — i)? (We shall simplify this summation formula in the 43] 9.2 Definition and Examples: Calculational Techniques Consequently, the sequence 1, 0, l, O, l, 0, , . , is the convolution of the sequences 1, l, l, l, l, l,...andl,—l, 1,—1, l,~l,.... Mm 1. Find generating functions for the following sequences. [For example, in the case of the sequence 0, l, 3, 9. 27, . . . , the answer required is x/(l — 3x), not 3i,r"+' or simply 0+x+3x2+9x3+-~-.l 2') (3% (it (3%” (3) 1” (fl 20% 30% - ' - ~ 8(5) C) 1, Al, l, ~l, l, —l, . .. d) 0, 0,0, 6, —6, 6, —6, 6,... e)1,0,1,0,1,0,1,,,. f) O,0,l,a,a2,a3,...,a7&0 2. Determine the sequence generated by each of the following generating functions. 3) f(x) 2 (2X — 3)3 C) f(x) = x3/(l 7x3) 8) f(X):1/(3 —x) f) f(x) = l/(l fix) +3x7 ~ l1 3. In each of the following, the function f (x) is the generating function for the sequence a0, a1, a3, . . , , whereas the sequence b) fix) =x4/(1— X) d) f(x) : 1/(1+3x) 50, 191,192, . , . is generated by the function g(x). Express g(.r) in terms of f(x). a) b3 : 3 bn Zari,”€N,n b) 173 = 177 = 7 b" =an,nEN,n753,7 C) [91 2 [73 = biz :2an,fl€N,/’l 7+“ 1,3 d) bl 2 193 2 b7 :3 1),, =26l,1~l-5,IZEN,117é 1,3,7 4. Determine the constant (that is, the coefficient of XO) in (3x2 '“ (2/x))15- 5. a) Find the coefficient of x7 in . (1 +x +x2 +x3 + i - 9‘5. b) Find the coefficient of x7 in (1+x+x2+x3+-~)”forn€Z+. 6. Find the coefficient of x50 in» (x7 + x8 + x9 + - . 06. 7. Find the coefficient ofx20 in (x2 + x3 + x4 + x5 + x6)5. 8. For It E Z+, find in (l + x + x3)(l + x)” the coefficient of (a) 357; (b) x8; and (c) x’ forO 5 r f n + 2. r E Z. 9. Find the coefficient ofx '5 in each of the following. a) x3(l * 2X)“, 1)) (x3 — 5x)/(l — x)3 C) (1+XJ4/(l—XV 10. In how many ways can two dozen identical robots be as— signed to four assembly lines with (a) at least three robots as- signed to each line? (b) at least three, but no more than nine, robots assigned to each line? 11. In how many ways can 3000 identical envelopes be divided, in packages of 25, among four student groups so that each group gets at least 150, but not more than 1000, of the envelopes? 12. Two cases of soft drinks, 24 bottles ofone type and 24 of an— other, are distributed among five surveyors who are conducting taste tests. [n how many ways can the 48 bottles be distributed so that each surveyor gets (a) at least two bottles of each type? (b) at least two bottles of one particular type and at least three of the other? 13. If a fair die is rolled 12 times, what is the probability that the sum of the rolls is 30'? 14. Carol is collecting money from her cousins to have a party for her aunt. If eight of the cousins promise to give $2, $3, $4, or $5 each, and two others each give $5 or $10, what is the probability that Carol will collect exactly $40? 15. In how many ways can Traci select it marbles from a large supply of blue, red, and yellow marbles (all of the same size) if the selection must include an even number of blue ones? i 16. How can Mary split up l2 hamburgers and 16 hot dogs among her sons Richard, Peter, Christopher, and James in such a way that James gets at least one hamburger and three hot dogs, and each of his brothers gets at least two hamburgers but at most five hot dogs? 17. Verify that (l — x ~ x3 — x3 — x4 e x5 -— x6)“ is the gen— erating function for the number of ways the sum 11, where n e N, can be obtained when a single die is rolled an arbitrary number of times, 18. Show that ( l — 4x)‘V2 generates the sequence n E N. 19. a) If a computer generates a random composition of 8, what is the probability the composition is a palindrome? b) Answer the question in part (a) after replacing 8 by n, a fixed positive integer, 20. a) How many palindromes of 11 start with l? with 2‘? with 3? with 4? ...
View Full Document

This note was uploaded on 05/12/2010 for the course MATH 2602 taught by Professor Costello during the Spring '09 term at Georgia Institute of Technology.

Page1 / 18

Generating Functions - Generating Functions In this chapter...

This preview shows document pages 1 - 18. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online