# Probability that I will have to make coffee

Each morning at the office, the other two members of my team play a game to decide who will make the coffee that morning. They each simulate a roll of a 20 sided die (i.e. a random number from 1 to 20.) The lowest roll is the loser and has to make the coffee.

Since I drink coffee prior to coming to the office, I do not usually participate in the game. However, just to make things interesting, if the lowest roll is a 1 or 2, I also play and roll a 20 sided die. If I am then the loser of the game, then I make the coffee.

In the event that there is a tie for the lowest roll, there would be one or more run-off rounds between each low roller and it can be assumed that every participant in the initial tie-breaker would have an equal chance of being the loser.

1) On any given day, what is the probability that I would have to make coffee?

2) Our team is growing, and soon we will have more people playing this game each morning. What is the number of other participants in the game that MAXIMIZES the probability that I will have to make coffee on any given day?

• You must at least have some idea on how to solve 1). What have you tried? Nov 2, 2017 at 14:40
• I have actually solved 1) -- it's straightforward enough to grind through all of the combinations and tie-breakers in a spreadsheet. But I've only solved 2) with a simulator. Nov 2, 2017 at 14:46
• Under what exact circumstances is there a tie breaker? If several people get a number $n>2$, I suppose they run a tie-breaker. What if several people get a $1$ or a $2$? Do they do a tie-breaker, or do you roll a die straight away? What if exactly one person rolls a $2$, and then you roll a $2$? Do you do a tie breaker with them? Nov 3, 2017 at 18:29
• @JackM If several people get the same low number n > 2, it's true that they will run a tie-breaker, but since I would not roll, there's no chance that I would make coffee. If several people get a 1 or 2, then I would roll prior to any tie-breaker. The tie-breaker round or rounds would then proceed among all of the lowest rollers. And, if exactly one person rolled a 2, and I rolled a 2, the tie-breaker would be between me and them. Nov 3, 2017 at 19:39
• "it's true that they will run a tie-breaker, but since I would not roll, there's no chance that I would make coffee" What if after the tie breaker, the lowest score was a 1 or a 2? You still don't roll? Nov 3, 2017 at 20:26

Suppose you have $n$ coworkers besides yourself. We'll break what happens into several cases.

