Example: marketing

12 Generating Functions - MIT OpenCourseWare

Mcs-ftl 2010/9/8 0:40 page 355 #36112 Generating FunctionsGenerating Functions are one of the most surprising and useful inventions in Dis-crete Math. Roughly speaking, Generating Functions transform problems aboutse-quencesinto problems aboutfunctions. This is great because we ve got piles ofmathematical machinery for manipulating Functions . Thanks to Generating func-tions, we can then apply all that machinery to problems about sequences. In thisway, we can use Generating Functions to solve all sorts of counting problems. Theycan also be used to find closed-form expressions for sums and to solve fact, many of the problems we addressed in Chapters 9 11 can be formulatedand solved using Generating Definitions and ExamplesTheordinary Generating functionfor the sequence1hg0;g1;g2;g3:::iis th

What happens if we take the derivative of a generating function? As an exam-ple, let’s differentiate the now-familiar generating function for an infinite sequence of 1’s: 1CxCx2Cx3Cx4CD 1 1 x IMPLIES d dx.1CxCx2Cx3Cx4C /D d dx 1 1 x IMPLIES 1C2xC3x2C4x3CD 1.1 x/2 IMPLIES h1;2;3;4;:::i ! 1.1 x/2: (12.1)

Tags:

  Functions, Derivatives, Mit opencourseware, Opencourseware

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of 12 Generating Functions - MIT OpenCourseWare

1 Mcs-ftl 2010/9/8 0:40 page 355 #36112 Generating FunctionsGenerating Functions are one of the most surprising and useful inventions in Dis-crete Math. Roughly speaking, Generating Functions transform problems aboutse-quencesinto problems aboutfunctions. This is great because we ve got piles ofmathematical machinery for manipulating Functions . Thanks to Generating func-tions, we can then apply all that machinery to problems about sequences. In thisway, we can use Generating Functions to solve all sorts of counting problems. Theycan also be used to find closed-form expressions for sums and to solve fact, many of the problems we addressed in Chapters 9 11 can be formulatedand solved using Generating Definitions and ExamplesTheordinary Generating functionfor the sequence1hg0;g1;g2.

2 G3:::iis the :There are a few other kinds of Generating Functions in common use, but ordinarygenerating Functions are enough to illustrate the power of the idea, so we ll stick tothem and from now on, Generating functionwill mean the ordinary Generating function is a formal power series in the sense that we usuallyregardxas a placeholder rather than a number. Only in rare cases will we actuallyevaluate a Generating function by lettingxtake a real number value, so we generallyignore the issue of this chapter, we ll indicate the correspondence between a sequenceand its Generating function with a double-sided arrow as follows:hg0;g1;g2;g3;:::i !

3 G0Cg1xCg2x2Cg3x3C :For example, here are some sequences and their Generating Functions :h0;0;0;0;:::i !0C0xC0x2C0x3C D0h1;0;0;0;:::i !1C0xC0x2C0x3C D1h3;2;1;0;:::i !3C2xC1x2C0x3C D3C2xCx21In this chapter, we ll put sequences in angle brackets to more clearly distinguish them from themany other mathematical expressions floating mcs-ftl 2010/9/8 0:40 page 356 #362 Chapter 12 Generating FunctionsThe pattern here is simple: theith term in the sequence (indexing from 0) is thecoefficient ofxiin the Generating that the sum of an infinite geometric series is:1 CzCz2Cz3C D11 z:This equation does not hold whenjzj 1, but as remarked, we won t worry aboutconvergence issues for now.

4 This formula gives closed form Generating functionsfor a whole range of sequences. For example:h1;1;1;1;:::i !1 CxCx2Cx3Cx4C D11 xh1; 1;1; 1;:::i !1 xCx2 x3Cx4 D11Cx 1;a;a2;a3;::: !1 CaxCa2x2Ca3x3C D11 axh1;0;1;0;1;0;:::i !1Cx2Cx4Cx6Cx8C D11 Operations on Generating FunctionsThe magic of Generating Functions is that we can carry out all sorts of manipulationson sequences by performing mathematical operations on their associated generatingfunctions. Let s experiment with various operations and characterize their effectsin terms of ScalingMultiplying a Generating function by a constant scales every term in the associatedsequence by the same constant.

