I'm having a problem figuring out this problem, it is similar to combining sets of non-unique letters, but is slightly different.
Let k, m, and n be positive integers. We have nm balls, m colors, n balls, and k uniquely labeled bins. How many different ways are there to select n balls to put into the k bags?
For example, if m = 3, n = k = 2, the result is 21. There are 3 colors where we are choosing 2 balls out of the total 6 to place into 2 bins.
(-, WW), (-,WR), (-, WB) ...
(WW, -), (WR, -) ...
(W,W), (W,R) ...
(B,W), (B,R) ...
The normal version of this problem does not require the selection of a subset of the total elements. That problem yields n! / x1! x2! x3! ... where x1, x2, x3 are groups of duplicated letters.
correction (clarity) -> you have a total of nm balls. n balls of each color where there are m colors; from here you then choose n of these total nm balls randomly and place them into the k distinct bins.
Let me be sure I have the question right. We have
m
colors. We havek
bins. We want to selectn
balls and place them in the bins. We have enough balls of each color that we don't have to worry about running out of any particular color.In that case, the problem boils down to how many ways we have have
n
balls ofm*k
kinds. (A kind being determined by color and bin.) There is a standard trick to calculate this. First let's number the kinds. Put down all of the balls of the first kind. Then a divider. Then all the balls of the second kind. Then a divider. And so on until we have alln
balls andk*m - 1
dividers down. This procedure is completely reversible, if we taken + k*m - 1
things in a row, selectn
of them to be balls and the rest to be dividers, we can then color the balls and put them into bins to get ton
balls ofm
colors ink
bins.Therefore the answer is
choose(n + k*m - 1, n)
.(Note, this is the reasoning that I came up with after I knew the answer. My actual path to the answer was much longer and more circuitous.)