Drawing balls from a box

kenlau

New member
Joined
Apr 6, 2020
Messages
5
In a box contain 6 balls, written A,B,C,D,E and F.
A boy randomly draw one ball from the box with replacement and repeated for 30 times.
What is the probability that he at least draw the balls A,B,C,D and E for 3 times respectively?
 
In a box contain 6 balls, written A,B,C,D,E and F.
A boy randomly draw one ball from the box with replacement and repeated for 30 times.
What is the probability that he at least draw the balls A,B,C,D and E for 3 times respectively?
This equivalent to having six boxes labeled each one of \(A,~B,~C,~D,~E,~F\) [no repeats].
How many can we put thirty identical marbles into those six distinct boxes. Well \(\dbinom{30+6-1}{5}\).
That is the number of elementary events in the total probability space.
At this point I guess that he draws balls A, B,C,D,E [NOT F] at least three times each.
Lets take fifteen of the marbles and then put three each into those five boxes.
How many ways can we now put the fifteen remaining marbles into the six boxes? \(\dbinom{15+6-1}{5}\)
That is the number of elementary events in which each of the five boxes contains at least three marbles[choices or selections]
LOOK HERE for the calculation.
If I have missread your question please try to restate it more clearly.
 
This equivalent to having six boxes labeled each one of \(A,~B,~C,~D,~E,~F\) [no repeats].
How many can we put thirty identical marbles into those six distinct boxes. Well \(\dbinom{30+6-1}{5}\).
That is the number of elementary events in the total probability space.
At this point I guess that he draws balls A, B,C,D,E [NOT F] at least three times each.
Lets take fifteen of the marbles and then put three each into those five boxes.
How many ways can we now put the fifteen remaining marbles into the six boxes? \(\dbinom{15+6-1}{5}\)
That is the number of elementary events in which each of the five boxes contains at least three marbles[choices or selections]
LOOK HERE for the calculation.
If I have missread your question please try to restate it more clearly.

Wow pka, thank for your detailed answer! Thank for simplifying my question and make it more comprehensible! But i am curious to know that why we need to +6−1 when finding the combination~
 
This equivalent to having six boxes labeled each one of \(A,~B,~C,~D,~E,~F\) [no repeats].
How many can we put thirty identical marbles into those six distinct boxes. Well \(\dbinom{30+6-1}{5}\).
That is the number of elementary events in the total probability space.
At this point I guess that he draws balls A, B,C,D,E [NOT F] at least three times each.
Lets take fifteen of the marbles and then put three each into those five boxes.
How many ways can we now put the fifteen remaining marbles into the six boxes? \(\dbinom{15+6-1}{5}\)
That is the number of elementary events in which each of the five boxes contains at least three marbles[choices or selections]
LOOK HERE for the calculation.
If I have missread your question please try to restate it more clearly.

And really thank so much for rephrase my question.
I think the question can be simplified as 'Randomly put all 30 identical balls into Box \(A,~B,~C,~D,~E,~F\), what is the probability of box \(A,~B,~C,~D,~E\) contains at least 3 balls respectively.'

However, i have some inquiries on the answer. Since i have tried this demonstration for around 20 times by pc and the probability should lay around 30% to 60%.
 
Wow pka, thank for your detailed answer! Thank for simplifying my question and make it more comprehensible! But i am curious to know that why we need to +6−1 when finding the combination~
Here is a whole page on multi-sets. Reading the whole article will answer all your quedtions.
 
Here is a whole page on multi-sets. Reading the whole article will answer all your quedtions.

Sincerely thank for sharing concepts of multiset but seems not related on finding the total outcomes.
For my approach in finding the total possible outcome, i use 6^30=2.21*10^23. Since each time i put one ball, there are six choices and thus by multiplying 6 for 30 times will get the answer. But for the mutiset, i am not familiar with the concepts but it seems not applicable because we are not finding 30 box with 6 balls and find the number of possible outcomes (and each box cannot hold more than one ball).
 
I have an alternative way of calculating this, and the method is outlined in this post(click).

In your scenario there are 408 sets of {n1,..n5} to consider:-

Code:
n5      n1    x        a                     b                 c             d
 3 3 3 3 3   15   choose(30,15)    15!/(3!*3!*3!*3!*3!)    (t-5)^(30-15)   5!/(5!)
 3 3 3 3 4   16   choose(30,16)    16!/(4!*3!*3!*3!*3!)    (t-5)^(30-16)   5!/(4!)
...
 3 3 3 3 18  30   choose(30,30)    30!/(18!*3!*3!*3!*3!)   (t-5)^(30-30)   5!/(4!)
 3 3 3 4 4   17   choose(30,17)    17!/(4!*4!*3!*3!*3!)    (t-5)^(30-17)   5!/(3!*2!)
 3 3 3 4 5   18   choose(30,18)    18!/(5!*4!*3!*3!*3!)    (t-5)^(30-18)   5!/(3!)
...
 6 6 6 6 6   30   choose(30,30)    30!/(6!*6!*6!*6!*6!)    (t-5)^(30-30)   5!/(5!)
where t=6 (the number of balls in the bag).

I've written a computer program to work this out. My final answer is:-
120379419024315432901920 / 6^30 ≈ 0.5445211229637

Please post a better method if you know one! This seems very cumbersome. But if no-one comes up with anything better then I'll aim to tidy up my code and post it.
 
Here's another method (see this similar post for more detail)

Number of ways to match is [math] \sum_{i=0}^{p-3m}{S_3(p-i, m) m! \binom{p}{i} \left(t-m\right)^i} [/math]
Where
t = 6, the total number of balls
p = 30, the pick size
m = 5, the number of balls to match
S3(n,k) returns an associated Stirling number that gives the number of ways to partition a set of n objects into k subsets, with each subset containing at least 3 elements

Here's some python code that performs the calculation:-
Python:
from sympy.functions.combinatorial.numbers import stirling
from sympy import binomial
from math import factorial

# I could not find the following function in an existing Python library

# https://en.wikipedia.org/wiki/Stirling_numbers_of_the_second_kind
# An r-associated Stirling number of the second kind returns
# the number of ways to partition a set of n objects into k subsets,
# with each subset containing at least r elements */
def stirling2r_private(r,n,k, cache):
    if n==0 and k==0: return 1
    if k<=0 or k*r>n: return 0
    if k==1: return 1
  
    if cache[n][k]!=-1: return cache[n][k]
  
    n-=1
    rv = stirling2r_private(r,n-r+1,k-1, cache)
    if rv!=0: rv *= binomial(n,r-1)
    rv += k*stirling2r_private(r,n,k, cache)
    n+=1
  
    cache[n][k]=rv
    return rv


def stirling2r(r,n,k):
    if r==1: return stirling(n,k)
    if k<=0 or k*r>n: return 0
   
    # initialise a [k+1] [n+1] array...
    cache=[ [-1]*(k+1) for i in range(n+1) ]
   
    rv=stirling2r_private(r,n,k, cache)
   
    return rv


#################################################################

m=5   # Number of balls to match
t=6 # Number of balls in the bag
p=30  # Number of picks
minim=3 # Minimum number of matches per ball

r=0
for i in range(p-minim*m+1):
    r += stirling2r(minim, p-i, m) * factorial(m) * binomial(p,i) * (t-m)**i

print("Probability is", r, "/", t**p)
print("Or approx ", float(r) / t**p)
 
Top