Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Please help with a probability formula

  1. Mar 25, 2009 #1

    I'm not very good with statistics and such but have been working on a problem for a month now and have finally gotten to a point where I'm ready to ask for help. I didn't really know where to go but found this forum and thought I'd give it a try here. =)

    I'm working on a dice game and am looking to create a formula that I can use to plug in a few variables and have a probability of a certain result kicked back to me. Here's what I've got so far:

    r = number of red dice in a single throw of all dice
    b = number of blue dice in a single throw of all dice
    pr = probability of "scoring a point" with a red die (1/6)
    pb = probability of "scoring a point" with a blue die (3/6)
    n = the minimum number of "points" desired in a single throw of all dice

    To put some numbers to a sample situation... I've got 2 red dice and 1 blue die in a throw. I want to know the odds of at least 2 of the dice in the throw "scoring" (it's ok if all the dice are successful).

    Rather than embarrass myself by showing you guys a formula that I know is clearly wrong, I will say that I think the result of the example I've provided should be 16.67%. I'm pretty sure that's accurate because I wrote out every combination and 36 of the 216 possible results score twice on 2 of the 3 dice.

    Thanks in advance for any help and I apologize for being such a noob.
  2. jcsd
  3. Mar 25, 2009 #2


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    A quicker way to calculate this
    If 2 out of the 3 dice score, then:

    Either 2 red dice scored, and the blue die didn't score: chance of this occuring is (1/6)2*1/2 (multiply the independent probabilities of each die doing what it does)

    2 red dice score, and the blue die scores: (1/6)2*1/2

    1 red die scores, the blue die scores

    1/6*5/6*1/2*2 - multiply by 2 because there are two ways you can pick which red die scores

    Add these up to get: 1/6 as you said

    The principle is you break it up into disjoint cases (so no two cases occur at the same time), calculate the probability of each case occuring, then add them up at the end. Notice if your cases overlap, then you're essentially double counting the events that occur under both cases
  4. Mar 25, 2009 #3

    That helps for sure.

    Just wondering though, is it possible to build a formula that allows me to plug in any number of red dice (r), blue dice (b) and the minimum number of dice that score in a result (n) to get the probability of different situations?

    Thanks again!
  5. Mar 25, 2009 #4


    User Avatar
    Science Advisor
    Homework Helper

    [tex]\sum_{x=0}^r\sum_{y=n-a}^b\binom rx\binom byp_r^xp_b^y(1-p_r)^{r-x}(1-p_b)^{b-y}=\sum_{x=0}^r\left(\binom rxp_r^x(1-p_r)^{r-x}\sum_{y=n-a}^b\binom byp_b^y(1-p_b)^{b-y}\right)[/tex]

    which with your probabilities is

    [tex]\frac{1}{2^b6^r}\sum_{x=0}^r\left(\binom rx5^{r-x}\sum_{y=n-a}^b\binom by\right)[/tex]

    I'm sure this can be simplified further, but it's still going to be pretty ugly.

    Edit: Mathematica can get it to a single sum, but it's hideous and probably harder to calculate for any values you'd care about:
    [tex]\frac{1}{2^b6^r}\sum_{x=0}^r\left(\frac{5^{r-x}b!\,_2\!\tilde{\text{F}}_1(1,n-b-x; n-x+1; -1)}{(a+b-n)!}\right)[/tex]

    Edit 2: If you Google for and install Pari/GP, this will do it for you:
    Code (Text):
    time = 0 ms.
    %46 = 1/6
    Last edited: Mar 25, 2009
  6. Mar 25, 2009 #5
    Holy crap!

    I would have never figured that out. Thanks for the solution!

    Now I need to start working on converting that into something excel can read. =)

    Thanks again!
  7. Mar 25, 2009 #6


    User Avatar
    Science Advisor
    Homework Helper

    If you want to do this in Excel you'll either need to use a macro or to make a b by r grid and a calculation row beside it.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Please help with a probability formula