06.03.2017 Views

Mathematics for Computer Science

e9ck2Ar

e9ck2Ar

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

“mcs” — 2017/3/3 — 11:21 — page 680 — #688<br />

680<br />

Chapter 16<br />

Generating Functions<br />

16.2.4 Counting Donuts with the Convolution Rule<br />

We can use the Convolution Rule to derive in another way the generating function<br />

D.x/ <strong>for</strong> the number of ways to select chocolate and plain donuts given in (16.6).<br />

To begin, there is only one way to select exactly n chocolate donuts. That means<br />

every coefficient of the generating function <strong>for</strong> selecting n chocolate donuts equals<br />

one. So the generating function <strong>for</strong> chocolate donut selections is 1=.1 x/; likewise<br />

<strong>for</strong> the generating function <strong>for</strong> selecting only plain donuts. Now by the Convolution<br />

Rule, the generating function <strong>for</strong> the number of ways to select n donuts when both<br />

chocolate and plain flavors are available is<br />

D.x/ D 1<br />

1 x 1<br />

1 x D 1<br />

.1 x/ 2 :<br />

So we have derived (16.6) without appeal to (16.5).<br />

Our application of the Convolution Rule <strong>for</strong> two flavors carries right over to the<br />

general case of k flavors; the generating function <strong>for</strong> selections of donuts when k<br />

flavors are available is 1=.1 x/ k . We already derived the <strong>for</strong>mula <strong>for</strong> the number<br />

nC.k 1/<br />

<br />

of ways to select a n donuts when k flavors are available, namely,<br />

n from<br />

Corollary 15.5.3. So we have<br />

<br />

!<br />

Œx n 1 n C .k 1/<br />

<br />

D : (16.10)<br />

.1 x/ k n<br />

Extracting Coefficients from Maclaurin’s Theorem<br />

We’ve used a donut-counting argument to derive the coefficients of 1=.1 x/ k ,<br />

but it’s instructive to derive this coefficient algebraically, which we can do using<br />

Maclaurin’s Theorem:<br />

Theorem 16.2.1 (Maclaurin’s Theorem).<br />

f .x/ D f .0/ C f 0 .0/x C f 00 .0/<br />

2Š<br />

x 2 C f 000 .0/<br />

3Š<br />

x 3 C C f .n/ .0/<br />

x n C :<br />

nŠ<br />

This theorem says that the nth coefficient of 1=.1 x/ k is equal to its nth derivative<br />

evaluated at 0 and divided by nŠ. Computing the nth derivative turns out not to<br />

be very difficult<br />

d n<br />

d n x<br />

1<br />

.kCn/<br />

D k.k C 1/ .k C n 1/.1 x/<br />

.1 x/ k

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!