# Probability of the maximum of n dice rolls being equal to k

As part of my recent interest in university-level statistics, I'm trying to figure out what the probability distribution is for the following scenario, without having to resort to counting the number of outcomes:

Suppose I roll two dice, but rather than adding them together I use the higher of the two as the "result" of the event.

This is not a homework question, I'm just trying to learn some "advanced" statistics techniques out of personal interest (for example, I've recently learned that you can find the probability distribution for the sum of two independent events by convolving the individual distributions). So I'd like to know if there's a "better" way to do this than enumerating all the possible outcomes and counting those that fit the criterion. I suppose the criteria for "better" would be:

• Less computationally expensive (i.e. faster if it were to be implemented on a computer)
• More interesting from a mathematical analysis standpoint.

Thank you

## Update to question

How would I generalize the explanation in dsaxton's answer, namely:

$P(\max(X_1, X_2) = k) = 2 P(X_1 = k \cap X_2 \leq k) - P(X_1 = k \cap X_2 = k)$

to the maximum of three or more dice?

In the case of the max of three dice, it looks like the cases are:

• $x1 = k$ and $x2 \leq k$ and $x3 \leq k$
• $x2 = k$ and $x1 \leq k$ and $x3 \leq k$
• $x3 = k$ and $x1 \leq k$ and $x2 \leq k$

which suggests that the probability would be

$P(\max(x1, x2, x3) = k) = P(x1 = k \cap x2 \leq k \cap x3 \leq k) + P(x2 = k \cap x1 \leq k \cap x3 \leq k) + P(x3 = k \cap x1 \leq k \cap x2 \leq k) - P(x1 = k \cap x2 = k \cap x3 = k)$

(though maybe this is still multi-counting?)

Is there some way to use combinatorics or some other technique to express the expanded formula for the max of $n$ dice?

