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.

344 GENERATING FUNCTIONS<br />

Step 3 is also easy. We solve <strong>for</strong> C(z) by the quadratic <strong>for</strong>mula:<br />

C(z) = 1*di-=G<br />

22<br />

But should we choose the + isign or the - sign? Both choices yield a function<br />

that satisfies C(z) = K(z)’ -1- 1, but only one of the choices is suitable <strong>for</strong> our<br />

problem. We might choose the + sign on the grounds that positive thinking<br />

is best; but we soon discover that this choice gives C(0) = 00, contrary to<br />

the facts. (The correct function C(z) is supposed to have C(0) = Cc = 1.)<br />

There<strong>for</strong>e we conclude that<br />

1-Jl-42<br />

C(z) = 2z *<br />

Finally, Step 4. What is [zn] C(z)? The binomial theorem tells us that<br />

k>O<br />

hence, using (5.37),<br />

(‘f) (-4zjk = 1 + g & (rl/Y) (-4z)k ;<br />

= t (--‘/‘>~ = x (;)A$<br />

nao ll)O<br />

,<br />

The number of ways to parenthesize, C,, is (‘,“) &.<br />

We anticipated this result in Chapter 5, when we introduced the sequence So the convoof<br />

Catalannumbers (1,1,2,5,14,. . . ) = (C,). This sequence arises in dozens luted recurrence<br />

of problems that seem at first to be unrelated to each other [41], because<br />

many situations have a recursive structure that corresponds to the convolution<br />

recurrence (7.65).<br />

For example, let’s consider the following problem: How many sequences<br />

(al,a2.. . , al,,) of +1's and -1's have the property that<br />

al + a2 +. . . + azn = 0<br />

and have all their partial sums<br />

al, al +a2, . . . . al +a2+...+aZn<br />

nonnegative? There must be n occurrences of fl and n occurrences of -1.<br />

We can represent this problem graphically by plotting the sequence of partial<br />

has led us to an<br />

oft-recurring convolution.

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

Saved successfully!

Ooh no, something went wrong!