Solving a Three-Dice Problem Using Two Approaches
Introduction
In his book, Do Dice Play God, Ian Stewart wrote
For three dice, Cardano solved a long-standing conundrum. Gamblers had long known from experience that when throwing three dice, a total of 10 is more likely than 9. This puzzled them …
In this note, I will focus my attention to the so-called 3-dice problem: We roll three dice simultaneously; what’s the probability that we get a total
The probability that we get a total
where
Generating function approach
We define
- for
,
- for
,
- for
- for
,
- for
,
- for
,
Remark: In the above we have used the following well known result:
Brute force approach
n_dice_problem <- function(n = 3)
{x <- rep(list(1:6), n)
y <- as.matrix(expand.grid(x))
table(rowSums(y))
}
(n_dice_problem(n = 3))
##
## 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
## 1 3 6 10 15 21 25 27 27 25 21 15 10 6 3 1
(n_dice_problem(n = 4))
##
## 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
## 1 4 10 20 35 56 80 104 125 140 146 140 125 104 80 56 35 20 10 4
## 24
## 1
Generalizing 3-dice problem to n-dice problem
An obvious generalization of the 3-dice problem is an
In the brute-approach section, we already have R function n_dice_problem()
, but
because of computer memory limit the value of
library(gmp)
c_n_t <- function(t, n) {
a <- floor((t - n) / 6)
i <- as.bigz(0:a)
temp <- (-1)^i * chooseZ(n, i) * chooseZ(t - 6*i - 1, n - 1)
sum(temp)
}
c_n_t(300, 100)
## Big Integer ('bigz') :
## [1] 207241756759032546720209656767808329086730171654102671945216674007548108775
Acknowledgment: I thank Professor Martin Maechler of ETH Zurich for pointing me to gmp
package.
Reference
[1] Stewart, I. Do Dice Play God? pp. 29-30.