TITLE: Distributing 21 balls in 3 urns with some condition
QUESTION [1 upvotes]: In how many ways can we distribute $21$ distinct balls in $3$ different urns such that the first urn contains an even and the second urn contains an odd number of balls? Since $21$ can be written only as the sum of three odd numbers or two even numbers and an odd number, we can say the number of distributions of $21$ balls in $3$ urns is:
$$A_{1} + A_2{} + A_{3} + B$$
where:
$$A_{i} = \text{The number of distributions where the ith urn contains an odd} \\ {\text{and the other urns contain an even number of balls}}$$
and:
$$B = \text{The number of distributions where all urns contain an odd number of balls}$$
Now $A_{1} = A_{2} = A_{3}$ (say $x$) since any state of any of these three can be mapped to the other ones by changing the order of the urns. Now Looks like $B = x - 1$ and I want to prove this by defining a bijective function from the set of all states of the part $A_{1}$ excluding one particular element to the set of all the states of the part $B$ but the functions I define don't happen to be injective. (Moving one ball from an urn containing an even number of balls to the other one containing an even number of balls could be a possible solution but this function is not injective.) What function do you suggest for this? If we define a bijective function successfully then we'll have:
$$x + x + x + x - 1 = 3^{21} \Rightarrow 4x - 1 = 3^{21} \Rightarrow x = \frac{3^{21} + 1}{4}$$
Which is the answer to the problem.

REPLY [1 votes]: For odd number of balls in bin $1$, we are left with even number of balls to distribute between bin $2$ and $3$.
If the number of even balls is $2k \ (k \in \mathbb{Z+})$, then keeping one of the balls aside, there are $ \ 2^{(2k-1)} \ $ possible ways to distribute balls in two bins. Every arrangement will have even number of balls in one of the bins and odd in the other. But by fixing the position of the last ball as the bin with odd number of balls, $2^{(2k-1)}$ is the number of arrangements of $2k$ balls in two bins such that both bins have even number of balls. As there are $2^{2k}$ arrangements in total, that leaves us with same number of arrangements $2^{(2k-1)}$, where there are odd number of balls in both bins.
The above holds true for any odd number of balls but when there are $21$ balls in bin $1$, $k = 0$ and total number of arrangements in bin $2$ and $3$ is $2^{2k} = 1$, which is odd - there is one arrangement $\{21 \ \ 0 \ \ 0\}$ with even number of balls in bin $2$ and $3$ but there are no arrangements with odd number of balls in bin $2$ and $3$.
That leads to $ \ 3 x + (x-1) = 3^{21}$.
{"set_name": "stack_exchange", "score": 1, "question_id": 4215780}