2
$\begingroup$

Suppose I want to know the probability that when rolling a fair 3-sided die (faces labeled 1-3) 12 times 1 comes up 4 times, 2 comes up 6 times, and 3 comes up twice. This is straightforward enough using the multinomial formula, but suppose I want to know the probability of "at least" scenarios? For example, what is the probability that after 12 rolls the die shows 3 at least twice, shows 2 at least twice, and shows 1 at least 3 times?

I don't think it's simply a matter of adding probabilities using the standard formula, because "at least" constrains the number of possibilities, and I haven't been able to find any formula or algorithm which shows how to do it correctly.

$\endgroup$
0
$\begingroup$

I suspect there's no simple equation to give you what you need, but a brute force algorithm is pretty easy to implement.

Python Solution

import collections
import fractions
import itertools as it


def enumerate_rolls(faces, count):
    for elems in it.product(range(1, faces + 1), repeat=count):
        yield collections.Counter(elems)


def count_successes(count, faces, success_test):

    successes, failures = 0, 0

    for elems in enumerate_rolls(faces=faces, count=count):
        if success_test(elems):
            successes += 1
        else:
            failures += 1

    return fractions.Fraction(successes, successes + failures)


if __name__ == '__main__':
    print(
        count_successes(12, 3, lambda s: s[3] >= 2 and s[2] >= 2 and s[1] >= 3)
    )

Theory

Suppose you have $N$ count of dice each with $F$ number of faces. The domain of all possible rolls can be modeled as a set of multisets where cardinality equals $N$ and the domain is $\mathbb{Z}_F$. The goal is to find a subdomain $S$ meeting your condition.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.