Hard Boxes and Balls Probability Question

100 Views Asked by At

You have $10$ boxes, and $9$ red balls, $10$ green balls and $11$ yellow.The balls are randomly placed in the boxes. What is the probability that at least one box will have exactly $2$ red, $2$ green and $2$ yellow balls in it?
My attempt : Denote $W(a, b, c, n)$ the number of unique ways to put a red, b green and c yellow balls in n boxes. That means that the probability we seek is $10. \frac{W(9-2,\ 10-2,\ 11-2,\ 10)} {W(9,\ 10,\ 11,\ 9)}$. But I have no idea how to calculate $W(a, b, c, n)$.

1

There are 1 best solutions below

0
On BEST ANSWER

Suppose we solve this for $N$ boxes, $A$ red balls, $B$ green ones and $C$ yellow ones. We get from first principles by inclusion-exclusion the closed form for the probability of no box having exactly two red, two green and two yellow balls:

$$\frac{1}{N^{A+B+C}} \sum_{q=0}^{\lfloor\min(N, A/2, B/2, C/2)\rfloor} {N\choose q} (-1)^q \frac{A!}{2^q (A-2q)!} \frac{B!}{2^q (B-2q)!} \frac{C!}{2^q (C-2q)!} \\ \times (N-q)^{A+B+C-6q}.$$

Simplify to obtain

$$\bbox[5px,border:2px solid #00A000]{ \frac{A! B! C!}{N^{A+B+C}} \sum_{q=0}^{\lfloor\min(N, A/2, B/2, C/2)\rfloor} {N\choose q} (-1)^q \frac{(N-q)^{A+B+C-6q}}{2^{3q} (A-2q)! (B-2q)! (C-2q)!}.}$$

The correctness of this formula may be verified by an enumeration routine using

$$A! [z^A] \prod_{p=1}^N \left((A_p-1) \frac{z^2}{2} + \sum_{q=0}^A \frac{z^q}{q!}\right) \\ \times B! [z^B] \prod_{p=1}^N \left((B_p-1) \frac{z^2}{2} + \sum_{q=0}^B \frac{z^q}{q!}\right) \\ \times C! [z^C] \prod_{p=1}^N \left((C_p-1) \frac{z^2}{2} + \sum_{q=0}^C \frac{z^q}{q!}\right)$$

and checking terms whether they are multiples of $A_1 B_1 C_1, A_2 B_2 C_2, \ldots, A_N B_N C_N.$ What we have here are basically Stirling numbers.

To answer the question the variables are $N=10$, $A=9,$ $B=10,$ and $C=11.$ We get from the inclusion-exclusion formula for the probability of $(2,2,2)$ not appearing at all the value

$$930447179545980608896457413 \times 10^{-27} \approx 0.9304471795$$

so that the probability of $(2,2,2)$ appearing at least once is approximately

$$\bbox[5px,border:2px solid #00A000]{ 0.0695528205}$$

or about seven percent.

There is some Maple code to document and clarify this computation, which goes as follows.

ENUM :=
proc(N, A, B, C)
option remember;
local res, gf, box, term, tvars;

    if A < 2 or B < 2 or C < 2 then
        return 1;
    fi;

    if N = 1 then
        if A = 2 and B = 2 and C = 2 then
            return 0;
        else
            return 1;
        fi;
    fi;

    res := 0;

    gf :=
    A!*coeff(expand(mul((AX[p]-1)*z^2/2
                        + add(z^q/q!, q=0..A), p=1..N)),
             z, A) *
    B!*coeff(expand(mul((BX[p]-1)*z^2/2
                        + add(z^q/q!, q=0..B), p=1..N)),
             z, B) *
    C!*coeff(expand(mul((CX[p]-1)*z^2/2
                        + add(z^q/q!, q=0..C), p=1..N)),
             z, C);

    for term in expand(gf) do
        tvars := indets(term);

        for box to N do
            if {AX[box], BX[box], CX[box]} subset tvars
            then
                break;
            fi;
        od;

        if box = N+1 then
            res := res + lcoeff(term);
        fi;
    od;

    res/N^(A+B+C);
end;

X2 :=
(N, A, B, C) ->
A!*B!*C!/N^(A+B+C)*
add(binomial(N,q)*(-1)^q*(N-q)^(A+B+C-6*q)/2^(3*q)
    /(A-2*q)!/(B-2*q)!/(C-2*q)!,
    q=0..floor(min(N, A/2, B/2, C/2)));