# Balls in urns of different sizes

I have 7 balls to be randomly placed in four urns of size {5,3,2,2}, what is the probability of exactly three urns containing at least one ball?

(Phrased differently, twelve equally likely spots for the seven balls, but the first five is considered the first urn, next three the second urn, etc.)

Through simulation got an answer of about 32.4%, but am wondering how to solve it in the general case? ($$n$$ balls in urns of size $$\{m_1,m_2,...,m_k\}$$, probability of exactly $$r$$ urns containing at least one ball?)

• I don't have an analytic method of solution, but I can verify your simulation using explicit enumeration: the exact probability is $\frac{257}{792}$ for your example. I used Mathematica: Select[(Sign /@ BinCounts[#, {{1, 6, 9, 11, 13}}]) & /@ Subsets[Range[12], {7}], Total[#] == 3 &] // Length returns $257$, the desired number of outcomes out of $\binom{12}{7} = 792$. I suspect that your question does not have a straightforward closed-form solution for the general case. – heropup Feb 25 '14 at 7:48