• The answer you got sounds great (+1), but here is an alternative derivation. Feb 25, 2016 at 1:33
• This looks like a you made a major change to your question after getting a good answer, which would invalidate the answer you already have (since it doesn't answer the new question). It would be best to ask that as a new question and link the question back here for context, unless dsaxton is happy to answer it here as well. (On the other hand, I think even the extended question may be a duplicate so this may close in any case.) Feb 25, 2016 at 2:46
• Generally, when $n$ independent observations of random variables following a common cumulative distribution $F$ are made, the cdf of the maximum of those observations is $F^n$ (this is an easy deduction from the probability axioms). Thus, the chance that the maximum exactly equals some value $x$ is the chance that it is less than or equal to $x$ but not less than or equal to any number less than $x.$ In short, you seek $\lim_{\epsilon\to 0^+} F^n(x) - F^n(x-\epsilon).$ For the dice and values $x\in\{1,2,\ldots,6\}$ this directly gives $(x/6)^n-((x-1)/6)^n.$
– whuber
Feb 25 at 13:50

You don't need to enumerate all possibilities, just consider that $\max(X_1, X_2) = k$ simply means $X_1 = k$ and $X_2 \leq k$ or $X_2 = k$ and $X_1 \leq k$. So we just add the probabilities of these events (which by symmetry are equal) and subtract their intersection to avoid double counting,

\begin{align} P(\max(X_1, X_2) = k) &= 2 P(X_1 = k \cap X_2 \leq k) - P(X_1 = k \cap X_2 = k) \\ &= \frac{2k}{36} - \frac{1}{36} \\ &= \frac{2k - 1}{36} . \end{align}

To extend this idea to $m$ dice it gets a bit more complicated as we need to be more careful about applying the inclusion exclusion principle. Let $A_i \equiv \{ X_i = k \cap X_j \leq k \text{ for$j \neq i$}\}$. Then

\begin{align} P(\max(X_1, \ldots , X_m) = k) =& P(\cup_{i=1}^{m} A_i) \\ =& \sum_{i=1}^{m} P(A_i) - \sum_{i \neq j} P(A_i \cap A_j) + \\ & \sum_{i \neq j, i \neq l, j \neq l} P(A_i \cap A_j \cap A_l) - \\ & \ldots + (-1)^{m + 1} P(\cap_{i=1}^{m} A_i) \\ =& \frac{m k^{m - 1}}{6^m} - \binom{m}{2} \frac{k^{m - 2}}{6^m} + \\ & \binom{m}{3} \frac{k^{m - 3}}{6^m} - \ldots + (-1)^{m + 1} \frac{1}{6^m} \\ =& \frac{1}{6^m} \sum_{i=1}^{m} (-1)^{i+1} \binom{m}{i} k^{m - i} . \end{align}

## Edit:

I just realized the title of your post seems to be asking a different question than what's in the post itself. If you want to find the probability that $X_1 \geq X_2$ then you can take a conditional expectation,

\begin{align} P(X_1 \geq X_2) &= \text{E}[P(X_1 \geq X_2 \mid X_1)] \\ &= \text{E} \left ( \frac{X_1}{6} \right ) \\ &= \frac{3.5}{6} . \end{align}

Here we've used the general result that $\text{E}(X) = \text{E}[\text{E}(X \mid Y)]$ for random variables $X$ and $Y$, and that probabilities themselves may be viewed as expectations of indicator random variables. Even simpler perhaps, we can arrive at the answer by basically only using the fact that probabilities sum to one,

$$P(X_1 \geq X_2) + P(X_2 \geq X_1) - P(X_1 = X_2) = 1 \Rightarrow \\ 2 P(X_1 \geq X_2) - \frac{1}{6} = 1 \Rightarrow \\ P(X_1 \geq X_2) = \frac{3.5}{6} .$$

• This helped greatly, thank you - I just worked it out on paper and I follow... How would I generalize this to the maximum of three or more dice? In the case of the max of three dice, it looks like the cases are: x1 = k and x2 <= k and x3 <= k ; x2 = k and x1 <= k and x3 <= k ; x3 = k and x1 <= k and x2 <= k. Is there some way to use combinations to figure out what the expanded formula should be? Feb 25, 2016 at 2:17
• I added the mass function for general $m$ to the post. It's a bit dense so let me know if anything isn't clear. Feb 25, 2016 at 2:47
• Actually, your first answer (before the edit) is exactly what I was looking for. I was trying to figure out the probability of the value k being the maximum of three d20 rolls. You used d6 dice but it's easy to generalize to others. May 8, 2021 at 16:11

A simpler solution that gives the same final answer as for using the inclusion–exclusion principle is to define two event:

A = at least one of the n dice rolls results is k.

B = all of the dice rolls results is less or equal to k.

Now if X is the greatest result, then:

P(X=k) = P(A and B) = P(A|B)•P(B) = (1-P(A^c|B))•P(B).

P(B) = the probability to get a number from the set {1,..,k} out of the 6 optional results.

P(B) = (k/6)^n

P(A^c|B) = considering the fact that every result can be either number from {1,..,k}, the probability not getting k at all will be choosing a number from the set {1,..,(k-1)} of the k optional results.

P(A^c|B) = ((k-1)/k)^n

So the final answer will be:

P(X=k) = (1-((k-1)/k)^n)•(k/6)^n

• The idea is good but the calculations aren't quite correct: $k$ should not appear in the denominators of the fractions.
– whuber
Feb 25 at 13:50
• Are you sure about that? first of all, by simplifying "dsaxton" result using wolframalpha we get that both answers are identical. Second, how else would you calculate: P(A^c|B) ? which means - we wouldn't get k in the dice, knowing that the dice will fall on a number from {1,...,k} Mar 6 at 15:34
• You are correct: I did not notice that the powers of $k$ cancel in your formula. For the simplified version, see my comment to the question.
– whuber
Mar 6 at 15:36