Results 1 to 12 of 12

Math Help - Dice Theoretical Probability

  1. #1
    Newbie
    Joined
    Oct 2010
    Posts
    1

    Exclamation Dice Theoretical Probability

    Hi,

    How can I calculate the theoretical probability of the number of times I would have to roll a 6 sided dice until I got at least 1 of every number?

    I can't figure this out!

    Thanks!
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Flow Master
    mr fantastic's Avatar
    Joined
    Dec 2007
    From
    Zeitgeist
    Posts
    16,948
    Thanks
    5
    Quote Originally Posted by colourfulclock View Post
    Hi,

    How can I calculate the theoretical probability of the number of times I would have to roll a 6 sided dice until I got at least 1 of every number?

    I can't figure this out!

    Thanks!
    You can't.

    What you can calculate is either:

    1. The expected number of rolls; or

    2. The number of rolls such that the probability exceeds a specified value eg. 0.999.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by colourfulclock View Post
    Hi,

    How can I calculate the theoretical probability of the number of times I would have to roll a 6 sided dice until I got at least 1 of every number?

    I can't figure this out!

    Thanks!
    My reading of this question is calculate p(n) the probability that exactly n rolls are needed to have at least one of each possible result 1,2,3,4,5,6.

    You can start by assuming that the last roll to achieve a complete set is a 1. Then for the n-1 earlier rolls we have a binomial experiment where we want to know the probability of n-1 successes at a probability of 1/(n-1), and for the n-th roll we have a probability of success (getting a 1) of 1/6.

    CB
    Follow Math Help Forum on Facebook and Google+

  4. #4
    MHF Contributor
    Joined
    Dec 2007
    From
    Ottawa, Canada
    Posts
    3,089
    Thanks
    67
    Wrote short simulation program; 5 runs @ 10 million tries each:
    147,011,358
    147,033,575
    147,000,132
    146,994,434
    147,035,012
    So looks like slightly over 14.7 rolls

    If wrong, can anyone tell me what's wrong with my program:

    100 set up array A(6)
    110 for g = 1 to 10000000
    120 array A = 0
    130 r = 1 'r = rolls
    140 k = random number 1 to 6
    150 A(k) = 1
    160 if array A = 6 then goto 180
    170 r = r + 1:goto 140
    180 t = t + r
    190 next g
    200 print t
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by Wilmer View Post
    Wrote short simulation program; 5 runs @ 10 million tries each:
    147,011,358
    147,033,575
    147,000,132
    146,994,434
    147,035,012
    So looks like slightly over 14.7 rolls

    If wrong, can anyone tell me what's wrong with my program:

    100 set up array A(6)
    110 for g = 1 to 10000000
    120 array A = 0
    130 r = 1 'r = rolls
    140 k = random number 1 to 6
    150 A(k) = 1
    160 if array A = 6 then goto 180
    170 r = r + 1:goto 140
    180 t = t + r
    190 next g
    200 print t
    Well to start with this does not calculate the probability asked for, also what does the line

    160 if array A = 6 then goto 180

    do?

    CB
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Super Member
    Joined
    Mar 2008
    Posts
    934
    Thanks
    33
    Awards
    1
    Quote Originally Posted by colourfulclock View Post
    Hi,

    How can I calculate the theoretical probability of the number of times I would have to roll a 6 sided dice until I got at least 1 of every number?

    I can't figure this out!

    Thanks!
    This is the "Coupon Collector's Problem". See

    Coupon collector's problem - Wikipedia, the free encyclopedia
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by Wilmer View Post
    Wrote short simulation program; 5 runs @ 10 million tries each:
    147,011,358
    147,033,575
    147,000,132
    146,994,434
    147,035,012
    So looks like slightly over 14.7 rolls

    If wrong, can anyone tell me what's wrong with my program:

    100 set up array A(6)
    110 for g = 1 to 10000000
    120 array A = 0
    130 r = 1 'r = rolls
    140 k = random number 1 to 6
    150 A(k) = 1
    160 if array A = 6 then goto 180
    170 r = r + 1:goto 140
    180 t = t + r
    190 next g
    200 print t
    The simulation results look OK.

    CB
    Follow Math Help Forum on Facebook and Google+

  8. #8
    MHF Contributor
    Joined
    Dec 2007
    From
    Ottawa, Canada
    Posts
    3,089
    Thanks
    67
    Quote Originally Posted by CaptainBlack View Post
    Well to start with this does not calculate the probability asked for,
    also what does the line
    160 if array A = 6 then goto 180 do?
    Thanks CB, you're telling me I misunderstood; I took the problem to mean:
    after how many rolls will each of 1 to 6 appear at least once; example:
    3,5,3,1,2,6,1,5,6,6,2,1,3,5,4: 15 rolls

    After a number (1 to 6) is picked, program "flags" the corresponding array
    number with "1"; like, after picking the 3 at start, program makes A(3) = 1.
    When the last pick (4) was made, program made A(4)=1:
    at this point, all array locations were equal to 1, so array totalled 6.
    So this session was completed, and program goes to line 180 in order
    to update the total rolls so far.

    Can you tell me what I'm missing? Thanks.
    Follow Math Help Forum on Facebook and Google+

  9. #9
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by Wilmer View Post
    Thanks CB, you're telling me I misunderstood; I took the problem to mean:
    after how many rolls will each of 1 to 6 appear at least once; example:
    3,5,3,1,2,6,1,5,6,6,2,1,3,5,4: 15 rolls

    After a number (1 to 6) is picked, program "flags" the corresponding array
    number with "1"; like, after picking the 3 at start, program makes A(3) = 1.
    When the last pick (4) was made, program made A(4)=1:
    at this point, all array locations were equal to 1, so array totalled 6.
    So this session was completed, and program goes to line 180 in order
    to update the total rolls so far.

    Can you tell me what I'm missing? Thanks.
    Nothing, if you understand what that line means.

    Though I will say this: the syntax of the language is unacceptable in that it makes no distinction between the assignment operator and the logical equality operator, and the "array" qualifier seems to be overused and the function notation is counter-intuitive and non-standard. Also profligate use of GOTOs in modern code is deprecated.

    CB
    Follow Math Help Forum on Facebook and Google+

  10. #10
    MHF Contributor
    Joined
    Dec 2007
    From
    Ottawa, Canada
    Posts
    3,089
    Thanks
    67
    Quote Originally Posted by CaptainBlack View Post
    Though I will say this: the syntax of the language is unacceptable in that it makes no distinction between the assignment operator and the logical equality operator, and the "array" qualifier seems to be overused and the function notation is counter-intuitive and non-standard. Also profligate use of GOTOs in modern code is deprecated.
    CB
    Agree 100%. I was simply using "English": too lazy to actually type the actual code.
    Plus I use UBasic: why type code that would be "strange" to anyone not exposed to UBasic...
    Follow Math Help Forum on Facebook and Google+

  11. #11
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by Wilmer View Post
    Agree 100%. I was simply using "English": too lazy to actually type the actual code.
    Plus I use UBasic: why type code that would be "strange" to anyone not exposed to UBasic...
    If you are using pseudo-code you should get rid of line numbers, it should be readable without being confused with real code:

    Code:
    set Nreplications=10000            //number of replications of the experiment
    set array A[1..6] to zero vector   //array of flags to indicate if a face has come up in an experiment
    set counter=0                      //counts number of throws in an experiment
    
    for idx=1 to Nreplications
      for throw=1 to infinity
        set A to zero vector
        set k to UniformRand on {1,2,..6}
        set A[k] to 1
    
        if (sum of A[k], k=1,..6) is equal to 6
          set total to total+throw
          break out of throw loop 
        end if
      end for
    end for
    output total/Nreplications
    Follow Math Help Forum on Facebook and Google+

  12. #12
    MHF Contributor
    Joined
    Dec 2007
    From
    Ottawa, Canada
    Posts
    3,089
    Thanks
    67
    Hokay...
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Probability and dice
    Posted in the Discrete Math Forum
    Replies: 4
    Last Post: November 7th 2011, 05:37 PM
  2. theoretical probability of coin tosses
    Posted in the Advanced Statistics Forum
    Replies: 8
    Last Post: May 3rd 2011, 07:38 PM
  3. Theoretical probability of winning this game?
    Posted in the Statistics Forum
    Replies: 3
    Last Post: January 6th 2011, 04:54 PM
  4. Theoretical probability
    Posted in the Statistics Forum
    Replies: 6
    Last Post: August 31st 2008, 04:21 AM
  5. Empirical or Theoretical Probability
    Posted in the Statistics Forum
    Replies: 4
    Last Post: January 24th 2007, 05:16 PM

Search Tags


/mathhelpforum @mathhelpforum