3
$\begingroup$

I came accross this (rather complex?) combinatorial problem:

I have $18$ distinct objects, $3$ red urns, $7$ blue urns, and $11$ green urns. In how many ways can I distribute the objects into those urns?

The urns of one colour are identical to each-other. I haven't actually solved it yet, and yet I have decided to generalize:

I have $n$ distinct objects, $k_1,k_2,k_3,...,k_m$ urns of types $1,2,3,...,m$. In how many ways can I distribute the objects into those urns?

I think the solution is strongly related to both partitions of $n$ into $m$ parts where order matters, and the stirling numbers of the second kind. But whichever way I take it somewhat reaches a dead-end, or becomes very complex. How do I approach this?

$\endgroup$
2
  • $\begingroup$ Can you leave one of the urns empty? If not, the solution is a bit uglier...but yeah Stirling numbers are the way to go. Just use multinomials to select from your composition(partition with order). $\endgroup$
    – Phicar
    Commented Apr 30, 2022 at 12:59
  • $\begingroup$ @Phicar Provided I have distributed all the objects, any urn and any number of urns may be left empty. $\endgroup$ Commented Apr 30, 2022 at 13:04

1 Answer 1

3
$\begingroup$

You can do this in the following number of ways $$\sum _{n_1+\cdots +n_m = n}\binom{n}{n_1,n_2,\cdots ,n_m}\prod _{i=1}^{m}\left (\sum _{j = 0}^{k_i}{n_i\brace j}\right ),$$ which corresponds to selecting each set that you are gonna put in the color urn i.e., the $i$-th color gets $n_i$ objects, and then you need to partition them inside the urns(which are indistinguishable).

Edit: One first divides the $n$ objects into $m$ colors. To do that, you select how many of each color are you taking from the pool of $m$ colors, that is, you are considering a composition of $n$ of size $m$ i.e., $(n_1,\cdots ,n_m)$ such that $n_1+\cdots +n_m=n$. Now, when you have colored your objects for each color you have to split them into the indistinguishable urns, here is where you use Stirling numbers, because you cannot distinguish in between the urns and so the only thing that matters is how these objects are distributed in those $k_i$ urns. They could have all been in $1$ non-empty urn or $2$ non-empty urns or...or $k_i$ non-empty urns and that is why you are adding over Stirling numbers. Multiplication gives all possibilities across all colors and summation over compositions gives you the result. Here you have a code(just change the parameters in the last line) to test in sage for your example it gives $4939393366735084$:

s=0
n=0
m=0
k = []
nn = []
def tal(a,c):
    global k,nn,s,n,m
    if a==m:
        if c==n:
            ss = factorial(n)
            for i in range(0,m):
                ss/=factorial(nn[i])
                tt = 0
                for j in range(0,k[i]+1):
                    tt+=stirling_number2(nn[i],j)
                ss*=tt
            s+=ss
            #print(nn,ss)
        return
    for i in range(0,n+1):
        if c+i>n:
            break
        nn[a]=i
        tal(a+1,c+i)
def dale(nnn,mm,kk):
    global nn,n,m,k,s
    n = nnn
    m = mm
    k = kk
    nn = [0 for i in range(m)]
    s = 0
    tal(0,0)
    return s
print(dale(18,3,[3,7,11]))
$\endgroup$
4
  • $\begingroup$ The augmented binomial notation here is the multinomial? Also, in your outer sigma, iteration is performed over compositions of $n$ into $m$ parts or partitions into $m$ parts? I.E, order matters or it doesn't? $\endgroup$ Commented Apr 30, 2022 at 14:43
  • $\begingroup$ @MCFromScratch Yes, multinomial. That one chooses from the objects to distribute over the colors and iteration is over partitions of $n$ into ordered parts. Order matters, here the order is for each color. $\endgroup$
    – Phicar
    Commented Apr 30, 2022 at 14:45
  • $\begingroup$ I don't fully understand this. Would you mind to elaborate a bit, on how you got each part of this equation? And how are you sure it works? Sadly I don't have any small examples to check it against. $\endgroup$ Commented Apr 30, 2022 at 19:47
  • $\begingroup$ @MCFromScratch Ok, I have explained more the reasoning. $\endgroup$
    – Phicar
    Commented May 1, 2022 at 5:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .