# Expected values of a dice game with a 30-sided die and a 20-sided die.

Two people, $A$ and $B$, have a $30$-sided and $20$-sided die, respectively. Each rolls their die, and the person with the highest roll wins. ($B$ also wins in the event of a tie.) The loser pays the winner the value on the winner's die.

Question:

1. What is expected value for player $A$?
2. How does the expected value of the game for player $A$ change when player $B$ can re-roll?
3. How much is it worth for player $A$ to get a re-roll in this scenario, where player $B$ can have the re-roll?
4. If you remove player $A$ re-roll. How many re-rolls does player $B$ need in order for him to be a favorite in the game?

I took the average score for player $A$ to be $15.5$ and for player $B$ to be $10.5$. I am assuming this to be expected return for player $A$ so $15.5 - 10.5 = 5$. We also need to take into account when $X = Y$ when $A$ loses to $B$ on draw so $5 - (7/20) = 4.65$.

What I do not understand is how to factor in for when player $B$ can re-roll. I understand that $B$ would re-roll if he gets a value $< 10.5$ which happens $\frac 12$ of the time. Nor can I seem to grasp how to set up the follow-up questions.

• Comments are not for extended discussion; this conversation has been moved to chat. – user642796 Apr 16 '15 at 5:03

Letting $D_k$ be the random value of a fair $k$-sided dice roll, the probability that $A$ will win is: \begin{align} \mathsf P(D_{30}>D_{20}) & = \sum_{b=1}^{20} \mathsf P(D_{20}=b)\; \mathsf P(D_{30}>b) \\ & = \frac{1}{20}\sum_{b=1}^{20}\left(1- \frac{b}{30}\right) \\ & =\frac{13}{20} \end{align}

Allowing a reroll effectively means taking the maximum result of two rolls ($D_{20,1}, D_{20,2}$), so then the probability of A winning is: \begin{align} \mathsf P(D_{30}>\max(D_{20,1}, D_{20,2})) & =\frac{10}{30} + \sum_{a=1}^{20} \mathsf P(D_{30}=a)\;\mathsf P(D_{20,1}< a)\;\mathsf P(D_{20,2}< a) \\ & = \frac{10}{30} + \frac{1}{30}\sum_{a=1}^{20} \left(\frac {a-1} {20}\right)^2 \\ & = \frac{647}{1200} \end{align}

From these probabilities you can chocolate the expected returns.

Can you complete the rest?

• Chocolate the expected returns? :P – nathan.j.mcdougall Apr 16 '15 at 2:44
• Shouldn't that be $\frac{10}{30}$ - related to the probability that $A$ rolls $21-30$? – Thomas Andrews Apr 16 '15 at 3:11
• Graham Kemp. I love chocolate. Thanks for using this word in context of math. I´m curious about the definition of it. – callculus Sep 27 '18 at 14:11
• One of my favorite chocolate is Ritter Sport Nugat – callculus Sep 27 '18 at 14:54

## 1. What is the expected value for player $A$?

Let $A, B$ be the players' rolls and $W$ be player $A$'s winnings. Then \begin{align} \tag{1} \mathbb{E}W &= \mathbb{E}[W|A \leq 20]\cdot\mathbb{P}\{A \leq 20\} \ +\ \mathbb{E}[W|A > 20]\cdot\mathbb{P}\{A > 20\} \end{align} just by simply conditioning on the event $\{A \leq 20\}$ so far.

1. Now $\mathbb{E}[W|A \leq 20]$ would be zero if not for the fact that ties are settled in player $B$'s favor: $$\mathbb{E}[W|A \leq 20] = -\frac{1+20}{2}\cdot\frac{1}{20}$$ as ties happen with probability $\frac{1}{20}$ and player $B$ wins $\frac{1+20}{2}$ per tie, on average.
2. When $A > 20$, player $A$ always wins, and wins $$\mathbb{E}[W|A > 20] = \frac{21+30}{2}$$ on average.

Putting it all together, \begin{align} \mathbb{E}W &= -\frac{21}{40}\frac{2}{3} + \frac{51}{2}\frac{1}{3} \\ &= \frac{163}{20}\\ &= 8.15 \end{align} as was derived in previous answers. So far so good.

## 2. How does the expected value of the game for player $A$ change when player $B$ can re-roll?

