1

P(bowling a strike) = 70%. Expected number of trials until a perfect game? (10 strikes in a row)

I would also like to learn the generalized form. Odds of an event is P. Formula for expected number of trials to get N success in a row.

JackOfAll
  • 4,701
  • 1
    A perfect game is 12 consecutive strikes, i.e., 3 strikes in the last frame. – James Holbert Apr 03 '15 at 15:48
  • 1
    A possible duplicate http://math.stackexchange.com/q/73758/160239 Upon inspection, I realise that the answers neglect one possible solution: a wisely chosen Markov chain. – user3371583 Apr 03 '15 at 15:53

1 Answers1

2

This is similar to the question of the expected number of flips of a fair coin until we encounter an $n$-streak, except here the probability is 70% instead of 50%.

Assume a probability $p$ of hitting a strike. Let $T_1$ be the expected number of trials before getting the first strike. If the first trial is a strike, then we have only spent one trial and we're done. Otherwise we waste a trial and we start over.

$$T_1 = (p)(1) + (1-p)(1 + T_1) \implies T_1 = \frac{1}{p}$$

Now consider $T_2$, the expected number of trials to get two strikes in a row. There are three possible outcomes, conditional on either making the two strikes immediately, or trying but failing at some point along the line and starting the process over:

$$T_2 = (p)(p)(2) + (p)(1-p)(2+T_2) + (1-p)(1+T_2) \implies T_2 = \frac{1+p}{p^2}$$

For $T_3$, similar idea:

$$T_3 = (p)(p)(p)(3) + (p)(p)(1-p)(3+T_3) + (p)(1-p)(2+T_3) + (1-p)(1+T_3) \\ \implies T_3 = \frac{1+p+p^2}{p^3}$$

In general:

$$T_n = \frac{1+p+p^2+...+p^{n-1}}{p^n} = \frac{p^n-1}{p^n(p-1)} = \frac{1-p^{-n}}{p-1}$$

So for $p=\frac{7}{10}$, we have $T_n = \frac{10}{3}((\frac{10}{7})^n-1)$, and therefore $T_{10} = 114.671105821...$

from random import random

def E(p, n, numTrials = 100000):
    tot = 0

    for trial in xrange(numTrials):
        streak = 0
        attempts = 0
        while streak < n:
            attempts+=1
            if random() <= p:
                streak+=1
            else:
                streak = 0
        tot += attempts

    return tot / float(numTrials)

def closedForm(p,n):
    return float(1-p**(-n))/(p-1)

for p,n in [(.7,10), (.5,1), (.5,2)]:
    print "E(%s,%s)=%s, verify:%s" % (p,n,E(p,n),closedForm(p,n))

Output:

E(0.7,10)=114.91181, verify:114.671105821
E(0.5,1)=2.00897, verify:2.0
E(0.5,2)=6.00529, verify:6.0
  • Thanks Marcus so much for your great explanation. I will try to rederive your work, and then use the formula on a few examples. – JackOfAll Apr 04 '15 at 01:52
  • Marcus, your formula doesn't seem to work right. I plugged it into Excel, and for p=.5 and n=1, I get 5 trials. For p=.5 and n=2, I get 9 trials. Those both seem wrong. – JackOfAll Apr 06 '15 at 16:14
  • @JackOfAll I edited the answer to include a short Monte-Carlo simulation in Python to verify that the formula indeed works. For p=.5 and n=1, the expected number of trials should be 2, and for p=.5 and n=2, the expected number of trials should be 6. Please double-check the Excel implementation. – Marcus Andrews Apr 06 '15 at 16:26
  • Yup, I was missing ()'s for the numerator. Struck down by PEMDAS!! – JackOfAll Apr 07 '15 at 19:33