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.

8.4 FLIPPING COINS 389<br />

A simpler way to derive the mean and variance of Y is to use the reciprocal<br />

generating function<br />

F(z) =<br />

and to write<br />

l-q2 1 q<br />

- = ---2,<br />

P P P<br />

(8.62)<br />

G(z)” = F(z)-“. (8.63)<br />

This polynomial F(z) is not a probability generating function, because it has<br />

a negative coefficient. But it does satisfy the crucial condition F(1) = 1.<br />

Thus F(z) is <strong>for</strong>mally a binomial that corresponds to a coin <strong>for</strong> which we<br />

The probability is get heads with “probability” equal to -q/p; and G(z) is <strong>for</strong>mally equivalent<br />

negative that I’m to flipping such a coin -1 times(!). The negative binomial distribution<br />

getting younger.<br />

with parameters (n,p) can there<strong>for</strong>e be regarded as the ordinary binomial<br />

Oh? Then it’s > 1 distribution with parameters (n’, p’) = (-n, -q/p). Proceeding <strong>for</strong>mally,<br />

that you’re getting<br />

older, or staying the mean must be n’p’ = (-n)(-q/p) = nq/p, and the variance must be<br />

the same. n’p’q’ = (-n)(-q/P)(l + 4/p) = w/p2. This <strong>for</strong>mal derivation involving<br />

negative probabilities is valid, because our derivation <strong>for</strong> ordinary binomials<br />

was based on identities between <strong>for</strong>mal power series in which the assumption<br />

0 6 p 6 1 was never used.<br />

Let’s move on to another example: How many times do we have to flip<br />

a coin until we get heads twice in a row? The probability space now consists<br />

of all sequences of H’s and T's that end with HH but have no consecutive H’s<br />

until the final position:<br />

n = {HH,THH,TTHH,HTHH,TTTHH,THTHH,HTTHH,. . .}.<br />

The probability of any given sequence is obtained by replacing H by p and T<br />

by q; <strong>for</strong> example, the sequence THTHH will occur with probability<br />

Pr(THTHH) = qpqpp = p3q2.<br />

We can now play with generating functions as we did at the beginning<br />

of Chapter 7, letting S be the infinite sum<br />

S = HH + THH + TTHH + HTHH + TTTHH + THTHH + HTTHH + . . .<br />

of all the elements of fI. If we replace each H by pz and each T by qz, we get<br />

the probability generating function <strong>for</strong> the number of flips needed until two<br />

consecutive heads turn up.

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

Saved successfully!

Ooh no, something went wrong!