I have had a couple of requests to show how the mean value of an exploding die is calculated.
If you do not like math, stop reading now.You have been warned.
What follows is not an exhaustive proof, merely the steps I went through to derive the formula for calculating mean values of an exploding die.
These existing formulas and properties will be used below, so understanding how they work is necessary:
Arithmetic mean Commutative Property of Addition Summation Sum of a Geometric SeriesDefinition:
Exploding Dice: When certain numbers are rolled, the die is rolled again, adding the result to the total. This may be repeated as long as a triggering value is rolled.
In all cases, the following variables and restriction are in place:
Let x = an integer that is the total number of sides on one die
Let y = an integer that is the total number of sides on one die that explode
Each face of the die has a unique integer value in the interval [1, x]
x > 0
0 <= y < x
Does the mean value of an exploding die change based on which face of the die causes the explosion? Let f(x) be the mean value of a die.
Assuming the die explodes on a 1 then the result of a 1 adds the result of another die roll.
f(x) = ((1 + f(x)) + 2 + 3 + ... + x) / x
Assuming the die explodes on the highest result then the result of x adds the result of another die roll.
f(x) = (1 + 2 + 3 + ... + (x + f(x))) / x
Does ((1 + f(x)) + 2 + 3 + ... + x) / x = (1 + 2 + 3 + ... + (x + f(x))) / x?
The only difference is the placement of the recursive f(x) term and per the Commutative Property of Addition the order of the summation does not effect the end total.
Thus which face causes the explosion does not change the mean value of the die.
What is the effect of allowing more than 1 face of the die to explode? Again, let f(x) be the mean value of a die.
Assuming that the die explodes on 1 facing yields:
f(x) = (1 + 2 + 3 + ... + x + f(x)) / x
Assuming that the die explodes on 2 facings yields:
f(x) = (1 + 2 + 3 + ... + x + f(x) + f(x)) / x
or
f(x) = (1 + 2 + 3 + ... + x + 2f(x)) / x
Assuming that the die explodes on 3 facings yields:
f(x) = (1 + 2 + 3 + ... + x + f(x) + f(x) + f(x)) / x
or
f(x) = (1 + 2 + 3 + ... + x + 3f(x)) / x
Assuming that the die explodes on y facings yields:
f(x, y) = (1 + 2 + 3 + ... + x + yf(x)) / x
The formula can be rewritten as
((
1 + 2 + 3 + ... + x) / x) + (yf(x, y) / x)
with the blue portion simply being summation of numbers from 1 to x and can be replace with (x(x+1)) / 2
(((x(x+1)) / 2) / x) + (yf(x, y) / x)
which can be further simplified to
((x+1) / 2) + ((y/x)f(x, y))
Thus f(x, y) = ((x+1) / 2) + ((y/x)f(x, y))
What is the formula to calculate the mean value of an exploding die? To make this easier to see, let A = (x+1) / 2 so
f(x, y) = A + (y/x)f(x, y)
This is the sum of a geometric series and looks as follows:
f(x, y) = A + A(y/x) + A(y/x)
2 + A(y/x)
3 + A(y/x)
4 ...
In this case, the common ratio is r = y/x. The sum of a geometric series converges so long as -1 < r < 1. Thus, this series only converges if -x < y < x.
Per the assertion up top, 0 <= y < x so this series converges and can be calculated as follows
f(x, y) = A / (1 - r)
In this case, A = (x+1) / 2 and r = y / x so
f(x, y) = ((x+1) / 2) / (1 - (y / x))
which simplifes to
f(x, y) = (x + 1) / (2 * (1 - (y / x)))
Thus the mean value of a die with x sides and exploding on y faces can be found using the formula f(x, y) = (x + 1) / (2 * (1 - (y / x)))