Here the wording becomes rather more vague. Nonetheless I believe both previous answers misinterpret the problem statement. Allowing player $B$ a re-roll does not mean $B$ chooses the maximum of two rolls: that would be worded as "player $B$ is allowed the greater of two rolls". Allowing player $B$ a re-roll means that if player $B$ is unhappy with her first roll she may substitute it with a second roll, which may turn out to be less than her first. The ambiguity is in whether the re-roll is offered before or after player $B$ has seen player $A$'s roll. I consider only the first case, as it permits us to offer numbers instead of functions (of player $A$'s roll) as answers to this question, and to question 4.

Clearly, player $B$ will re-roll after rolling $b$ or less iff $$\tag{2} \mathbb{E}[W|B=b] > \mathbb{E}[W] = 8.15$$ as she wishes to minimize $W$. At this point we may as well calculate: \begin{align} \mathbb{E}[W|B=b] &= \mathbb{E}[W|B=b, A \leq b]\cdot\mathbb{P}\{A \leq b\} \ +\ \mathbb{E}[W|B=b, A > b]\cdot\mathbb{P}\{A > b\} \\ &=-b\frac{b}{30}+\frac{(b+1)+30}{2}\frac{30-b}{30} \\ &= \frac{-3b^2-b+930}{60}. \end{align} Let $b^*$ be the maximum $b$ such that inequality $(2)$ holds. (I found $b^* = 11$. Is there a faster, less error-prone method of calculating this part?)

Let $W_1$ be the value of the game when player $B$ can re-roll. Then \begin{align} \mathbb{E}[W_1] &= \mathbb{E}W + \frac{b^*}{20}\big(\mathbb{E}W - \mathbb{E}[W|B \leq b^*]\big)\\ \end{align} as we modify the old $\mathbb{E}W$ by adding the effect of the re-roll. I express it in this way because $$\mathbb{E}[W|B \leq b^*]$$ is easy to calculate quickly as it expands just like equation $(1)$ does, by pretending player $B$ is rolling a $b^*$-sided die.

The expected return for $A$ is the following sum, where $X_a$ is the roll for $A$ and $X_b$ is the roll for $B$:$$\sum_{h=1}^{30} \left(hP(X_a=h)P(X_b<h) - hP(X_a\leq h)P(X_b=h)\right)\tag{1}$$

This is: $$\sum_{h=1}^{20} h\left(\frac{1}{30}\frac{h-1}{20} -\frac{h}{30}\frac{1}{20}\right) + \sum_{h=21}^{30}\frac{h}{30}$$

(I used $h$ because it is the highest value rolled.)

I get $8.15$ as the result, but I could have failed in the algebra somewhere.

The formula is the same as (1) when $B$ getting two rolls, but the variable $X_b$ is different - it is the maximum value of two rolls. This is going to be more complicated. Let $X_{b,2}$ be the value of the maximum of two rolls of the $20$-sided die. Then $P(X_{b,2}=h)=\frac{2h+1}{20^2}$ for $h\leq 20$ and zero otherwise, and $P(X_{b,2}<h)=\frac{(h-1)^2}{20^2}$ for $h\leq 20$ and $1$ for $h>20$. Lots of ugly algebra.

In general, if $X_{b,k}$ is the maximum when rolling the die $k$ times, then $$P(X_{b,k}<h) = \begin{cases}\frac{(h-1)^k}{20^k}&h\leq 20\\ 1&h>20 \end{cases}$$

and:

$$P(X_{b,k}=h)=\begin{cases} \frac{h^k-(h-1)^k}{20^k}&h\leq 20\\ 0&h>20\end{cases}$$

• Thank you for the clarification and insight. I can see now that I greatly over simplified the initial expected value calculation attempt. – VMO Apr 16 '15 at 3:58
• I got that B needs to be able to re-roll $6$ times to have the advantage. But I had to use a computer. – Thomas Andrews Apr 16 '15 at 4:29
• Hi, I have been learning how you derived your equations since yesterday. I had a question on the second part of the equation. May I ask why you decided to let X_b, 2 to be the value of the maximum of two rolls? If I am recalling expectation correctly, shouldn't B want to re-roll if his roll is < 10.5 and stop if it is greater? Or am I incorrectly understanding expectation because B is at a disadvantage (if I may call it that) because his die can only go up to 20. – VMO Apr 17 '15 at 2:18
• At what number would player B think to himself that it is better to re-roll? If player A can re-roll given B can re-roll, what additional benefit (upside) is it to A? – VMO Apr 17 '15 at 2:35