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.

This slow method of<br />

finding the answer<br />

is just the cashier’s<br />

way of stalling until<br />

the police come.<br />

The USA has<br />

two-cent pieces, but<br />

they haven’t been<br />

minted since 1873.<br />

A ANSWERS TO EXERCISES 543<br />

The converse is similar. (One consequence is that G(z) is differentiably finite<br />

if and only if the corresponding egf, e(z), is differentiably finite.)<br />

7.21 This is the problem of giving change with denominations 10 and 20, so<br />

G(z) = l/(1 -z'")(l -2") = G(z"), where c(z) = l/(1 -z)(l -2'). (a) The<br />

partial fraction decomposition of i;(z) is $ (1 - z)-~ + i (1 -z)-' + f (1 + z)-' ,<br />

so [z”] c(z) = i(2n + 3 + (-1)"). Setting n = 50 yields 26 ways to make<br />

thepayment. (b) ~(z)=(1+z)/(l-z')2=(1+z)(l+2z2+3z4+~~~),~~<br />

[z”] c(z) = Ln/2] + 1. (Compare this with the value N, = Ln/5] + 1 in the<br />

text’s coin-changing problem. The bank robber’s problem is equivalent to the<br />

problem of making change with pennies and tuppences.)<br />

7.22 Each polygon has a “base” (the line segment at the bottom). If A<br />

and B are triangulated polygons, let AAB be the result of pasting the base<br />

of A to the upper left diagonal of A, and pasting the base of B to the upper<br />

right diagonal. Thus, <strong>for</strong> example,<br />

� �����<br />

(The polygons might need to be warped a bit and/or banged into shape.)<br />

Every triangulation arises in this way, because the base line is part of a unique<br />

triangle and there are triangulated polygons A and B at its left and right.<br />

Replacing each triangle by z gives a power series in which the coefficient<br />

of Z” is the number of triangulations with n triangles, namely the number of<br />

ways to decompose an (n+2)-gon into triangles. Since P = 1 +zP', this is the<br />

generating function <strong>for</strong> Catalan numbers CO + Cl z + CZZ’ + . . . ; the number<br />

of ways to triangulate an n-gon is C,-2 = (2,1-,4)/(n - 1).<br />

7.23 Let a,, be the stated number, and b, the number of ways with a 2x 1 x 1<br />

notch missing at the top. By considering the possible patterns visible on the<br />

top surface, we have<br />

a ,, = 2a,-l + 4b,_l + anPI + In = 01;<br />

b, = a,-1 + b,-l.<br />

Hence the generating functions satisfy A = 2zA + 4zB + z2 A + 1, B = zA + zB,<br />

and we have<br />

l-z<br />

A(z) = (l+z)(l-4z+z2)'<br />

This <strong>for</strong>mula relates to the problem of 3 x n domino tilings; we have a,, =<br />

f( U2,, +Vzn+l + (-l)n) = ;(2+ fi)n+’ + ;(2- fi)“+’ + 3(-l)“, which is<br />

(2 + &)“+‘/6 rounded to the nearest integer.

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

Saved successfully!

Ooh no, something went wrong!