# Probability Interview Question - Brain teaser

Player A has a thirty-sided and Player B has a twenty-sided die. They both roll the dies and whoever gets the higher roll wins. If they roll the same amount Player B wins. What is the probability that Player B win?

So I have $$1 - \left(\frac{1}{3}+\frac{1}{2}\cdot\frac{2}{3}-\frac{1}{30}\right) = \frac{11}{30}.$$ There is $100\%$ chance of winning when A roll from 20 - 30 but for the rest $2/3$ there is only $50\%$ chance of winning, in addition, there is $1/30$ of chance that player A could roll the same number as B The answer for this question should be $0.35$, I am not sure where I did wrong.

I just figured maybe I should do this instead

$1 - (\frac{1}{3}+(\frac{1}{2}-\frac{1}{30})\cdot\frac{2}{3}) = \frac{16}{45}$ is this right ?

• Possible duplicate of Expected values of a dice game with a 30-sided die and a 20-sided die. Mar 29, 2017 at 6:00
• this is a different question Mar 29, 2017 at 6:05
• No, look properly. The first part of the question is same as yours, just it asks the probability of A winning. Mar 29, 2017 at 6:11
• I read it, but still couldn't figure out this problem Mar 29, 2017 at 6:13
• Look the answer to first part is 7/20 right? Now look at answer to that question. Mar 29, 2017 at 6:23

You can make a $30\times 20$ table (in your mind). The lables of the rows are my outcomes and the lables of the columns are your outcomes. You loose when I roll a number greater than $20$. This are $10\cdot 20=200$ outcomes.

You will win when I roll a number of between 1 and 20 (inclusive) and my outcome is smaller than yours. This is the triangle above the diagonal of the table from $1$ to $20$ (both players). The number of out comes are

$\frac{20\cdot 20-\color{blue}{20}}2+\color{blue}{20}=210$. The blue $\color{blue}{20}$ are the cells on the diagonal.

So we have $210$ for you favorable outcomes. And $600 (=200+20\cdot 20)$ possible outcomes.

The short answer is that you count the number of outcomes that favor you ("me"). There are 210 such outcomes. You can imagine this by thinking of a 20 by 30 table of outcomes and counting the outcomes that fall in your triangle, which includes the diagonal and is $$\sum_{i = 1}^{20} i = 210.$$ Each outcome has a probability of $\frac{1}{20\cdot 30} = \frac{1}{600}$ so the chance of you winning is $$\frac{210}{600} = \frac{7}{20} = 0.35.$$

Doing it your way, we seek the chance that the opponent ("you") wins. I think you are wrong in $\frac{1}{2}\cdot\frac{2}{3}$. Instead, count how many options favor the opponent. There are $10\cdot 20 = 200$ where he "absolutely" wins, which does give $$\frac{200}{600} = \frac{1}{3}.$$

However, when we count how many outcomes favor him in the 1 to 20 range, we have $$\sum_{i = 1}^{19} i = 190 = \color{blue}{\sum_{i=1}^{20}i - 20}.$$

You can think of the part in blue as counting your favorables and subtracting 20 on the diagonal to give you his favorables. I think this is what you were trying to do by $\frac{1}{2}\cdot\frac{2}{3}-\frac{1}{30}$ in your first solution. Notice that $\frac{190}{600} \neq \frac{1}{2}\cdot\frac{2}{3}-\frac{1}{30}$. Now we subtract from $1$ $$1-\left(\frac{200}{600}+\frac{190}{600}\right) = \frac{7}{20} = 0.35.$$

Agreed with @Em.

• Case1: A rolls between 21-30, B cannot possibly win | Proba happens: 1/3 | Proba B wins: 0%
• Case2: A rolls between 1-20 & same number as B | Proba happens:(2/3)*(1/20) | Proba B wins: 100%
• Case3: A rolls between 1-20 & diff number from B | Proba happens: 2/3*(19/20) | Proba B wins: 50%

P(B win) = 0 * 1/3 + 2/3 * 1/20 + 2/3 * 19/20 * 1/2

0% * P(A bw 21-30) + P(A bw 1-20) * P(land same) * 100% + P(A bw 1-20) * P(land diff) * P(B win when not equal and in the same range: coin toss aka 50%)

P(B win) = 42/120 = 7/20 = 0.35

Your original attempt is very nearly right. You calculated the probability as $$1-\Big(\frac13+\frac12\times\frac23-\frac1{30}\Big).$$ The error is in counting the ties. You subtracted $\frac1{30}$, because this is the probability of a tie. That would be the right thing to subtract if the rest of your formula counted ties as wins for A, but it doesn't. If you don't subtract anything your formula would give the answer for A winning half the ties. So you only need to subtract this half, i.e. $\frac1{60}$, to convert it to a formula where A wins none of the ties. This gives $$1-\Big(\frac13+\frac12\times\frac23-\frac1{60}\Big)=\frac{21}{60}.$$

• Thank you Lime, this is the answer i'm have been looking for. Mar 29, 2017 at 15:35

Let $A$ throw $1..30$.

$B$ has no chance against $21..30$ with probability $\frac{1}{3}$: it wins $0\times\frac{1}{3}$ such throws.

$B$ wins $\frac{2}{3}\times\frac{1}{20}$ equal throws.

$B$ also wins half of the remaining $19$ throws of $A$: $\frac{1}{2}\times\frac{19}{20}$.

I've reasoned like this, as usual starting from the simplest case:

A has a 3-sided dice, B a 2-sided one.

$P(\mathbf{B} wins)$ = $P(\mathbf{B}_{dice}=1)$ * $P(\mathbf{A}_{dice}=1)$ + $P(\mathbf{B}_{dice}=2)$ * $P(\mathbf{A}_{dice}<=2)$ =

= $\frac{1}{2}$ * $\frac{1}{3}$ + $\frac{1}{2}$ * $\frac{2}{3}$ = $\frac{1}{2}$

Generalizing ($n$ being the number of sides for B):

$P(\mathbf{B} wins)$ = $\frac{1}{n} * \sum_{j=1}^{n}(\frac{j}{\frac{3}{2}*n})$ = $\frac{2}{3n^2} * \frac{n*(n+1)}{2}$ = $\frac{1}{3n} * {(n+1)}$ = $\frac{1}{3} + \frac{1}{3n}$

So, with $n = 20$, $P(\mathbf{B} wins)$ = $\frac{1}{3} + \frac{1}{60}$ = $\frac{21}{60}$

I would like to give a slightly different input by symmetry. A has $$\frac{1}{3}$$ chance rolling 21 to 30, which is a must-win. Then we can think of the remaining $$\frac{2}{3}$$ (outcomes) as a fair game. As others mention there's 1/30 chance of tie, let this be $$y$$, let $$x$$ be the chance that on the remaining 1 to 20 numbers, either A or B will (forgeting being tied for now) $$2x+y=\frac{2}{3}$$ solving this give $$x=19/60$$. Since getting tie means B will win, just do $$19/60+1/30=21/60$$. This gives the answer

You say "If they roll the same amount Player B wins". But in your proposed solution, you say "There is 100% chance of winning when A roll from 20 - 30". But if A and B both roll a 20, B wins. This throws your calculations off. There is a 100% chance of winning when A rolls 21 - 30.

Given that, B has a chance of winning 2/3 of the time (i.e. when A rolls 1 - 20). And that chance is an even chance. B will win those contests half the time.

One-half of 2/3 is 1/3. B has a 1/3 chance of winning.

Edit: A bot has flagged this answer as "unclear" and suggests I edit my response. If anyone wants to tell me what's unclear, I'll be happy to clarify.