N*n*m distinguishable balls with m different colors

balls-in-binscombinationscombinatorial-number-theorycombinatoricsprobability

I recently asked the following question which is resolved:
n*m distinguishable balls with m different colors, the probability of randomly choosing k balls containing all balls from at least 2 different colors

To address the issue of the previous question, assume we have m groups of n balls and the balls in the same group have the same color. So there are m*n balls in total. Now, suppose we randomly choose k>(2*n) balls from the set of m*n balls. From the previous question, we can compute the probability of the chosen k balls containing all balls of at least two different colors (entirely all balls of two groups). For more information, please refer to the previous question.

Now, a more general problem is that we have N groups of m*n balls. Each group of m*n balls contains m subgroups of balls that have the same color (totally N*n*m number of balls). We choose randomly k balls. how much is the probability that the chosen set contains all balls from two or more color-groups within a group of m*n?

To clarify, I inserted the illustration of the problem having 3 groups of 3*4 balls (N=3, m=4, n=3). A case of the problem could be for example choosing k=8 balls as follows: 13,17,21,16,20,24,27,28 (containing completely all yellow and cyan balls of the second group).

three groups of *m*n* balls with *m* different colors

Note that having all balls of two different colors from different groups should not be included in the probability.

I hope I could explain the problem clearly. I tried to compute the probability of having different number of balls in each group and computing the number of cases which satisfies the problem condition given the number of taken balls from that group. But this produces invalid results.

Best Answer

The complementary event is that exactly one full colour subgroup is chosen in $j$ of the groups, with some $0\le j\le\min\left(N,\left\lfloor\frac kn\right\rfloor\right)$, and no full colour subgroups in the remaining groups. There are $\binom Nj$ ways to choose the $j$ groups, and then $m^j$ ways to choose the colour subgroups within those $j$ groups.

Now we need to count the ways to choose all $nj$ balls in the $j$ colour subgroups and, with the remaining $k-nj$ balls, not to choose all balls in any of the remaining $Nm-j$ colour subgroups. By inclusion–exclusion, this is

$$ \sum_{s=0}^{\left\lfloor\frac kn\right\rfloor-j}(-1)^s\binom{Nm-j}s\binom{Nmn-nj-ns}{k-nj-ns}\;. $$

Thus, the desired probability is

$$ 1-\binom{Nmn}k^{-1}\sum_{j=0}^{\left\lfloor\frac kn\right\rfloor}\binom Njm^j\sum_{s=0}^{\left\lfloor\frac kn\right\rfloor-j}(-1)^s\binom{Nm-j}s\binom{Nmn-nj-ns}{k-nj-ns}\;. $$

(Note that the binomial coefficient $\binom Nj$ is $0$ for $j\gt N$.)