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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The generating function derived earlier is<br />

(qz)<br />

1 1 1 1 1<br />

=- --~<br />

1 AZ 1 F-5 1 pz10 1 pz25-.<br />

1 -z50 '<br />

7.3 SOLVING RECURRENCES 331<br />

this is a rational function of z with a denominator of degree 91. There<strong>for</strong>e<br />

we can decompose the denominator into 91 factors and come up with a 91term<br />

“closed <strong>for</strong>m” <strong>for</strong> C,, the number of ways to give n cents in change.<br />

But that’s too horrible to contemplate. Can’t we do better than the general<br />

method suggests, in this particular case?<br />

One ray of hope suggests itself immediately, when we notice that the<br />

denominator is almost a function of z5. The trick we just used to simplify the<br />

calculations by noting that 1 - 4z2 + z4 is a function of z2 can be applied to<br />

C(z), ifwe replace l/(1 -2) by (1 +z-tz2+z3 +z4)/(1 -z5):<br />

C(z) = - 1 + 2 -t z2 + 23 + z4<br />

-___--<br />

1 1 1 1<br />

1-S 1 M-5 1 vz10 1 yz25 1 pz50<br />

= (1+z+z2+z3+24)c(z5),<br />

11 1 1 1<br />

C(Z) = - .- - - ~<br />

1-21-21-2~1-251-2'0'<br />

The compressed function c(z) has a denominator whose degree is only 19,<br />

so it’s much more tractable than the original. This new expression <strong>for</strong> C(z)<br />

shows us, incidentally, that Csn = Csn+’ = C5n+2 = Csn+3 = C5,,+4; and<br />

indeed, this set of equations is obvious in retrospect: The number of ways to<br />

leave a 53{ tip is the same as the number of ways to leave a 50# tip, because<br />

the number of pennies is predetermined modulo 5.<br />

Now we’re also But c(z) still doesn’t have a really simple closed <strong>for</strong>m based on the roots<br />

getting compressed<br />

reasoning.<br />

of the denominator. The easiest way to compute its coefficients of c(z) is<br />

probably to recognize that each of the denominator factors is a divisor of<br />

1 - 2”. Hence we can write<br />

A(z)<br />

-c<br />

( z ) = (1 -zlo)5 ' where A(z) =Ao+A’z+...+A3’z3’. (7.39)<br />

The actual value of A(z), <strong>for</strong> the curious, is<br />

(1 +z+... +z~')~(1+z2+~~~+z~)(l+2~)<br />

= 1 +2z+4z2+6z3+9z4+13z5+18z6+24z7<br />

+ 31z8 $- 39z9 + 452" + 522" + 57~'~ + 63~'~ + 67~'~ + 69~'~<br />

+ 69~'~ t67z" + 63~'~ $57~'~ +52z20 +45z2' + 39~~~ $31~~~<br />

+ 24~~~ t18~~~ + 13~~~ + 9z2' + 6zzs +4z29 +2z30 +z3' .

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

Saved successfully!

Ooh no, something went wrong!