# A question of.. Probability! [closed]

You have six loaded dice (I mean falsified, non regular).

In the first die there is always a $10\%$ of probability for $1$ to come out.
In the second die there is always a $20\%$ of probability for $2$ to come out.
In the third die there is always a $30\%$ of probability for $3$ to come out.
In the fourth die there is always a $40\%$ of probability for $4$ to come out.
In the fifth die there is always a $50\%$ of probability for $5$ to come out.
In the sixth die there is always a $60\%$ of probability for $6$ to come out.

All six dice are 6 sided, and the remaining numbers of each dice have an equal probability to come out.

What is the probability for $21$ to come out?

• What are the probabilities for the remaining numbers? Equally distributed? – Dr Xorile Dec 9 '15 at 19:26
• Oh I forgot. Yes they are equally distributed. – Henry Dec 9 '15 at 19:44
• Just to clarify, are you asking for the probability of the sum of all six dice to be equal to 21? – 2012rcampion Dec 9 '15 at 22:12
• There are lots of ways in which you can get $21$. Anyway, yes: the total sum must be $21$. – Henry Dec 9 '15 at 22:15

Dr. Xorile gives a brute-force approach; here's a more efficient dynamic programming method.

Let $p_k(n)$ be the probability that the first $k$ dice sum to $n$. The question then asks for $p_6(21)$

We can define $p$ recursively, starting with the base case $k=0$:

$$p_0(n)=\delta_{0,n}$$

($\delta_{ij}$ is the Kroneker delta, equal to $1$ when its arguments are the same, and $0$ when they differ.)

Next we need to know the probability distributions for the different dice. The $k$th die has one face with probability $k/10$, and the others five have probability $(1-k/10)/5=1/5-k/50$.

Finally, we calculate $p$ for successive values of $k$:

$$p_k(n) = \left[\sum_{i\in(1\ldots 6)}(1-\delta_{ki})(1/5-k/50)p_{k-1}(n-i)\right]+(k/10)\left[p_{k-1}(n-k)\right]$$

Coding this in Mathematica:

p[0, 0] = 1;
p[0, _] = 0;
p[k_, n_] := p[k, n] =
Sum[(1 - KroneckerDelta[i, k]) (1/5-k/50) p[k-1, n-i], {i, 1, 6}] + (k/10) p[k-1, n-k]

p[6, 21] (* 32890443/390625000 *)


This is the same result as Dr. Xorile, but achieved in $O(nkd)$ time vs. $O(d^k)$ (where $d$ is the number of faces per die).

• Simply Beautiful!! – Henry Dec 10 '15 at 11:50

Assuming equally distributed probability of the "other" throws:

6: 2.1504e-06
7: 1.516032e-05
8: 6.105599999999999e-05
9: 0.0001866496
10: 0.0004811571199999999
11: 0.0011080704000000004
12: 0.002317765120000012
13: 0.00445283840000005
14: 0.007932728320000082
15: 0.013234946560000219
16: 0.02078419456000026
17: 0.03073397760000035
18: 0.042942725119999754
19: 0.05675394815999913
20: 0.07107977727999641
21: 0.08419953407999499
22: 0.09412483327999363
23: 0.09939161855999414
24: 0.09888333311999539
25: 0.09254429439999612
26: 0.08094589695999811
27: 0.06610059775999934
28: 0.050275064320000035
29: 0.03517282560000011
30: 0.022496632320000085
31: 0.012905395200000015
32: 0.006652177920000004
33: 0.0029200895999999987
34: 0.0010063871999999997
35: 0.0002651443199999999
36: 2.9030399999999992e-05

Or, if you prefer the exact answer:

6: 21/9765625
7: 2961/195312500
8: 477/7812500
9: 7291/39062500
10: 23494/48828125
11: 10821/9765625
12: 905377/390625000
13: 173939/39062500
14: 1549361/195312500
15: 5169901/390625000
16: 4059413/195312500
17: 600273/19531250
18: 8387251/195312500
19: 22169511/390625000
20: 13882769/195312500
21: 32890443/390625000
22: 36767513/390625000
23: 38824851/390625000
24: 19313151/195312500
25: 7230023/78125000
26: 31619491/390625000
27: 12910273/195312500
28: 19638697/390625000
29: 2747877/78125000
30: 8787747/390625000
31: 504117/39062500
32: 2598507/390625000
33: 57033/19531250
34: 9828/9765625
35: 25893/97656250
36: 567/19531250

Here's a brief explanation of how I did this:
First, here's a list of the probabilities associated with the different dice throws:

Dice 1 probabilities
Probability of a 1 is 1/10
Probability of a 2 is 9/50
Probability of a 3 is 9/50
Probability of a 4 is 9/50
Probability of a 5 is 9/50
Probability of a 6 is 9/50