5 For example, we noted above that:h1;0;1;0;1;0;:::i !1Cx2Cx4Cx6C D11 x2:Multiplying the Generating function by 2 gives21 x2D2C2x2C2x4C2x6C 2 mcs-ftl 2010/9/8 0:40 page 357 # Operations on Generating Functionswhich generates the sequence:h2;0;2;0;2;0;:::i:Rule (Scaling Rule).Ifhf0;f1;f2;:::i ! ;thenhcf0; cf1; cf2; :::i !c :The idea behind this rule is that:hcf0;cf1;cf2;:::i !cf0 Ccf1xCcf2x2C Dc .f0Cf1xCf2x2C AdditionAdding Generating Functions corresponds to adding the two sequences term byterm. For example, adding two of our earlier examples gives:h1; 1; 1; 1; 1; 1; :::i !

6 11 xCh1; 1;1; 1;1; 1;:::i !11 Cxh2; 0; 2; 0; 2; 0; :::i !11 xC11 CxWe ve now derived two different expressions that both generate the sequenceh2;0;2;0; are, of course, equal:11 x/.1 x/.1Cx/D21 x2:Rule (Addition Rule).Ifhf0;f1;f2;:::i ! ;g1;g2;:::i ! ;thenhf0Cg0; f1Cg1; f2Cg2; :::i ! :3 mcs-ftl 2010/9/8 0:40 page 358 #364 Chapter 12 Generating FunctionsThe idea behind this rule is that:hf0Cg0; f1Cg1; f2Cg2; :::i ! 1 XnD0fnxn!C 1 XnD0gnxn! Right ShiftingLet s start over again with a simple sequence and its Generating function:h1;1;1;1;:::i !

7 11 x:Now let sright-shiftthe sequence by addingkleading zeros:hkzeroes .. 0;0;:::;0;1;1;1;:::i !xkCxkC1 CxkC2 CxkC3C Dxk .1 CxCx2Cx3C /Dxk1 x:Evidently, addingkleading zeros to the sequence corresponds to multiplying thegenerating function byxk. This holds true in (Right-Shift Rule).Ifhf0;f1;f2;:::i ! , then:hkzeroes .. 0;0;:::;0;f0;f1;f2;:::i !xk :The idea behind this rule is that:hkzeroes .. 0;0;:::;0;f0;f1;f2;:::i !f0xkCf1xkC1Cf2xkC2C Dxk .f0Cf1xCf2x2Cf3x3C /Dxk :4 mcs-ftl 2010/9/8 0:40 page 359 # Operations on Generating DifferentiationWhat happens if we take thederivativeof a Generating function?

8 As an exam-ple, let s differentiate the now-familiar Generating function for an infinite sequenceof 1 s:1 CxCx2Cx3Cx4C D11 /Dddx 11 x IMPLIES1C2xC3x2C4x3C x/2 IMPLIESh1;2;3;4;:::i ! x/2:( )We found a Generating function for the sequenceh1;2;3;4;:::iof positive inte-gers!In general, differentiating a Generating function has two effects on the corre-sponding sequence: each term is multiplied by its index and the entire sequence isshifted left one (Derivative Rule).Ifhf0;f1;f2;f3;:::i ! ;thenhf1;2f2;3f3;:::i ! :The idea behind this rule is that:hf1;2f2;3f3;:::i !

9 F1C2f2xC3f3x2C :The Derivative Rule is very useful. In fact, there is frequent, independent needfor each of differentiation s two effects, multiplying terms by their index and left-shifting one place. Typically, we want just one effect and must somehow cancel outthe other. For example, let s try to find the Generating function for the sequence ofsquares,h0;1;4;9;16;:::i. If we could start with the sequenceh1;1;1;1;:::iandmultiply each term by its index two times, then we d have the desired result:h0 0; 1 1; 2 2; 3 3; :::iDh0;1;4;9;:::i:5 mcs-ftl 2010/9/8 0:40 page 360 #366 Chapter 12 Generating FunctionsA challenge is that differentiation not only multiplies each term by its index, butalso shifts the whole sequence left one place.

10 However, the Right-Shift Rule how to cancel out this unwanted left-shift: multiply the Generating procedure, therefore, is to begin with the Generating function forh1;1;1;1;:::i,differentiate, multiply byx, and then differentiate and multiply byxonce ;1;1;1;:::i !11 xDerivative Rule:h1;2;3;4;:::i !ddx11 x/2 Right-shift Rule:h0;1;2;3;:::i !x x/2 Derivative Rule:h1;4;9;16;:::i ! x/3 Right-shift Rule:h0;1;4;9;:::i !x x/3 Thus, the Generating function for squares x/3:( ) ProductsRule ( Product Rule).Ifha0;a1;a2;:::i ! ;andhb0;b1;b2;:::i !


Related search queries