GENERATING FUNCTIONS Solve a ifiite umber of related problems i oe swoop. *Code the problems, maipulate the code, the decode the aswer! Really a algebraic cocept but ca be eteded to aalytic basis for iterestig results. (i) Ordiary Geeratig Fuctios {a 0, a,, a, } sequece where the th term is the solutio of some problem, for every. Create the object ( formal power series ) a where is lie a place-holder for a. This loos lie a aalytic power series but it s NOT (ot 0 yet, ayway). Rules of Operatio: just do what comes aturally. ( ) a ± b a ± b ( ) ( ) a b c where c Eamples j0 a b j - j (I) a, 0 a 0 > 0 + a + + _ + - - why is last equality true? Because... ( + + + )( - ) + + + + - - _ - - + - (ii) a.
0 - + ( - ) - 0 0 0 0 NOTE: You do t eed aythig about covergece! At the same time, you should t thi of as a variable ito which you substitute values (ot yet, ayway) but soo it will be OK). (iii) If we have the o.g.f., we ca fid the sequece: e.g. Suppose the o.g.f. is ( + ) the the sequece is foud as follows: ( + ) 0 Thus, a (ote that a 0 for > ). Epoetial Geeratig Fuctio a {a 0, a,, a, }!. 0 a! b! c!, where c j a j b - j c a b j j0 j0 - j c! j0 a j j! b ( j)! Eamples (i) a, 0 ; a 0 for >
0! (ii) a 0! e (iii) a ( umber of -perms of a -set) (iv) If we have the e.g.f. si the (-) si ( + )! 0 + so a + (-) 0 a 0 0 Some Geeratig Fuctio Maipulatios Suppose A() a, B() - The A() B)() d where c a j a j j0 j0 d - Similarly, A () where d j0 a a j - j e.g. a the 0 3
- Also, [A() - a 0 ] a + 0, which is the o.g.f. for the sequece {a,a,,a, } which is the origial sequece shifted oe place to the left (ad the first term dropped off). By cotrast, A() 0 a + which is a - 0 + 0 or the o.g.f. for the sequece {0, a 0, a,, a, } ( + ) th place. d d 0 a a - which is the o.g.f. for {a, a, 3a 3,, a, All of those ideas carry over to e.g.f. i a aalogous way. Applicatios to Coutig Problems Here the coefficiets of the powers of ca provide the aswers we see, e.g.. Ordiary Geeratig Fuctios How ca we eumerate all possible selectios from 3 distict objects a,b,c? + a a is chose (a) or ot () + b b is chose (b) or ot () + c c is chose (c) or ot () By product rule, ( + a)( + b)( + c) all possible selectios + (a + b + c) + (ab + bc + ac) + (abc) 3 oe object, either objects 3 objects a,b,c Suppose we oly wish the umber of selectios of,,3 of the objects. The we ca cout this umber by weightig each selectio with weight. This is equivalet to settig 4
a b c. + 3 + 3 + 3 ( + ) 3 How may ways to select r balls from gree, 3 gold, 4 blue, 8 red? Here the order of the selectio of the balls does t matter. You ca select 0,, or 3 gree balls, so + + + 3 eumerates these choices. But this is the same for the gold balls. For the blue it is + + + 3 + 4, for the red + + + 8. Hece solutio is coefficiet of r i ( + + + 3 ) ( + + + 3 + 4 ) ( + + + 8 ) I geeral we have: Suppose we have p types of objects, with i idistiguishable objects of type i, i,,, p. The umber of ways to pic objects if we ca pic ay umber of objects of each type is give by the coefficiet of i p (+ +_+ )( + +_+ )_ (+ +_+ ) Suppose the umber of each type of object is ifiite (thi of this as solutios with repetitio allowed). The the above formula becomes ( + + + + ) p - p (- ) -p The coefficiet of i this is - p (-) or p+ - (o-distict balls, distict boes) Eercise: Fid the umber of ways to distribute r idetical balls ito 5 distict boes with a eve umber of balls, ot eceedig 0, i each of the first two boes, ad betwee 3 ad 5 balls i the other 3 boes. Let the umber i bo i be e i. The i r 0 e, e, 0, e, e eve 3 e 3, e 4, e 5 5 The geeratig fuctio for the solutio is ( + + 4 + 6 + 8 + 0 ) ( 3 + 4 + 5 ) 3 ad the solutio is the coefficiet of r i the above geeratig fuctios 5 e i Eercise: Fid umber of ways to distribute 5 idetical balls ito 7 distict boes if first bo has up to 0 balls, other boes ay umber. [ 5 ] G() [ 5 ] ( + + 0 )( + + + ) 6 5
[ 5 ] - - - 6 [ 5 ] ( - ) ( - ) -7 7 + r- [ 5 ] ( - ) r r r [ 5 ] 7 + 5-5 - 7 + 4-4 3 5-0 4 N.B. Could have argued this directly, viz., fill the boes without costrait i 7 + 5-5 ways, how may of these have at least balls i bo is 7 + 4-4, ow subtract. So g.f. ot always required. Evaluate: 0 Recall that (Absorptio) - - 0 - - 0 6
- - + 0 - - -- 0 The sum is the coefficiet of - i the product - ( + ) - ( + ) ( + ) -, which is just -. Thus 0 - - Fid the umber of iteger solutios to + + + with 0 a i i b i Geeratig fuctio for variable i is A i (z) i ai ai+ bi A (z) z + z _+ z The composite geeratig fuctio is A(z) A (z) A (z) A (z) The solutio is the coefficiet of z i A(z), [z ] A(z) Note: Techically we ca eted the above to allow egative values of the i. Thus, to fid the umber of iteger solutios of + + + 0, - i, the ogf is (z - + z - + + z + z ) 0, ad the solutio is [z ](z - + z - + + z + z )0. Verify by had that this wors for 4. Maig Chage How may ways to mae chage for a buc usig icels, dimes, ad quarters? ogf icels ogf dimes ogf quarters A (z) + z 5 + z 0 + z 5 + A (z) + z 0 + z 0 + z 30 + A 3 (z) + z 5 + z 50 + z 75 + Required ogf A(z) A (z) A (z) A 3 (z) Solutio is [z 00 ] A(z) Here, to determie coefficiet, must multiply out (trucate each series at z 00 ). 7
Eercise: Suppose we also used peies. How would the solutio the relate to the ogf foud above. Solutio: It would be the sum of all the coefficiets i A(z) above for terms with degree 00. Prove this. Partitios of a Iteger * partitio of is uordered collectio of positive itegers that sum to. For coveiece, ofte put parts i decreasig order. ( summads ) Eg. Partitios of 4 : 4, 3 +, +, + +, + + p() umber of partitios of ; p(4) 5 As distributio problem, this is idistiguishable balls ito idistiguishable ito idistiguishable boes. Notice how this differs from iteger solutios to a equatio (where boes (variables) distiguishable). To partitio a umber, we have to ow how may of the summads are,, 3,. The ogf for the 's is + z + z + z 3 + - z for the 's is + z + z 4 + - z ad so o. Thus p(z) - z - z - z _ 3 (ifiite product) Eercise: Fid the umber of partitios of ito summads 6. Solutio: Eercise: Fid the ogf for a, the umber of ways to partitio ito distict summads. Solutio: There ca be at most of ay type of summad, so ogf is A(z) ( + z) ( + z ) ( + z 3 ) 0 or 0 or 0 or oe two three Notice: A(z) Π -z - z r r Π r - z - 8
r r which is the ogf for partitios with oly odd summads.. Epoetial Geeratig Fuctio Suppose we have p types of objects with i idistiguishable objects of type i, i,,, p. The umber of perms of legth with up to i objects of type i is the coefficiet of! i the egf + +! +_+ + +! +_+ SUP! _ + +! +_+ p p! Notice that if there is a ulimited umber of objects of each type, the egf is (e ) p ad the umber of perms of legth with a arbitary umber of objects of type i is the coefficiet of! i e p, i.e. (st place ca be filled i p ways, same for the secod, third, etc!!) To prove this, ote that the coefficiet of! i the product is!!!_! p where the sum is over all possible,,, p +, + + p, i 0. This is because the way to fid a term i the product with is to have a product p!! _ p! where + + p. Now mult. top ad 9
bottom by! ad sum over all possible such terms. Eercise: Fid the umber of arragemets of r items selected from distict items, o repetitio allowed. EGF for item i is +, EGF for all is ( + ), i,, Eercise: Fid the umber of ways to place 5 people ito 3 differet rooms with at least oe perso i each room. Solutio: For the first room, there is oly way to place ay umber of persos i that room. Hece the e.g.f. is 3 +! + +_ e - 3!. Thus, sice the 3 rooms are differet, the e.g.f. for the 3 rooms is (e - ) 3 e 3-3e + 3e -. Thus, 5 5! (e -) 3 5 5! r (3-3 + 3) r r r r 3 5-3 5 + 3 I the terms of the earlier result, p 3. What we cout is the umber of perms of legth 5 o {,,3} i which all of,,3 appear (o room empty). The reaso these are perms (ad ot merely selectios as for o.g.f.) is that the people are distict - to each assigmet of rooms to people we correspod a arragemet of 's, 's, 3's. Fid the umber of strigs of legth that ca be costructed usig {a,b,c,d,e} if: a) b occurs a odd umber of times b) both a ad b occur a odd umber of times. a) Order is importat, so use e.g.f. egf for b: egf for all others + 3 3! + 5 5! +_ e - e - + +! + 3 3! +_ e egf (e ) 4 e - e - (e 5 - e 3 ) 0
[ ] is (5-3 ). b) By similar reasoig, solutio is - 3 [ ] is (e - e ) e [ ] 4 (5-3 + ) Distiguishable Balls, Distiguishable Boes Revisited: Stirlig No. of d Kid Number of ways to put distict balls ito o-distict boes S(,) (o bo empty) If the boes are distict there are!s(,) distributios. Suppose ball i goes ito bo C(i). This gives a sequece C(), C(),, C() usig the umbers,,, with each umber used at least oce. The e.g.f. for each umber is +! + _+! +_ e - so for all the e.g.f. is (e - ). The coefficiet of! i (e - ) is precisely! S(,); we ca compute it as follows: i (-i) (-) e (e -) H() i0 i. Substitute ( - i) for i the usual series for e! 0 to get H() i0 i (-) i 0! (- i) SUP 0! i0 (-) i (- i) i
(-)! S(,) i0 i (- i ) i S(,) i0 (- i (- i Eercise Fid the umber of r-digit quateary requeces (digits 0,,,3) with a eve umber of zeros. Off umber of 's. Egf for 0's egf for 's 4 r r- 4 4 if r > 0 Simple form combiatorial argumet eists. Ca you fid oe?