09.12.2012 Views

Concrete mathematics : a foundation for computer science

Concrete mathematics : a foundation for computer science

Concrete mathematics : a foundation for computer science

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

328 GENERATING FUNCTIONS<br />

Step 1 is easy, since we merely need to insert fudge factors to fix things<br />

when n < 2: The equation<br />

gn = C.h-1 +&h-2 + I-l)“[n~O] + [n=l]<br />

holds <strong>for</strong> all integers n. Now we can carry out Step 2:<br />

G(z) = F g,,z” =<br />

-<br />

y- gn-1zn+ 2y gn-2zn +t(-l)v+ p<br />

- --<br />

n rr n n&l n=l N.B.: The upper<br />

= A(z) + 2z2G(z) +<br />

(Incidentally, we could also have used (-,‘) instead of (-1)" [n 3 01, thereby<br />

getting x., (-,‘)z” = (1 +z)--’ by the binomial theorem.) Step 3 is elementary<br />

algebra, which yields<br />

1 + z(1 + 2;)<br />

G(z) = (1 -tz)(l -z-- =<br />

l+z+z2<br />

(1 -22)(1 + z)2 '<br />

And that leaves us with Ste:p 4.<br />

The squared factor in the denominator is a bit troublesome, since we<br />

know that repeated roots are more complicated than distinct roots; but there<br />

it is. We have two roots, p1 = 2 and pz = -1; the general expansion theorem<br />

(7.30) tells us that<br />

9 n= ~112~ + (am + c:l(-l)n<br />

<strong>for</strong> some constant c, where<br />

al =<br />

1+1/2+1/4 7 l-1+1 1<br />

(1+1/2)2 = 9; a2 = l-2/(-1) = 3 *<br />

(The second <strong>for</strong>mula <strong>for</strong> ok in (7.31) is easier to use than the first one when<br />

the denominator has nice factors. We simply substitute z = 1 /ok everywhere<br />

in R(z), except in the factor .where this gives zero, and divide by (dk - 1 )!; this<br />

gives the coefficient of ndk-‘l pk.) n Plugging in n = 0 tells us that the value of<br />

the remaining constant c had better be $; hence our answer is<br />

gn = $2n+ ($n+$)(-l)n. (7.33)<br />

It doesn’t hurt to check the cases n = 1 and 2, just to be sure that we didn’t<br />

foul up. Maybe we should even try n = 3, since this <strong>for</strong>mula looks weird. But<br />

it’s correct, all right.<br />

Could we have discovered (7.33) by guesswork? Perhaps after tabulating<br />

a few more values we may have observed that g,+l z 29, when n is large.<br />

index on En=, z”<br />

is not missing!

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

Saved successfully!

Ooh no, something went wrong!