How many ways are there to distribute 10 balls to 5 boxes with additional conditions How many ways are there to distribute 10 balls ( 2 x 5 distinct colors) to 5 boxes (A, B, C, D, E), so every box get exacly 2 balls and box B & D get different colors
What I got
Number of ways that B gets different colors, basically equal to number of B get any pairs minus B get same colors
$$n(X) = \binom{10}{2} - 5$$
Number of ways that D gets different colors
$$n(Y) = \binom{8}{2} - 4$$
Number of ways to distribute other 6 balls to A, C, E (any pairs possible)
$$n(Z) = \binom{6}{2} \binom{4}{2} \binom{2}{2}$$
So, there are $$n(X) \times n(Y) \times n(Z)$$
ways to distribute 10 balls ( 2 x 5 distinct colors) to 5 boxes (A, B, C, D, E), so every box get exacly 2 balls and box B & D get different colors
I am given this question and I do not have the answer key, can anyone confirm/correct me?
 A: The number of ways $a(n)$ to distribute $n$ distinctly coloured pairs of balls into $n$ boxes that can each hold $2$ balls is given by OEIS A000681. The relevant values are as follows:
$$a(3)=21\qquad a(4)=282\qquad a(5)=6210$$
Now if box B has two same-coloured balls, there are $5$ ways to choose the colour and $a(4)$ ways fo assign the remaining balls – the same applies for box D. If both B and D are monochromatic there are $5×4$ ways to choose the colours and $a(3)$ ways to finish the assignment. Hence by inclusion/exclusion the answer is
$$a(5)-2\cdot5a(4)+20a(3)=3810$$
A: Most likely, the interpretation of the question is that the balls of the same color are identical. You already have an answer that is efficient. Here is a solution counting case by case. However, for case $2$ and $3$, you can easily find solutions by building a polynomial and then using Mathematica, which I have mentioned about a bit more at the end.
Each of boxes $B$ and $D$ has two balls of different colors. Cases -
$1$) All $4$ balls in boxes $B$ and $D$ are of different colors
$2$) $4$ balls of three colors are distributed to boxes $B$ and $D$
$3$) $4$ balls of two colors are distributed to boxes $B$ and $D$
Case $1$:
$ \displaystyle 5 \cdot {4 \choose 2} {4 \choose 2} \left[3! + \frac{3!}{2!} \right] = 1620$
There are $5$ ways to choose $4$ colors and from it, ${4 \choose 2}$ ways to choose ball colors for boxes $B$ and $D$. Now we are left with two balls of one of the colors and one ball each of $4$ different colors. If we keep two balls of the same color together, there are $ \frac{1}{2} \cdot {4 \choose 2}$ ways to make pairs from rest four balls of different colors. Similarly if we split two balls of the same color then we have ${4 \choose 2}$ ways to choose which color balls to pair them with. Finally there are $3!$ ways to permute these pairs among boxes $A, D, E$.
Case $2$:
$ \displaystyle 5 \cdot {4 \choose 2} \cdot 2 \left[3! + \frac{3!}{2!} + 4 \cdot 3!\right] = 1980 $
$5 \cdot {4 \choose 2} \cdot 2$ is the number of ways of selecting and arranging four balls of three colors in boxes $B$ and $D$ (two balls of one color and rest two different colors). Then what you see in $[ \ ]$ is the number of ways to make three pairs from remaining six balls ($2 \ 2 \ 1 \ 1$) and arrange them in boxes $A, D, E$.
Case $3$:
$ \displaystyle {5 \choose 2} \left[2 \cdot 3! + 3 \cdot \frac{3!}{2!}\right] = 210$
Adding them, you get the total number of permissible arrangements.
You can also approach it by building polynomials. But when you get to case $1$, it will become quite complicated even if you are using Mathematica. To give you an example, for case $3$, the number of permutations is,
$\displaystyle {5 \choose 2} \times \text { coefficient of } x^2y^2z^2 \text { in } (x^2 + y^2 + z^2 + xy + yz + zx)^3 = 210$