Case 1 (you don't play): The probability that nobody rolls a 1 or 2 is $(18/20)^n = (9/10)^n$. Probability: $(9/10)^n$

Case 2 (you play and immediately lose): At least one coworker rolls a 2, no coworkers roll a 1, you roll a 1, and you start hunting for filters. To analyze the probability of this event, let $$A = \{\text{no coworker rolls a 1 or 2}\}$$ and $$B = \{\text{no coworker rolls a 1}\}.$$ Note that $A \subset B$, and that $B \setminus A$ is the event no coworker rolled a 1, but at least one coworker rolled a 2. Since $P(A) = (18/20)^n$ as above, and $P(B) = (19/20)^n$, it follows that $P(B \setminus A) = (19/20)^n - (18/20)^n$. If this happens, you have a $1/20$ chance of rolling a 1 and losing right away. Probability: $[(19/20)^n - (18/20)^n] \cdot \frac{1}{20}$

Case 3 (you play and immediately win): At least one coworker rolls a 1, and you roll a 2 or better and get to enjoy the fruits of someone else's coffee-labor. The probability of at least one coworker rolling a 1 is $1 - (19/20)^n$, and the probability that you get a higher roll is $19/20$. Or alternatively, no coworker gets a 1, but one does get a 2, and you roll a 3 or better; the probability of this is $[(\frac{19}{20})^n - (\frac{18}{20})^n] \cdot \frac{18}{20}$. Total probability: $[1 - (\frac{19}{20})^n] \cdot \frac{19}{20} + [(\frac{19}{20})^n - (\frac{18}{20})^n] \cdot \frac{18}{20}$

Case 4 (you tie on a 1): At least one coworker rolls a 1, and you roll a 1. Here's where it gets ugly; we have to care about how many coworkers tied in that roll. For $i \in \{1, \dots, n\}$, the probability of exactly $i$ of your coworkers rolling a 1 can be computed via a binomial distribution. The probability that exactly $i$ of your coworkers rolled a 1 is given by $$\binom{n}{i} \left(\frac{1}{20} \right)^i \left( \frac{19}{20} \right)^{n-i}$$ and if this happens, you have a $\frac{1}{20}$ chance of tying them. From here, you enter into the tiebreaker thunderdome, in which each of you has a $\frac{1}{i+1}$ chance of losing.

• Sub-probability of losing: $\sum_{i=1}^n \binom{n}{i} (\frac{1}{20})^i (\frac{19}{20})^{n-i} \cdot \frac{1}{20} \cdot \frac 1 {i+1}$
• Sub-probability of winning: $\sum_{i=1}^n \binom{n}{i} (\frac{1}{20})^i (\frac{19}{20})^{n-i} \cdot \frac{1}{20} \cdot \frac {i} {i+1}$

Case 5 (you tie on a 2): No coworker rolls a 1, a coworker rolls a 2, and you roll a 2. The probability that exactly $i$ of your coworkers rolled a 2, and that none rolled a 1, is given by $$\binom{n}{i} \left(\frac{1}{20} \right)^i \left( \frac{18}{20} \right)^{n-i}$$ and if this happens, you have a $\frac{1}{20}$ chance of tying them, at which point you again enter the tiebreaker.

• Sub-probability of losing: $\sum_{i=1}^n \binom{n}{i} (\frac{1}{20})^i (\frac{18}{20})^{n-i} \cdot \frac{1}{20} \cdot \frac 1 {i+1}$
• Sub-probability of winning: $\sum_{i=1}^n \binom{n}{i} (\frac{1}{20})^i (\frac{18}{20})^{n-i} \cdot \frac{1}{20} \cdot \frac {i} {i+1}$

We can stop and observe here that the sum of the aforementioned probabilities is indeed 1, so we've correctly captured all possibilities. Now, we pick out the ones that cause you to lose; the total probability of you losing is \begin{align*} p(n) := & \left[ \left(\frac{19}{20} \right)^n - \left(\frac{18}{20} \right)^n \right] \cdot \frac{1}{20} + \sum_{i=1}^n \binom{n}{i} \left(\frac{1}{20} \right)^i \left(\frac{19}{20} \right)^{n-i} \cdot \frac{1}{20} \cdot \frac 1 {i+1} \\ & \qquad + \sum_{i=1}^n \binom{n}{i} \left(\frac{1}{20} \right)^i \left(\frac{18}{20} \right)^{n-i} \cdot \frac{1}{20} \cdot \frac 1 {i+1} \\ =& \frac{1}{20} \left[\left( \frac{19}{20} \right)^n - \left( \frac{18}{20} \right)^n + \sum_{i=1}^n \frac 1 {i+1} \binom{n}{i} \left( \frac{1}{20} \right)^{i} \left( \left( \frac{18}{20} \right)^{n-i} + \left( \frac{19}{20} \right)^{n-i} \right) \right] \end{align*}

Now, we can easily answer your first question; when $n = 2$, we get $\fbox{7/750}$. But, we're also in a position to tackle your second question.

The most straightforward way to find the maximum value here is to just explicitly compute some values using your favorite software. I used MATLAB; my code is included at the end. Some specific values of $p(n)$ for the expression above:

$$\begin{array}{c|c} n & p(n) \\ \hline 12 & 0.0291273 \\ 13 & 0.0296693 \\ 14 & 0.0300638 \\ 15 & 0.0303295 \\ 16 & 0.0304832 \\ 17 & 0.0305978 \\ 18 & 0.0305123 \\ 19 & 0.0304127 \\ 20 & 0.0302510 \\ 21 & 0.0300364 \end{array}$$ It looks from this exploration like $n = 17$ gives the highest probability by a rather slim margin. To verify that this is the location of the absolute max of the $p(n)$ function above, we note that when $n \geq 32$, the probability that you have to make coffee is at most $1/33$, since your situation is more favorable than one in which everyone just had an equal chance of making coffee. Since $1/33 = 0.\overline{03}$ and we had a value on the chart above that exceeded this, we know that the maximum occurs somewhere in $\{1, 32\}$. Checking each of those values individually shows that the maximum does indeed occur at $\fbox{n=17}$.

MATLAB code to reproduce calculations:

syms i;
f = @(n) 1/20 * [(19/20)^n - (18/20)^n + symsum(1/(i+1) * nchoosek(n, i) * (1/20)^i * ((18/20)^(n-i) + (19/20)^(n-i)), i, 1, n)]
f(2) %verifying that I entered the expression correctly
format long;
double(f(12));
double(f(13)); %etc. There is certainly a less clunky way to do this, such as with vectors, but it wasn't that many numbers so I just did all of 1-32 manually.

• Amazing! I came to the same conclusion (n=17) with my simulator, which yielded 3.054755% for n=17 simulating 100000000 days of coffee making, 3.048978% for n=16, and 3.048783% for n=18. Nov 3, 2017 at 19:52
• I would like to add that I have yet to have make coffee. :-) Nov 3, 2017 at 19:52