Dice 2 probabilities
Probability of a 1 is 4/25
Probability of a 2 is 1/5
Probability of a 3 is 4/25
Probability of a 4 is 4/25
Probability of a 5 is 4/25
Probability of a 6 is 4/25

Dice 3 probabilities
Probability of a 1 is 7/50
Probability of a 2 is 7/50
Probability of a 3 is 3/10
Probability of a 4 is 7/50
Probability of a 5 is 7/50
Probability of a 6 is 7/50

Dice 4 probabilities
Probability of a 1 is 3/25
Probability of a 2 is 3/25
Probability of a 3 is 3/25
Probability of a 4 is 2/5
Probability of a 5 is 3/25
Probability of a 6 is 3/25

Dice 5 probabilities
Probability of a 1 is 1/10
Probability of a 2 is 1/10
Probability of a 3 is 1/10
Probability of a 4 is 1/10
Probability of a 5 is 1/2
Probability of a 6 is 1/10

Dice 6 probabilities
Probability of a 1 is 2/25
Probability of a 2 is 2/25
Probability of a 3 is 2/25
Probability of a 4 is 2/25
Probability of a 5 is 2/25
Probability of a 6 is 3/5

Then, there are only $6^6 = 46656$ possible throws. This is a small number for a computer to iterate through, so I do so. For each throw, I calculate what the probability of it occurring is, and what the sum of the dice is. I accumulate that sum to the probability of getting that number.

Here are some examples of ways to throw 21:

Die 1 has a 1 (probability 1/10 ) Die 2 has a 1 (probability 4/25 ) Die 3 has a 1 (probability 7/50 ) Die 4 has a 6 (probability 3/25 ) Die 5 has a 6 (probability 1/10 ) Die 6 has a 6 (probability 3/5 ) Probability of this throw: 63/3906250

Die 1 has a 1 (probability 1/10 ) Die 2 has a 1 (probability 4/25 ) Die 3 has a 2 (probability 7/50 ) Die 4 has a 5 (probability 3/25 ) Die 5 has a 6 (probability 1/10 ) Die 6 has a 6 (probability 3/5 ) Probability of this throw: 63/3906250

Die 1 has a 1 (probability 1/10 ) Die 2 has a 1 (probability 4/25 ) Die 3 has a 2 (probability 7/50 ) Die 4 has a 6 (probability 3/25 ) Die 5 has a 5 (probability 1/2 ) Die 6 has a 6 (probability 3/5 ) Probability of this throw: 63/781250

Die 1 has a 1 (probability 1/10 ) Die 2 has a 1 (probability 4/25 ) Die 3 has a 2 (probability 7/50 ) Die 4 has a 6 (probability 3/25 ) Die 5 has a 6 (probability 1/10 ) Die 6 has a 5 (probability 2/25 ) Probability of this throw: 21/9765625

Die 1 has a 1 (probability 1/10 ) Die 2 has a 1 (probability 4/25 ) Die 3 has a 3 (probability 3/10 ) Die 4 has a 4 (probability 2/5 ) Die 5 has a 6 (probability 1/10 ) Die 6 has a 6 (probability 3/5 ) Probability of this throw: 9/78125

Die 1 has a 1 (probability 1/10 ) Die 2 has a 1 (probability 4/25 ) Die 3 has a 3 (probability 3/10 ) Die 4 has a 5 (probability 3/25 ) Die 5 has a 5 (probability 1/2 ) Die 6 has a 6 (probability 3/5 ) Probability of this throw: 27/156250

Obviously this goes on for some time, but in the end you get the answer. Below is the python script:

from collections import defaultdict
import itertools
import fractions

#Generate the probabilities for the dice
dice=defaultdict(list)
for die in range(1,7):
for throw in range(7):
if throw==0:
dice[die].append(0)
elif die==throw:
dice[die].append(fractions.Fraction(die,10))
else:
dice[die].append(fractions.Fraction(10-die,50))

#Generate the probabilities for the different throws
results = defaultdict(fractions.Fraction)
for throw in itertools.product(range(1,7),repeat=6):
prob=fractions.Fraction(1,1)
for die,t in zip(range(1,7),throw):
prob*=dice[die][t]
results[sum(throw)]+=prob

#Print results
for r in results:
print("%2d: %s"%(r,results[r]))

• It might be nice to see some explanation of how you arrived at this answer... – GentlePurpleRain Dec 9 '15 at 21:31
• @GentlePurpleRain, done! I'm assuming that there won't be a nice elegant way to see this result, so brute force rules the day. By the way, the code is Python 3.x. – Dr Xorile Dec 9 '15 at 22:49