06.03.2017 Views

Mathematics for Computer Science

e9ck2Ar

e9ck2Ar

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.

“mcs” — 2017/3/3 — 11:21 — page 909 — #917<br />

21.1. Gambler’s Ruin 909<br />

21.1.2 A Recurrence <strong>for</strong> the Probability of Winning<br />

Fortunately, you don’t need to be as ingenuious Pascal in order to handle Gambler’s<br />

Ruin, because linear recurrences offer a methodical approach to the basic problems.<br />

The probability that the gambler wins is a function of his initial capital n his<br />

target T n and the probability p that the wins an individual one dollar bet. For<br />

fixed p and T , let w n be the gambler’s probability of winning when his initial<br />

capital is n dollars. For example, w 0 is the probability that the gambler will win<br />

given that he starts off broke and w T is the probability he will win if he starts off<br />

with his target amount, so clearly<br />

w 0 D 0; (21.3)<br />

w T D 1: (21.4)<br />

Otherwise, the gambler starts with n dollars, where 0 < n < T . Now suppose<br />

the gambler wins his first bet. In this case, he is left with nC1 dollars and becomes<br />

a winner with probability w nC1 . On the other hand, if he loses the first bet, he is<br />

left with n 1 dollars and becomes a winner with probability w n 1 . By the Total<br />

Probability Rule, he wins with probability w n D pw nC1 C qw n 1 . Solving <strong>for</strong><br />

w nC1 we have<br />

w nC1 D w n<br />

p<br />

rw n 1 (21.5)<br />

where r is q=p as in Section 21.1.1.<br />

This recurrence holds only <strong>for</strong> n C 1 T , but there’s no harm in using (21.5) to<br />

define w nC1 <strong>for</strong> all n C 1 > 1. Now, letting<br />

W.x/ WWD w 0 C w 1 x C w 2 x 2 C <br />

be the generating function <strong>for</strong> the w n , we derive from (21.5) and (21.3) using our<br />

generating function methods that<br />

W.x/ D<br />

But it’s easy to check that the denominator factors:<br />

rx 2<br />

w 1 x<br />

rx 2 x=p C 1 : (21.6)<br />

x<br />

C 1 D .1 x/.1 rx/:<br />

p<br />

Now if p ¤ q, then using partial fractions we conclude that<br />

W.x/ D<br />

A<br />

1 x C B<br />

1 rx ; (21.7)

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

Saved successfully!

Ooh no, something went wrong!