# Expected value until a success?

Suppose we have the a game with a 5-sided unfair die (just to make the probabilities easier to sum to 1), each side having a different payout.

For each side $$x \in \{1,2,3,4\}$$ we have the corresponding payouts $$\1,...,\4$$. However, if the die lands in $$5$$ there's no payout and the game is over.

Each side, respectively, has probability $$P(X=x) = \{0.15, 0.2, 0.25, 0.3, 0.1\}$$

What's the expected payout for the game?

If we directly apply the expected value, we would get something like

$$\sum_x x_ip(x_i)= \2.5$$

However, the meaning behind calculating the expected value this way seems to only capture the expected value for the game for 1 trial.

How would one approach such a problem?

• So in this game, we keep rolling the die (and paying in each roll) until we roll the first 5, correct? – Stephan Kolassa Sep 8 '19 at 21:20
• @StephanKolassa Correct. – aedcv Sep 8 '19 at 21:33
• So on average, do you have 9 opportunities to win \$2.50? – BruceET Sep 8 '19 at 22:01 • @BruceET It would seem so, due to the 0.1 probability of the game ending. However, I was wondering if people would suggest solving this through something more "formal", such as discussing a negative multinomial distribution, or formulating it as a conditional expectation. – aedcv Sep 8 '19 at 22:13 • (a) Yes, probably expected something more formal. perhaps as in answer by @polettix. (b) Been looking at your phrase 'something like'. Given that you're going to win, seems the cond'l probabilities of various amounts are$(.15,.2,.25,.3)/.9$, which sum to 1 and so expected winnings are almost \$2.78. Then, multiplying by 9 payouts on avg it is $25. I did a simulation and that's what I got. – BruceET Sep 9 '19 at 0:03 ## 4 Answers I would have liked to comment but I still can't... so I'll give a complete answer hoping that I'm not spoiling any homework. I'd start saying that the "winning" sides of this five-sided unfair die are a distraction. We can re-arrange the calculations and obtain the expected value for a single roll: $$E_s = 0.9 \cdot \sum_{i=1}^{4}{x_i \cdot \frac{p(x_i)}{\sum_{i=1}^{4}{p(x_i)}}} + 0.1 \cdot 0 = 0.9 \cdot E_w$$ where $$E_w$$ is the expected value for the win under the assumption that we win (which happens with probability $$0.9 = \sum_{i=1}^{4}{p(x_i)} = 1 - 0.1$$). It's like having a loaded coin, where you win $$E_w$$ with probability $$0.9$$ and get nothing otherwise. In the "extended game" case (i.e. winning allows us to continue), if we win the first roll we are getting an expected value of $$E_w$$ (for the first successful roll) plus our expected value for... an undefined number of rolls, i.e. what we are after. In other terms, the expected value $$E_m$$ for multiple rolls will be: $$E_m = 0.9\cdot(E_w + E_m)$$ $$E_m = \frac{0.9 \cdot E_w}{0.1} = \frac{E_s}{0.1} = \frac{E_s}{p(x_5)}$$ From another angle, we might observe that the number of trials to get one "success" (in this case, losing!) when repeatedly tossing our loaded coin can be modeled by a geometric distribution. Hence we might just multiply the expected value for a single toss $$E_s$$ by the average number of tosses needed to get this "successful failure", which is $$\frac{1}{p(x_5)}$$, and obtain the same result. • No worries, this is not a homework problem. I was reading about negative binomial distributions and I was wondering how that would extend to a multinomial setting (since reading material for negative multinomial distributions seems to be significantly reduced, from what I found). So it seems like the intuition you provide is to --roughly-- convert this problem into a binomial, summarizing the other outcomes by their expected value, and computing the expected value of this binomial distribution? – aedcv Sep 8 '19 at 22:21 • I'm not sure that the binomial really fits here (but I'm no expert), unless of course we consider the Bernoulli as a very simple binomial. I tend to think to the binomial when you know beforehand how many rounds you will have, and you want to model how many times you are likely to "win" in those rounds. The specific case is more in line with the geometric distribution IMHO. The first half of the answer is derived from trying to draw the tree of possibilities with associated weights, and recognizing that the infinite sub-tree is the same as the whole tree, hence the CS-ish recursive relation. – polettix Sep 8 '19 at 22:31 • (+1) esp for correcting avg winnings. – BruceET Sep 9 '19 at 0:21 ## Recursion We can define the expected value of the game in a recursive manner. Let's assume that the expected benefit from the game (all rolls until the game ends) is x. Using the probabilities you give for rolling {0.15,0.2,0.25,0.3,0.1} and the winnings of {\$1, \$2, \$3, \$4, [game ends]}, the expected value of the roll is$2.5 plus the value of that 90% chance of continuing the game - and given the rules of this game, it's clear "the right to continue the game" is exactly as valuable as "the right to play the game" - if the game hasn't ended, at the start of the second (or any other future) roll my potential future winnings (excluding the winnings of previous rolls) are exactly the same as in the beginning of the game.

So we can define the value of the game before the first roll is made as x=$2.5+0.9x, recursively referring to the value itself - and the resulting equation is trivially solvable to x=$25.

In essence this is equivalent to Polettix's answer, but IMHO this approach is much simpler to understand.

Simulation, per Comment: At each iteration, the die is rolled 400 times, but only the rolls up to the first observed 5 are counted. Then the payout w is computed, ignoring the trial on which the 5 occurred. I chose 400 rolls because (with very high probability) that is enough to get a 5. [Sloppy programming, wasteful of random numbers, but runs quickly.]

set.seed(1237)  # for reproducibility
pr = c(.15, 0.2, 0.25, 0.3, 0.1)
m = 10^6;  w = h = numeric(m)
for(i in 1:m) {
x = sample(1:5, 400, rep=T, p=pr)
h[i] = match(5,x); s = h[i]       # stopping point
w[i] = sum(x[1:s])-5
}
mean(w); mean(h)
[1] 25.00693     # aprx 9*2.777778 = 25; avg total payout
[1] 10.00337     # aprx 1/.1 = 10; avg trial number at stop


Note: Can look at summary(h) to see it's consistent with a geometric distribution (and contains no NAs from almost-impossible runs of 400 without at 5).

summary(h)
Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
1       3       7      10      14     143


There's a .9 chance that you'll win 2.5 EV. You could also win a second 2.5. The probability of that, contingent on winning the first 2.5, is .9, for a total probability of .9^2. You can continue winning 2.5, with the probability of the nth win being .9^n. So you have

$$\sum (2.5*.9^n) = 2.5\sum .9^n$$, which is a geometric series. Using the formula $$\sum r^n = \frac 1 {1-r}$$, you get that the total EV is 2.5*10 = 25.

You can also use the algebra mentioned in other answers: EV = 2.5+.9Ev -> EV = 25. This is of course simpler to do, but I decided to post both methods as there's a nonzero chance that someone will read this answer and it will make the geometric series formula slightly less mysterious.

PS You could have a six-sided die where 5 and 6 have probability .05 each, and either results in a loss.