# Expected Value of max + min of N d20 dice

Let's say I roll N twenty sided dice. What is the expected value of the highest and lowest rolls?

Bonus: Is there a more general formula if I wanted to find the expected value of N dX dice, where X is the number of sides on each dice? Or what if each if it were a mixture of dice of different numbers of sides?

I wanted to figure this out for a D&D session, but its been a long time since my class in probability theory, lol

• The short exact answer is: 21 – wolfies Jun 3 at 4:52
• And for a T-sided dice, the exact general solution is: $T+1$. – wolfies Jun 3 at 14:07

You might find this answer enlightening: https://math.stackexchange.com/a/150633/26091. In short, the expected maximum of $$n$$ random numbers on the interval $$[0,1]$$ is $$\frac{n}{n+1}$$. Your dice are discrete rather than continuous, but scaling this by $$20$$ (or whatever number of sides you have) for a rough approximation would be pretty good. In other words, the answer is approximately $$20\frac{n}{n+1}.$$

You can check that for one die, this gives $$10$$, which is close to the actual average of $$10.5$$, and as $$n$$ increases, it approaches $$20$$ (as it clearly should).

To refresh your memory, this falls under order statistics in probability theory.

Let $$X_i$$ be a random variable that represents a roll. We can write the maximum as $$X_{\max} = \max\{X_1, X_2, X_3, ... X_N\}$$

Let's use the CDF of $$X_{\max}$$ to find the PDF of $$X_{\max}$$

$$F_{X_{\max}} = P(X_{\max} \leq x)$$

This is the same thing as asking, what is the probability that every die rolled is less than or equal to $$X_{\max}$$. Since these are iid, we have:

$$F_{X_{\max}}(x) = P(X_{\max} \leq x) = P(X_1\leq x)P(X_2\leq x)...P(X_N\le x)$$

If the dice aren't the same, you'd have to compute each of the CDFs independently, and continue to the next step. Since they are the same, we have that $$F_{X_\max}(x) = P_1(X_1 \leq x)^N=x^N/20^N.$$

The PMF is now just the difference between $$F(x) - F(x-1)$$. In this case that's:

$$p(X_\max=x) = {x^N-(x-1)^N \over 20^N}$$

To find the expected value, we just take a weighted sum over the possible rolls

$$E[X_\max] = \sum_{x=1}^{20}x{x^N-(x-1)^N \over 20^N}$$

You can use similar reasoning to find the expectation of the minimum.

I'm only answering the part about rolling a bunch of identical dice. Let $$X$$ be the largest outcome and $$Y$$ the smallest outcome among $$N$$ independent rolls of an $$s$$-sided die with sides numbered from $$1$$ to $$s.$$

For $$E(X)$$ I copy my answer to this old question:

Define $$X_i$$ to be the random variable whose value is $$1$$ if $$X\ge i$$ and $$0$$ otherwise; then $$X=\sum_{i=1}^sX_i$$ and $$E[X]=E\left[\sum_{i=1}^sX_i\right]=\sum_{i=1}^sE[X_i]=\sum_{i=1}^sP(X_i=1)=\sum_{i=1}^sP(X\ge i)=\sum_{i=1}^s[1-P(X\lt i)]=\sum_{i=1}^s\left[1-\left(\frac{i-1}s\right)^N\right]=s-s^{-N}\sum_{i=1}^s(i-1)^N=\boxed{s-s^{-N}\sum_{i=1}^{s-1}i^N}.$$

Now for $$E(Y)$$. Since the outcome of a single roll is distributed symmetrically about its mean $$\frac{1+s}2$$, we have $$E(X)+E(Y)=1+s$$, so that $$E(Y)=1+s-E(X)=\boxed{1+s^{-N}\sum_{i=1}^{s-1}i^N}.$$