0
$\begingroup$

So if I had a punch board with 20 places to punch and these are filled with the below options with the rule that the player gets to punch the board until they find 3 of the same value what would be the probability of each option?

So what I am looking for is what are the odds that someone finds 3 $2000 options before finding 3 of any of the others. and the same for each of the other options.

Better yet can I get the formula for how to do this in case we change the quantities.

3 - $2000
4 - $1000
6 - $500
7 - $250
$\endgroup$
6
  • $\begingroup$ I'm not sure I understand the question. As I read it, there are $20$ spaces, filled with the numbers given. The player chooses spaces until he has chosen $3$ of the same value. At that point, he wins whatever value it was that came up $3$ times. Is that correct? Also, what do you want to know? His expected value? $\endgroup$
    – saulspatz
    Aug 23, 2019 at 17:12
  • $\begingroup$ Yes there are 20 spaces filled with 1 of each of the 4 value options the number on the left is the number of spaces with those values. Yes they choose spaces until 3 of the same value are chosen. I am wanting to know what the probability is that the winning value will be for each of those 4 options. I would love to know how to get to that answer myself in case we change the number of each value in the future or even the number of value options. $\endgroup$ Aug 23, 2019 at 17:17
  • $\begingroup$ This is not going to be possible without a lot of calculation. I don't think it's reasonable to do this by hand. Will a computer script be an acceptable answer? $\endgroup$
    – saulspatz
    Aug 23, 2019 at 17:29
  • $\begingroup$ yes a script would be great $\endgroup$ Aug 23, 2019 at 18:28
  • $\begingroup$ Okay, it will take me a little while. $\endgroup$
    – saulspatz
    Aug 23, 2019 at 18:36

2 Answers 2

2
$\begingroup$

What makes this difficult to do by hand is the large number of states that the system can be in. There are four prizes, and we can select each of them up to two times before the game ends, which gives $3^4=81$ possible states. In each of these, the probabilities of choosing the various prizes are different, since the places can't be reused. Essentially it's a large tree diagram, with $9$ levels and $85$ nodes.

The way I've chosen to do this it to model the system as an absorbing Markov chain. This may seem silly, because we can never get back to a state once we've been there, but the advantage is that the analysis has been done already.

Here's my script:

'''
Punchboard game.   
Various prizes occur various numbers of times.
Player punches places until same prize comes up a given 
number of times, then he wins that prize.
Compute the probability distribution.

We do this as an Markov chain, though no state can recur,
just because the analysis is already done.
'''
import numpy as np
from itertools import product

# You can modify the next two lines to change the prizes
# and the number of punches that have to be the same

prizes =[(2000,3),(1000,4),(500,6),(250,7)]
winner = 3

places = sum(p[1] for p in prizes)
P = len(prizes)
states = [list(p) for p in product(range(winner), repeat=P)]
S = len(states)

def index2state(idx):
    '''
    Extract the digits of idx in base winner.
    Number of digits is N
    '''
    answer = P*[0]
    d = 0
    while idx:
        idx, answer[d] = divmod(idx, winner)
        d += 1
    return answer
        
def state2index(state):
    '''
    Interpret the state as an integer in base winner
    '''
    answer = 0
    for digit in reversed(state):
        answer = winner*answer + digit
    return answer
 
Q = np.zeros((S,S))
R = np.zeros((S, P))
I = np.eye(S)
for state in states:
    idx = state2index(state)
    denominator = places-sum(state)
    for i, s in enumerate(state):
        numerator = prizes[i][1] - s
        if s != winner-1:
            target = state[::]
            target[i] += 1
            idx2 = state2index(target)
            Q[idx,idx2] += numerator/denominator
        else:
            idx2 =  i
            R[idx,idx2] += numerator/denominator

N = np.linalg.inv(I-Q)
B = N@R
for j in range(P):
    print("Probability of winning %4s is %.6f"%(prizes[j][0], B[0,j]))
print("Expectation is %.2f"%sum(prizes[j][0]*B[0,j] for j in range(P))) 

This produced

Probability of winning 2000 is 0.037848
Probability of winning 1000 is 0.112470
Probability of winning  500 is 0.348898
Probability of winning  250 is 0.500784
Expectation is 487.81

In order to modify the game, you just have to change the data for prizes and winner near the top of the script. I'm sure prizes is obvious. If you had a game where you have to get the same prize $4$ times to win, you'd would just change winner to $4$.

I'm pretty sure this is correct, but I'm going to run a simulation to check. I'll let you know how that turns out.

Simulation is very close.

