# In how many ways you can put n white balls and 2n black balls into n boxes if at least one black ball have to be in each box

n - number of white balls

2n - number of black balls

In how many ways you can put it into n boxes? It have to be at least one black ball in each box.

My idea: First of all let's put one black ball in each box. We have got n white balls and n black balls to put into n boxes so my problem is how to put 2n balls into n boxes. So it's like solving an equation: $x_1+x_2+...+x_n=2n (x_n>=0)$ Is it correct?

• Your approach is incorrect, because it only counts how many of the white/black balls you put into each box (in the second phase). However the white/black balls are not all the same, so you are undercounting. – vadim123 Aug 29 '14 at 14:13
• Thank you @vadim123 for the answer. You are right.... So let's do it separatly, so I'll have 2 equation: one for white balls and one for black balls: $$x_1+x_2+...+x_n=n$$ $$x_1+x_2+...+x_n=n$$ $${{2n-1} \choose {n-1}}*{{2n-1} \choose {n-1}}$$ Is it a better idea? – keri Aug 29 '14 at 14:25
• Yes, this looks right. – user84413 Aug 29 '14 at 16:58

## 1 Answer

Your first step is correct. So the answer is the square of the number of ways to put $n$ balls into $n$ boxes. (One factor for white balls, one for black balls.)

It is easy to explain that number for $n$ balls and $m$ boxes. To find that, imagine we can move around the walls separating them into boxes. If we consider a fixed wall to the left of all the action, then the number of walls we get to place is $m$.

CORRECTION - The two commenters are right. Yuo get to place $m$ wall but one must be at the far right so you really get to choose places for only $m-1$ balls.

There are $m-1+n$ possible places for a wall (or for a ball). So the answer for $m$ boxes and $n$ balls is $\binom{m+n-1}{n}$.

THe answer you want, then is $\binom{2n-1}{n}^2$.

• Shouldn't it be $\binom{m+n-1}{n}$? – RandomUser Aug 29 '14 at 14:32
• You have a fixed wall at each end, and $m-1$ walls in the middle. So you are choosing $m-1$ things from $n+m-1$ and the answer is $\binom{n+m-1}{m-1} = \binom{n+m-1}{n}$. Thus the OP's answer in his comment above is correct; $\binom{2n-1}{n-1}^2 = \binom{2n-1}{n}^2$ – rogerl Aug 29 '14 at 14:47
• Yes, you are both right. I have changed the answer accordingly. – Mark Fischler Sep 3 '14 at 0:04