17
$\begingroup$

Take the 5 Platonic solids from a set of Dungeons&Dragons dice. These consist of a 4-sided, 6-sided (conventional), 8-sided, 12-sided, and 20-sided dice. All start at the number 1 and count upwards by 1 to their total.

Roll them all, and take their sum (minimum sum is 5, max is 50). Do so multiple times. What is the distribution?

Obviously they will tend towards the low end [Edit: this is wrong.], since there are more lower numbers than higher. But will there be notable inflection points at each boundary of the individual die?

[Edit: Apparently, what seemed obvious isn't. According to one of the commentators, the average is (5+50)/2=27.5. I wasn't expecting this for some reason. But, now, it's so trivial I should have known already. Perhaps there needs to be an "algebra" of probabilities or an axiom "If a algebraic transformation works for the natural numbers, it works for probability distributions."]

$\endgroup$
19
  • 1
    $\begingroup$ Do you mean what is the distribution of the sum of discrete uniforms $[1,4]+[1,6]+[1,8]+[1,12]+[1,20]$? $\endgroup$ Oct 15, 2015 at 23:27
  • $\begingroup$ Yes, sorry, will edit Q. $\endgroup$
    – Marcos
    Oct 15, 2015 at 23:30
  • 2
    $\begingroup$ One way to examine it is simulation. In R: hist(rowSums(sapply(c(4, 6, 8, 12, 20), sample, 1e6, replace = TRUE))). It doesn't actually tend towards the low end; of the possible values from 5 to 50, the average is 27.5, and the distribution is (visually) not far from normal. $\endgroup$ Oct 15, 2015 at 23:37
  • 2
    $\begingroup$ My D&D set has a d10 as well as the 5 you mention (plus a decader, which I presume you don't include) $\endgroup$
    – Glen_b
    Oct 15, 2015 at 23:50
  • 1
    $\begingroup$ Wolfram Alpha computes the answer exactly. Here is the probability generating function, from which you can read off the distribution directly. BTW, this question is a special case of one that is asked and thoroughly answered at stats.stackexchange.com/q/3614 and at stats.stackexchange.com/questions/116792. $\endgroup$
    – whuber
    Oct 16, 2015 at 15:27

6 Answers 6

20
$\begingroup$

I wouldn't want to do it algebraically, but you can calculate the pmf simply enough (it's just convolution, which is really easy in a spreadsheet).

I calculated these in a spreadsheet*:

i        n(i)   100 p(i)
5         1     0.0022
6         5     0.0109
7        15     0.0326
8        35     0.0760
9        69     0.1497
10      121     0.2626
11      194     0.4210
12      290     0.6293
13      409     0.8876
14      549     1.1914
15      707     1.5343
16      879     1.9076
17     1060     2.3003
18     1244     2.6997
19     1425     3.0924
20     1597     3.4657
21     1755     3.8086
22     1895     4.1124
23     2014     4.3707
24     2110     4.5790
25     2182     4.7352
26     2230     4.8394
27     2254     4.8915
28     2254     4.8915
29     2230     4.8394
30     2182     4.7352
31     2110     4.5790
32     2014     4.3707
33     1895     4.1124
34     1755     3.8086
35     1597     3.4657
36     1425     3.0924
37     1244     2.6997
38     1060     2.3003
39      879     1.9076
40      707     1.5343
41      549     1.1914
42      409     0.8876
43      290     0.6293
44      194     0.4210
45      121     0.2626
46       69     0.1497
47       35     0.0760
48       15     0.0326
49        5     0.0109
50        1     0.0022

Here $n(i)$ is the number of ways of getting each total $i$; $p(i)$ is the probability, where $p(i) = n(i)/46080$. The most likely outcomes happen less than 5% of the time.

The y-axis is probability expressed as a percentage. enter image description here

* The method I used is similar to the procedure outlined here, though the exact mechanics involved in setting it up change as user interface details change (that post is about 5 years old now though I updated it about a year ago). And I used a different package this time (I did it in LibreOffice's Calc this time). Still, that's the gist of it.

$\endgroup$
12
  • $\begingroup$ Amazing, I wasn't expecting a symmetrical distribution at all. I'm not sure why my intuition was so far off. $\endgroup$
    – Marcos
    Oct 16, 2015 at 0:07
  • 8
    $\begingroup$ The sum of independent symmetric random variables is also symmetric in distribution. $\endgroup$
    – Glen_b
    Oct 16, 2015 at 0:24
  • $\begingroup$ Nice rule. Is that published somewhere? $\endgroup$
    – Marcos
    Oct 16, 2015 at 0:32
  • 4
    $\begingroup$ Yes, but my point was it's too trivial to get a journal to publish it, it would only be set as an exercise for a student. You can use the fact that the characteristic function of a random variable that's symmetric around the origin is real and even (which fact you can find it stated at the wikipedia page on the characteristic function) -- well, and I guess you need the one-to-one property of cfs vs pmfs as well, or use the dual relationship to establish that an even cf also implies a symmetric pmf ... $\endgroup$
    – Glen_b
    Oct 16, 2015 at 0:41
  • 2
    $\begingroup$ ... and the fact that a product of even functions is even, but it's actually obvious enough just from direct consideration of how convolution works - in a convolution of two symmetric functions (pmfs in this case), for every term in the sum of products at one end there's a corresponding term of the same size at the other end, symmetrically placed around the center. $\endgroup$
    – Glen_b
    Oct 16, 2015 at 0:46
8
$\begingroup$

So I made this code:

d4 <- 1:4  #the faces on a d4
d6 <- 1:6  #the faces on a d6
d8 <- 1:8  #the faces on a d8
d10 <- 1:10 #the faces on a d10 (not used)
d12 <- 1:12 #the faces on a d12
d20 <- 1:20 #the faces on a d20

N <- 2000000  #run it 2 million times
mysum <- numeric(length = N)

for (i in 1:N){
     mysum[i] <- sample(d4,1)+
                 sample(d6,1)+
                 sample(d8,1)+
                 sample(d12,1)+
                 sample(d20,1)
}

#make the plot
hist(mysum,breaks = 1000,freq = FALSE,ylim=c(0,1))
grid()

The result is this plot. enter image description here

It is quite Gaussian looking. I think we (again) may have demonstrated a variation on the central limit theorem.

$\endgroup$
9
  • 2
    $\begingroup$ Hmm, the lowest roll in your simulation is 6. The probability of rolling it (or any single roll, preserving die identity) is 1:4*1:6*1:8*1:10*1:12*1:20=1:460800. My procedures would demand a sample size N at least twice (perhaps 4x) this amount (like a Nyquist limit) to reveal any errors in my modeling. $\endgroup$
    – Marcos
    Oct 16, 2015 at 0:22
  • 4
    $\begingroup$ @EngrStudent It is bell-shaped and symmetric but a fair way from Gaussian (the relatively large variance of the d20 makes it a fair bit shorter tailed than normal), but there is a version of the CLT that would apply if you had a lot of different dice. (Here "a lot" is handwaving; the CLT is really about what happens as $n\to\infty$; however, in finite samples we could invoke something along the lines of Berry-Esseen - or if we set it up right we could invoke that directly - which gives bounds on how far we could be from normal) $\endgroup$
    – Glen_b
    Oct 16, 2015 at 0:52
  • 1
    $\begingroup$ @EngrStudent: Sweet. Thanks for doing the simulation. I'm accepting Glens answer as it is a more exact answer, but your simulation was definitely practical in absence of a complete model. Glen noted the rule that I didn't know "the sum of multiple independent symmetric random variables is also symmetric." $\endgroup$
    – Marcos
    Oct 16, 2015 at 0:57
  • 1
    $\begingroup$ @EngrStudent: BTW, doesn't your result confirm CLT? $\endgroup$
    – Marcos
    Oct 16, 2015 at 1:01
  • 1
    $\begingroup$ @theDoctor no, it doesn't confirm the CLT for a host of reasons $\endgroup$
    – Glen_b
    Oct 16, 2015 at 1:45
7
$\begingroup$

I will show an approach to do this algebraically, with the aid of R. Assume the different dice have probability distributions given by vectors $$ \DeclareMathOperator{\P}{\mathbb{P}} P(X=i)=p(i) $$ where $X$ is the number of eyes seen on throwing the dice, and $i$ is a integer in the range $0,1,\dots,n$. So the probability of two eyes, say, is in the third vector component. Then a standard dice has distribution given by the vector $(0,1/6,1/6,1/6,1/6,1/6,1/6)$. The probability generating function (pgf) is then given by $p(t)=\sum_0^6 p(i) t^i$. Let the second dice have distribution given by the vector $q(j)$ with $j$ in range $0,1,\dots,m$. Then the distribution of the sum of eyes on two independent dice rolls given by the product of the pgf' s, $p(t)q(t)$. Writing out the product we can see it is given by the convolution of the coefficient sequences, so can be found by the R function convolve(). Lets test this by two throws of standard dice:

p   <-  q  <-  c(0, rep(1/6, 6))
pq  <-  convolve(p, rev(q), type="open")
zapsmall(pq)
 [1] 0.00000000 0.00000000 0.02777778 0.05555556 0.08333333 0.11111111
 [7] 0.13888889 0.16666667 0.13888889 0.11111111 0.08333333 0.05555556
[13] 0.02777778

and you can check that that is correct (by hand calculation). Now for the real question, five dice with 4,6,8,12,20 sides. I will do the calculation assuming uniform probs for each dice. Then:

p1  <-  c(0, rep(1/4, 4))
p2  <-  c(0, rep(1/6, 6))
p3  <-  c(0, rep(1/8, 8))
p4  <-  c(0, rep(1/12, 12))
p5  <-  c(0, rep(1/20, 20))
s2  <-  convolve(p1, rev(p2), type="open")
s3  <-  convolve(s2, rev(p3), type="open")
s4  <-  convolve(s3, rev(p4), type="open")
s5  <- convolve(s4, rev(p5), type="open")
sum(s5)
[1] 1
zapsmall(s5)
 [1] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00002170
 [7] 0.00010851 0.00032552 0.00075955 0.00149740 0.00262587 0.00421007
[13] 0.00629340 0.00887587 0.01191406 0.01534288 0.01907552 0.02300347
[19] 0.02699653 0.03092448 0.03465712 0.03808594 0.04112413 0.04370660
[25] 0.04578993 0.04735243 0.04839410 0.04891493 0.04891493 0.04839410
[31] 0.04735243 0.04578993 0.04370660 0.04112413 0.03808594 0.03465712
[37] 0.03092448 0.02699653 0.02300347 0.01907552 0.01534288 0.01191406
[43] 0.00887587 0.00629340 0.00421007 0.00262587 0.00149740 0.00075955
[49] 0.00032552 0.00010851 0.00002170
plot(0:50, zapsmall(s5))

The plot is shown below:

enter image description here

Now you can compare this exact solution with simulations.

$\endgroup$
2
  • $\begingroup$ Interesting -- your graph shows the distribution to be asymmetrical, because you included the 5 impossible scenarios in the beginning. $\endgroup$
    – Marcos
    Jun 28, 2022 at 3:49
  • 1
    $\begingroup$ @Marcos that doesn't make the distribution asymmetrical. The rolls 5 impossible scenarios in the end, 51,52,53,54,55, have also zero probability. $\endgroup$ Jun 28, 2022 at 14:22
6
$\begingroup$

A little help to your intuition:

First, consider what happens if you add one to all the faces of one die, e.g. the d4. So, instead of 1,2,3,4, the faces now show 2,3,4,5.

Comparing this situation to the original, it is easy to see that the total sum is now one higher than it used to be. This means that the shape of the distribution is unchanged, it is just moved one step to the side.

Now subtract the average value of each die from every side of that die.

This gives dice marked

  • $-{3\over 2}$,$-{1\over 2}$,${1\over 2}$,${3\over 2}$
  • $-{5\over 2}$,$-{3\over 2}$,$-{1\over 2}$,${1\over 2}$,${3\over 2}$,${5\over 2}$
  • $-{7\over 2}$,$-{5\over 2}$,$-{3\over 2}$,$-{1\over 2}$,${1\over 2}$,${3\over 2}$,${5\over 2}$,${7\over 2}$

etc.

Now, the sum of these dice should still have the same shape as the original, only shifted downwards. It should be clear that this sum is symmetrical around zero. Therefore the original distribution is also symmetrical.

$\endgroup$
2
$\begingroup$

Using the R software I posted earlier at https://stats.stackexchange.com/a/116913/919 for solving problems like this, you can compute the solution in one line:

(all <- d(1,4) + d(1,6) + d(1,8) + d(1,12) + d(1,20))

The output gives all 46 probabilities (not shown), which can be plotted with another line:

plot(all, xlab="Value", yaxp=c(0,1,2), main=expression(d[4]+d[6]+d[8]+d[12]+d[20]))

To this plot I have added the graph of the Normal distribution with the same variance and mean (employing a continuity correction),

curve(pnorm(x, mean(all)-1/2, sqrt(var.die(all))), add=TRUE, col="Red")

Figure

If you prefer to see the probability function, here it is:

with(all, plot(value, prob, type="h", main="Probability Function", cex.main=1))

Figure 2

Clearly the Normal approximation is already good, so we may continue to use it to describe the sum of many rolls of this combination. But if you want to see it precisely computed, you may do so. For instance, here is the sum of four trials with its Normal approximation superimposed (no continuity correction needed),

with(all+all+all+all, plot(value, prob, type="h", main="Sum of Four Trials", cex.main=1))
curve(dnorm(x, mean(all)*4, sqrt(4*var.die(all))), add=TRUE, col="Red", lwd=2)

Figure 3

$\endgroup$
1
  • 2
    $\begingroup$ There are many times when I am reading through answers and I say to myself "this guy has great content" and I get to the end and it was @whuber who did it. I think it might be useful to see the difference between the fitted gaussian and the discrete distribution, where they-axis is the difference in the probabilities. $\endgroup$ Jun 28, 2022 at 13:54
1
$\begingroup$

The Central Limit Theorem answers your question. Though its details and its proof (and that Wikipedia article) are somewhat brain-bending, the gist of it is simple. Per Wikipedia, it states that

the sum of a number of independent and identically distributed random variables with finite variances will tend to a normal distribution as the number of variables grows.

Sketch of a proof for your case:

When you say “roll all the dice at once,” each roll of all the dice is a random variable.

Your dice have finite numbers printed on them. The sum of their values therefore has finite variance.

Every time you roll all the dice, the probability distribution of the outcome is the same. (The dice don’t change between rolls.)

If you roll the dice fairly, then every time you roll them, the outcome is independent. (Previous rolls don’t affect future rolls.)

Independent? Check. Identically distributed? Check. Finite variance? Check. Therefore the sum tends toward a normal distribution.

It wouldn’t even matter if the distribution for one roll of all dice were lopsided toward the low end. I wouldn’t matter if there were cusps in that distribution. All the summing smooths it out and makes it a symmetrical gaussian. You don’t even need to do any algebra or simulation to show it! That’s the surprising insight of the CLT.

$\endgroup$
9
  • 4
    $\begingroup$ While the CLT is relevant, and as the the other posts show, the distributions is roughly gaussian looking, we're only dealing with the sum of 5 independent non-identical distributions. So point 1) 5 is not really big enough to invoke a theorem that applies "at infinity". Point 2) you can't use the vanilla CLt, because the things you sums aren't iid. You need the Lyapunov CLT, I think. $\endgroup$ Oct 16, 2015 at 9:32
  • 2
    $\begingroup$ You do not need the Central Limit Theorem to say that the sum of some independent random variables with distributions symmetric about their respective centres has a symmetric distribution about the sum of the centres. $\endgroup$
    – Henry
    Oct 16, 2015 at 9:48
  • $\begingroup$ @Peter: You’re missing the structure of my proof. The OP says “roll them all at once.” I am taking each roll of all the dice as one random variable. Those random variables do have an identical distribution. No need for Lyapunov. Also, the OP says “do so multiple times,” which I take to mean “in the limit,” so your point #1 is not valid. We aren’t just summing one roll of 5 dice here. $\endgroup$ Oct 16, 2015 at 13:17
  • 2
    $\begingroup$ @PaulCantrell Each roll of all the dice is the sum of five independent non-identically distributed variables. The OP is asking about the distribution of that sum. You may do many rolls of the 5 dice, but that's just sampling from the distribution under question, nobody is summing those samples. $\endgroup$ Oct 16, 2015 at 15:04
  • 1
    $\begingroup$ @PaulCantrell I guess it depends on how you interpret "Do so multiple times." Do so multiple times, and them sum again (getting a single value), or do so multiple times and look at the histogram of those samples (getting multiple values). I took the latter interpretation. $\endgroup$ Oct 16, 2015 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.