358 pdfsam Graham, Knuth, Patashnik Concrete Mathematics

344 GENERATING FUNCTIONS Step 3 is also easy. We solve for C(z) by the quadratic formula: C(z) = 1*di-=G 22 But shou...

1 downloads 46 Views 19KB Size
344 GENERATING FUNCTIONS

Step 3 is also easy. We solve for C(z) by the quadratic formula: C(z)

=

1*di-=G 22

But should we choose the + isignor the - sign? Both choices yield a function that satisfies C(z) = K(z)’ -1- 1, but only one of the choices is suitable for our problem. We might choose the + sign on the grounds that positive thinking is best; but we soon discover that this choice gives C(0) = 00, contrary to the facts. (The correct function C(z) is supposed to have C(0) = Cc = 1.) Therefore we conclude that 1-Jl-42 C(z)

=

2z

*

Finally, Step 4. What is [zn] C(z)? The binomial theorem tells us that (‘f) (-4zjk = 1 + g & (rl/Y) (-4z)k ; k>O

,

hence, using (5.37),

= t (--‘/‘>~ = x (;)A$ nao ll)O The number of ways to parenthesize, C,, is (‘,“) &. We anticipated this result in Chapter 5, when we introduced the sequence of Catalannumbers (1,1,2,5,14,. . . ) = (C,). This sequence arises in dozens of problems that seem at first to be unrelated to each other [41], because many situations have a recursive structure that corresponds to the convolution recurrence (7.65). For example, let’s consider the following problem: How many sequences (al,a2.. . , al,,) of +1's and -1's have the property that al + a2 +. . . + azn = 0 and have all their partial sums al,

al +a2,

....

al +a2+...+aZn

nonnegative? There must be n occurrences of fl and n occurrences of -1. We can represent this problem graphically by plotting the sequence of partial

So the convolutedrecurrence

has led us to an

oft-recurring convolution.