$\endgroup$
5
  • $\begingroup$ Looks correct to me (I got the same probability for winning 2000). $\endgroup$ Aug 23, 2019 at 19:43
  • $\begingroup$ @saulspatz so we are circling back around to this project again and I am going to be honest I do not understand python code at all. So I wanted to check if the %4s and the Range(4) needed to be updated to match the number of prizes or the 4 is what it should always be? $\endgroup$ Jun 25, 2020 at 18:25
  • $\begingroup$ @ChadPortman Sounds like an oversight. Let me check the code. I'll get back to you in a bit. $\endgroup$
    – saulspatz
    Jun 25, 2020 at 19:09
  • $\begingroup$ @ChadPortman The %4s is okay. That just says that the prize amounts should take up $4$ spaces, so that they line up nicely when printed. The range(4) should have been range(P). I've corrected my answer. Good catch, thanks. $\endgroup$
    – saulspatz
    Jun 25, 2020 at 19:18
  • $\begingroup$ Awesome thank you $\endgroup$ Jun 25, 2020 at 22:06
2
$\begingroup$

You have $\{a\cdot V_1, b\cdot V_2, c\cdot V_3, d\cdot V_4\}$ where $a,b,c,d$ are multiplicities and $V_1,V_2,V_3,V_4$ are the punches representing different prizes.

Suppose we are going for 3 of $V_1$ before we get three of any other. We can win in 3 punches: $$\dfrac{\dbinom{a}{3}}{\dbinom{a+b+c+d}{3}}$$

For the rest, we must choose one of the $a$ punches for $V_1$ to be the last punch: In four punches: $$\dfrac{a\dbinom{a-1}{2}}{a+b+c+d}\cdot \dfrac{\dbinom{b+c+d}{1}}{\dbinom{a+b+c+d-1}{3}}$$

In five punches: $$\dfrac{a\dbinom{a-1}{2}}{a+b+c+d}\cdot \dfrac{\dbinom{b+c+d}{2}}{\dbinom{a+b+c+d-1}{4}}$$

In six punches: $$\dfrac{a\dbinom{a-1}{2}}{a+b+c+d}\cdot \dfrac{\dbinom{b}{2}\dbinom{c+d}{1}+\dbinom{b}{1}\dbinom{c+d}{2}+\dbinom{b}{0}\left(\dbinom{c}{2}\dbinom{d}{1} + \dbinom{c}{1}\dbinom{d}{2}\right)}{\dbinom{a+b+c+d-1}{5}}$$

In seven punches: $$\dfrac{a\dbinom{a-1}{2}}{a+b+c+d}\cdot \dfrac{\dbinom{b}{2}\dbinom{c+d}{2}+\dbinom{b}{1}\left(\dbinom{c}{2}\dbinom{d}{1}+\dbinom{c}{1}\dbinom{d}{2}\right) + \dbinom{b}{0}\dbinom{c}{2}\dbinom{d}{2}}{\dbinom{a+b+c+d-1}{6}}$$

In eight punches: $$\dfrac{a\dbinom{a-1}{2}}{a+b+c+d}\cdot \dfrac{\dbinom{b}{2}\left(\dbinom{c}{2}\dbinom{d}{1}+\dbinom{c}{1}\dbinom{d}{2}\right) + \dbinom{b}{1}\dbinom{c}{2}\dbinom{d}{2}}{\dbinom{a+b+c+d-1}{7}}$$

In nine punches: $$\dfrac{a\dbinom{a-1}{2}}{a+b+c+d}\cdot \dfrac{\dbinom{b}{2}\dbinom{c}{2}\dbinom{d}{2}}{\dbinom{a+b+c+d-1}{8}}$$

For $a=3,b=4,c=6,d=7$, adding up these disjoint probabilities gives a total probability of: $$\dfrac{26699}{705432} \approx 3.78\%$$ for winning the $\$2,000$ prize.

For $a=4,b=3,c=6,d=7$ ($\$1,000$ prize), this gives: $$\dfrac{19835}{176358} \approx 11.247\%$$

For $a=6,b=3,c=4,d=7$ ($\$500$ prize), this gives: $$\dfrac{61531}{176358} \approx 34.8898\%$$

For $a=7,b=3,c=4,d=6$ ($\$250$ prize), this gives: $$\dfrac{50467}{100776} \approx 50.0784\%$$

$\endgroup$
2
  • $\begingroup$ I changed it so that it works so long as you have at least three of each. $\endgroup$ Aug 23, 2019 at 19:57
  • 1
    $\begingroup$ Very good. I considered doing something like this, but I thought it would be more complicated than it is. I fell into the trap of thinking that because it was sampling without replacement, I'd have to worry about the changing probability of punching a particular prize. What's odd is that I can remember writing an answer, or a comment, recently explaining to someone why this isn't so. $\endgroup$
    – saulspatz
    Aug 23, 2019 at 19:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .