Author Topic: Dice probabilities question has me stumped  (Read 524 times)

0 Members and 1 Guest are viewing this topic.

Online soldarTopic starter

  • Super Contributor
  • ***
  • Posts: 3167
  • Country: es
Dice probabilities question has me stumped
« on: March 17, 2024, 09:24:57 am »
I am trying to figure out a probability question regarding a board game called Bell and Hammer which was popular a century ago and which I used to play as a kid.

https://en.wikipedia.org/wiki/Bell_and_Hammer

It uses eight dice and they all have all sides blank except one side which has respectively the numbers 1 to 6, a bell and a hammer, total 8 dice. So the chance of the marked side showing is 1/6

The bell and the hammer are separate from the numbers so let's focus on the bell and the hammer which is simpler as there are only two dice.

Probability of both showing up: 1/36
Probability of only bell: 5/36
Probability of only hammer: 5/36
Probability of none: (5/6)^2 = 25/36
Which adds up nicely to 36/36 =1

With two dice I can easily make a table with all possibilities. With six dice the total is 46656 which I suppose is doable but I would like to use reasoning better than brute force.

Each player throws the dice and the numbers can add up to any number between 0 and 21.
The probability of getting 0 is (5/6)^6 = 0.335
The probability of getting 21 is (1/6)^6 = 0.000021

The probability of getting any exact combination of numbers is (1/6)^6 = 0.000021

So getting a total of 1 has a probability of (1/6)^6=0.000021 because a total of 1 can only be had one way.

But a total of 4 can be obtained by getting the 4 or by getting 3+1 and here I start to get lost.

A 6 can be obtained by 6, by 4+2 and by 1+2+3 so getting a total of 6 is 3 times as likely as getting a 1.

I get lost because I cannot get the total of probabilities to add up to 1.

The probability of getting all blanks is about 1/3 so the probability of getting any number is about 2/3. This makes sense but it does not jibe with my reasoning that there are 42 combinations that produce a number out of a total possible combinations of 46656. This would indicate a chance of about 1/1000 of getting any number which is, obviously, wrong. Where am I going wrong?

I was thinking of simulating this by software. One way to do it is to simulate six dice and add them up, like with physical dice, but I was thinking of just giving probabilities directly to the total and I cannot get it to work in my brain.

All my posts are made with 100% recycled electrons and bare traces of grey matter.
 

Offline kjpye

  • Contributor
  • Posts: 32
  • Country: au
Re: Dice probabilities question has me stumped
« Reply #1 on: March 17, 2024, 11:00:10 am »
Taking just one of your statements, and pointing out an error might give you something to go on...

So getting a total of 1 has a probability of (1/6)^6=0.000021 because a total of 1 can only be had one way.

This is not correct; there are a large number of ways are getting a total of one. The die with the one must be in only one of the six possible positions, but the other five dice can be in any of 5 positions.

Thus the correct probability is (1/6) × (5/6)^5 or .06698
 

Offline thephil

  • Regular Contributor
  • *
  • Posts: 62
  • Country: de
    • Techbotch
