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.

336 GENERATING FUNCTIONS<br />

This is a recurrence that “goes all the way back” from f,-l through all previous<br />

values, so it’s different from the other recurrences we’ve seen so far<br />

in this chapter. We used a special method to get rid of a similar right-side<br />

sum in Chapter 2, when we solved the quicksort recurrence (2.12); namely,<br />

we subtracted one instance of the recurrence from another (f,+l - fn). This<br />

trick would get rid of the t now, as it did then; but we’ll see that generating<br />

functions allow us to work directly with such sums. (And it’s a good thing<br />

that they do, because we will be seeing much more complicated recurrences<br />

be<strong>for</strong>e long.)<br />

Step 1 is finished; Step :2 is where we need to do a new thing:<br />

F(z) = tf,zn = tf,,zn+tfkzn[kO]zn<br />

n n kn n<br />

= zF(z) + ~fkZk~[n>k]Znpk + ez<br />

k n<br />

= zF(z) + F(z) 1 zm + &<br />

m>O<br />

= zF(z) + F(z) & + it-.<br />

1-z<br />

The key trick here was to change zn to zk zn-k; this made it possible to express<br />

the value of the double sum in terms of F(z), as required in Step 2.<br />

Now Step 3 is simple algebra, and we find<br />

F(z) = ’<br />

1 -3zf22 *<br />

Those of us with a zest <strong>for</strong> memorization will recognize this as the generating<br />

function (7.24) <strong>for</strong> the even-numbered Fibonacci numbers. So, we needn’t go<br />

through Step 4; we have found a somewhat surprising answer to the spansof-fans<br />

problem:<br />

fn = F2n 1 <strong>for</strong> n 3 0. ( 7.42)<br />

7.4 SPECIAL GENERATING FUNCTIONS<br />

Step 4 of the four-step procedure becomes much easier if we know<br />

the coefficients of lots of diff’erent power series. The expansions in Table 321<br />

are quite useful, as far as they go, but many other types of closed <strong>for</strong>ms are<br />

possible. There<strong>for</strong>e we ought to supplement that table with another one,<br />

which lists power series that correspond to the “special numbers” considered<br />

in Chapter 6.

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

Saved successfully!

Ooh no, something went wrong!