Ways to choose $n$ out of $2n$ balls with three distinct colors

combinatoricsset-partition

I am working on a problem where I need to know how many ways there are to choose n out of 2n balls with three distinct colors, as a function of the numbers of balls of each color (The order does not matter). I already found a few answers on here that come close to what I need, namely this and this, but I do not understand enough of the solutions so that I can make it work for my problem. Also, the multivariate hypergeometric distribution seems related, but I have not managed to extract the information I need from any of the texts. Can you help?

Edit: Another way to phrase it would be: How do I distribute the 2n balls evenly between two distinct boxes.

Best Answer

Assume there are $m_1$, $m_2$, $m_3$ balls of the three colors. Consider the polynomial $$g(x):=(1+x+x^2+\ldots+x^{m_1})(1+x+x^2+\ldots+x^{m_2})(1+x+x^2+\ldots+x^{m_3})\ .$$ [The $g$ is for generating function.] If you expand the right hand side here you obtain for any choice of numbers $k_i\in[0\,..m_i]$ a term $$x^{k_1}\,x^{k_2}\, x^{k_3}$$ (with coefficient $1$). Collecting these terms according to total degree gives us the "usual" presentation of $g(x)$. The coefficient of $x^n$ in this presentation is exactly equal to the number of admissible triples $(k_1,k_2,k_3)$ satisfying $k_1+k_2+k_3=n$. Concerning your problem we therefore have to find this "usual" presentation of $g(x)$. We can write $$\eqalign{g(x)&={1-x^{m_1+1}\over 1-x}\>{1-x^{m_2+1}\over 1-x}\>{1-x^{m_3+1}\over 1-x}\cr &= (1-x^{m_1+1})(1-x^{m_2+1})(1-x^{m_3+1})\sum_{j=0}^\infty{j+2\choose 2} x^j\ .\cr}$$ Now you have to collect the eight terms (coming from the product to the left of $\Sigma$) having the total degree $n$.

Related Question