Re: Dice probabilities question has me stumped
« Reply #2 on: March 17, 2024, 11:30:35 am »
And here a simple way to simulate it in R (https://www.r-project.org/):

First create the dice and build all possible outcomes:

Code: [Select]
d1 = c(NA, NA, NA, NA, NA, 1)
d2 = c(NA, NA, NA, NA, NA, 2)
d3 = c(NA, NA, NA, NA, NA, 3)
d4 = c(NA, NA, NA, NA, NA, 4)
d5 = c(NA, NA, NA, NA, NA, 5)
d6 = c(NA, NA, NA, NA, NA, 6)
dat = expand.grid(d1,d2,d3,d4,d5,d6)

We can now get the total numbers of the different outcomes:

Code: [Select]
> table(apply(dat, 1, sum, na.rm=T))
    0     1     2     3     4     5     6     7     8     9    10    11    12
15625  3125  3125  3750  3750  4375  4500  2000  1500  1625  1025  1025   425
   13    14    15    16    17    18    19    20    21
  300   200   180    55    30    30     5     5     1

And compute their probabilities:

Code: [Select]
> table(apply(dat, 1, sum, na.rm=T)) / nrow(dat)

           0            1            2            3            4            5
3.348980e-01 6.697960e-02 6.697960e-02 8.037551e-02 8.037551e-02 9.377143e-02
           6            7            8            9           10           11
9.645062e-02 4.286694e-02 3.215021e-02 3.482939e-02 2.196931e-02 2.196931e-02
          12           13           14           15           16           17
9.109225e-03 6.430041e-03 4.286694e-03 3.858025e-03 1.178841e-03 6.430041e-04
          18           19           20           21
6.430041e-04 1.071674e-04 1.071674e-04 2.143347e-05

@kjpye already pointed out that the 5 blanks are distinct events, and seeing the data illustrates it nicely.

Have fun playing with the numbers.
It's never too late to have a happy childhood!
 

Online soldarTopic starter

  • Super Contributor
  • ***
  • Posts: 3167
  • Country: es
Re: Dice probabilities question has me stumped
« Reply #3 on: March 17, 2024, 11:49:41 am »
Taking just one of your statements, and pointing out an error might give you something to go on...

So getting a total of 1 has a probability of (1/6)^6=0.000021 because a total of 1 can only be had one way.

This is not correct; there are a large number of ways are getting a total of one. The die with the one must be in only one of the six possible positions, but the other five dice can be in any of 5 positions.

Thus the correct probability is (1/6) × (5/6)^5 or .06698
Correct.

I was also missing some combinations with numbers. There are 64 combinations which produce a result other than zero. and depending on the number of dice with numbers the probability varies.

I am now convinced it is easier to simulate it the original way: "throw" the six dice with a probability of 1/6 each and then add up the result. Trying to go directly to the probability of the results is way more complicated.
All my posts are made with 100% recycled electrons and bare traces of grey matter.
 

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6264
  • Country: fi
    • My home page and email address
Re: Dice probabilities question has me stumped
« Reply #4 on: March 17, 2024, 11:50:00 am »
I wrote the C code for you:
Code: [Select]
// SPDX-License-Identifier: CC0-1.0
#include <stdlib.h>
#include <stdio.h>

static const unsigned char  faces[6][6] = {
    { 1, 0, 0, 0, 0, 0 },
    { 2, 0, 0, 0, 0, 0 },
    { 3, 0, 0, 0, 0, 0 },
    { 4, 0, 0, 0, 0, 0 },
    { 5, 0, 0, 0, 0, 0 },
    { 6, 0, 0, 0, 0, 0 },
};

int main(void)
{
    unsigned long  sum[22] = { 0 };
    unsigned long  combos = 0;

    for (int d1 = 0; d1 < 6; d1++) {
        const int sum1 = faces[0][d1];
        for (int d2 = 0; d2 < 6; d2++) {
            const int sum2 = sum1 + faces[1][d2];
            for (int d3 = 0; d3 < 6; d3++) {
                const int sum3 = sum2 + faces[2][d3];
                for (int d4 = 0; d4 < 6; d4++) {
                    const int sum4 = sum3 + faces[3][d4];
                    for (int d5 = 0; d5 < 6; d5++) {
                        const int sum5 = sum4 + faces[4][d5];
                        for (int d6 = 0; d6 < 6; d6++) {
                            const int sum6 = sum5 + faces[5][d6];
                            combos++;
                            sum[sum6]++;
                        }
                    }
                }
            }
        }
    }

    for (int s = 0; s < 22; s++)
        printf("Sum %2d: %5lu of %lu cases (%.3f%%)\n", s, sum[s], combos, 100.0*sum[s]/combos);

    return 0;
}
and it tells us the probabilities of getting each sum:
Code: [Select]
Sum  0: 15625 of 46656 cases (33.490%)
Sum  1:  3125 of 46656 cases (6.698%)
Sum  2:  3125 of 46656 cases (6.698%)
Sum  3:  3750 of 46656 cases (8.038%)
Sum  4:  3750 of 46656 cases (8.038%)
Sum  5:  4375 of 46656 cases (9.377%)
Sum  6:  4500 of 46656 cases (9.645%)
Sum  7:  2000 of 46656 cases (4.287%)
Sum  8:  1500 of 46656 cases (3.215%)
Sum  9:  1625 of 46656 cases (3.483%)
Sum 10:  1025 of 46656 cases (2.197%)
Sum 11:  1025 of 46656 cases (2.197%)
Sum 12:   425 of 46656 cases (0.911%)
Sum 13:   300 of 46656 cases (0.643%)
Sum 14:   200 of 46656 cases (0.429%)
Sum 15:   180 of 46656 cases (0.386%)
Sum 16:    55 of 46656 cases (0.118%)
Sum 17:    30 of 46656 cases (0.064%)
Sum 18:    30 of 46656 cases (0.064%)
Sum 19:     5 of 46656 cases (0.011%)
Sum 20:     5 of 46656 cases (0.011%)
Sum 21:     1 of 46656 cases (0.002%)
To get e.g. sum two, we have the following cases:
Dice 2 has face 2, and all other dices have one of the empty faces; 5×1×5×5×5×5 = 3125 cases total.

To get e.g. sum five, we have the following possible cases:
Dice 5 has face 5, and the others have an empty face; 5×5×5×5×1×5 = 3125 cases.
Dice 1 has face 1, dice 4 has face 4, and the others have an empty face; 1×5×5×5×1×5 = 625 cases.
Dice 2 has face 2, dice 3 has face 3, and the others have an empty face; 5×1×1×5×5×5 = 625 cases.
Since 3125+625+625 = 4375, you can have sum five in 4375 out of 46656 cases.

To get sum twenty-one, there is only one case; each of the six dice needs to have their numbered face.

The brute-force calculated probabilities will help you derive the algebraic form for the probability of each sum.  Because the probability depends both on the number of ways the sum can be achieved using digits 1-6, each at most once, and how many terms are in each such sum, I do not believe there is a reasonable algebraic form for the probabilities.
« Last Edit: March 17, 2024, 11:52:02 am by Nominal Animal »
 

Online soldarTopic starter

  • Super Contributor
  • ***
  • Posts: 3167
  • Country: es
Re: Dice probabilities question has me stumped
« Reply #5 on: March 17, 2024, 12:03:51 pm »
OK. Using spreadsheet I came up with these results:

Code: [Select]
0 = 0.334897976680384
 1 = 0.066979595336077
 2 = 0.066979595336077
 3 = 0.080375514403292
 4 = 0.080375514403292
 5 = 0.093771433470508
 6 = 0.096450617283951
 7 = 0.042866941015089
 8 = 0.032150205761317
 9 = 0.034829389574760
10 = 0.021969307270233
11 = 0.021969307270233
12 = 0.009109224965706
13 = 0.006430041152263
14 = 0.004286694101509
15 = 0.003858024691358
16 = 0.001178840877915
17 = 0.000643004115226
18 = 0.000643004115226
19 = 0.000107167352538
20 = 0.000107167352538
21 = 0.000021433470507
Which I believe add up to 1.

Yes, it is much, much easier and simpler to "roll" the dice individually and add up the numbers than to try to go directly to the end result with probabilities.
All my posts are made with 100% recycled electrons and bare traces of grey matter.
 

Offline EPAIII

  • Super Contributor
  • ***
  • Posts: 1067
  • Country: us
Re: Dice probabilities question has me stumped
« Reply #6 on: March 18, 2024, 11:18:13 am »
If you don't understand the odds, stay away from Vegas!

They have a game called Keno. You get a card and mark a bunch of numbers on it out of a much larger number collection. But then there are variations where you have "more ways to win" by picking different patterns or combinations. Of course you pay extra for each variation that you play.

So I am sitting in a casino, having my breakfast before a hard day at the convention and I decided to work out the odds. The first thing I found out was that the basic game had the WORST odds of any other game where there were published rules that allowed you to calculate them. Heaven only knows what the actual odds on the slot machines are. I thought Roulette had bad odds, but Keno's odds were much worse. So much for gut feelings.

But then I started to calculate the odds with the various variations of Keno. To my immense surprise the odds got worse and worse with them. Not just worse, but MUCH worse. OK, so you can play more than one variation at a time. But still, the combined odds were still much worse even in light of the extra that you paid to play them.

It was better to just play the basic game than any of the variations or any combination of the variations. And the little old ladies played and played and played. And they played multiple variations. Their money disappeared faster and faster. But on top of that, it was still the worst game there.

You gotta know the odds!
Paul A.  -   SE Texas
And if you look REAL close at an analog signal,
You will find that it has discrete steps.
 

Offline mathsquid

  • Regular Contributor
  • *
  • Posts: 247
  • Country: us
  • I like math.
Re: Dice probabilities question has me stumped
« Reply #7 on: March 19, 2024, 11:29:31 pm »
There are 64 combinations which produce a result other than zero.

You can calculate that there are 64 ways by using a generating function. The expansion of
$$(x+1) \left(x^2+1\right)
   \left(x^3+1\right)
   \left(x^4+1\right)
   \left(x^5+1\right)
   \left(x^6+1\right)$$
gives you
$$ x^{21}+x^{20}+x^{19}+2 x^{18}+2
   x^{17}+3 x^{16}+4 x^{15}+4 x^{14}+4
   x^{13}+5 x^{12}+5 x^{11}+5 x^{10}+5
   x^9+4 x^8+4 x^7+4 x^6+3 x^5+2 x^4+2
   x^3+x^2+x+1$$
The coefficient of x^n tells the number of ways you can get n using distinct parts with size at most 6. The coefficients sum to 64 = 2^6.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf