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.

Znvert this:<br />

‘zmb ppo’.<br />

5.3 TRICKS OF THE TRADE 193<br />

This dual relationship between f and g is called an inversion <strong>for</strong>mula; it’s<br />

rather like the Mobius inversion <strong>for</strong>mulas (4.56) and (4.61) that we encountered<br />

in Chapter 4. Inversion <strong>for</strong>mulas tell us how to solve “implicit recurrences,”<br />

where an unknown sequence is embedded in a sum.<br />

For example, g(n) might be a known function, and f(n) might be unknown;andwemighthavefoundawaytoprovethatg(n)<br />

=tk(t)(-l)kf(k).<br />

Then (5.48) lets us express f(n) as a sum of known values.<br />

We can prove (5.48) directly by using the basic methods at the beginning<br />

of this chapter. If g(n) = tk (T)(-l)kf(k) <strong>for</strong> all n 3 0, then<br />

x (3 (-1 )kg(k) = F (3 t-1 lk t (r) C-1 )‘f(i)<br />

k i<br />

= tfiii; (11)1-ilk+‘(F)<br />

i<br />

= xfij)& G)(-llk+‘(~?)<br />

i<br />

= ~f(i,(~) F(-l)*(nij)<br />

i<br />

[n-j=01 = f(n).<br />

The proof in the other direction is, of course, the same, because the relation<br />

between f and g is symmetric.<br />

Let’s illustrate (5.48) by applying it to the “football victory problem”:<br />

A group of n fans of the winning football team throw their hats high into the<br />

air. The hats come back randomly, one hat to each of the n fans. How many<br />

ways h(n, k) are there <strong>for</strong> exactly k fans to get their own hats back?<br />

For example, if n = 4 and if the hats and fans are named A, B, C, D,<br />

the 4! = 24 possible ways <strong>for</strong> hats to land generate the following numbers of<br />

rightful owners:<br />

ABCD 4 BACD 2 CABD 1 DABC 0<br />

ABDC 2 BADC 0 CADB 0 DACB 1<br />

ACBD 2 BCAD 1 CBAD 2 DBAC 1<br />

ACDB 1 BCDA 0 CBDA 1 DBCA 2<br />

ADBC 1 BDAC 0 CDAB 0 DCAB 0<br />

ADCB 2 BDCA 1 CDBA 0 DCBA 0<br />

There<strong>for</strong>e h(4,4) = 1; h(4,3) = 0; h(4,2) = 6; h(4,l) = 8; h(4,O) = 9.

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

Saved successfully!

Ooh no, something went wrong!