Putting colored balls into colored urns 
There are six balls and urns each. They are equally distributed in three colors: R, W, and B. Place the balls randomly in the six urns, arranged linearly. What is the probability that no ball is in an urn of the same color?

We can think of this as a matching problem, consider $X = \{r_1,r_2,b_1,b_2,w_1,w_2\}$. We want to find the number of bijections $f:X\to X$ such that:

*

*$f(r_i) \ne r_j$ for $1\le i,j\le 2$

*$f(b_i) \ne b_j$ for $1\le i,j\le 2$

*$f(w_i) \ne w_j$ for $1\le i,j\le 2$
The total number of bijections is $6! = 720$. Define a few sets:

*

*$R = \{f: X\to X \text{ is a bijection }: f(r_i)\ne r_j, 1\le i,j\le 2\}$

*$B = \{f: X\to X \text{ is a bijection }: f(b_i)\ne b_j, 1\le i,j\le 2\}$

*$W = \{f: X\to X \text{ is a bijection }: f(w_i)\ne w_j, 1\le i,j\le 2\}$
The answer we require then is $1 - \frac{N}{720}$, where $N = |(R\cap B\cap W)^c| = |R^c\cup B^c\cup W^c|$. Using inclusion-exclusion principle, we know that, $$|R^c\cup B^c\cup W^c| = |R^c| + |B^c| + |W^c| - |R^c\cap B^c| - |R^c\cap W^c| - |W^c\cap B^c| + |R^c \cap B^c\cap W^c|$$

Any other ways to approach the problem? Thanks a lot!
 A: My solution counts the permissible arrangements directly.
We have six urns - two each of colors R, W and B. We call them R, W and B. Same for six balls and we call them r, w and b.
We first pick two balls of a color - say r. There are
i) $4$ ways to put both r in urns of one color ($2$ ways to go into W and $2$ ways to go into B).
ii) $8$ ways to put them in urns of different colors ($4$ choices for the first ball and then $2$ choices for the second ball)
In case of $(i)$, if both r have gone into W, both b have to be in R and both w must go into B. This can be done in $2 \cdot 2$ ways.
In case of $(ii)$, we have two R and one each of W and B empty. One of the w must be in B ($2$ ways) and one of the b must be in W (again $2$ ways). Then remaining two balls can go into R in $2$ ways.
So total number of permissible arrangements $ = \small \displaystyle 4 \cdot 2 \cdot 2 + 8 \cdot 2 \cdot 2 \cdot 2 = 80$
So the desired probability $ = \small \displaystyle \frac{80}{6!} = \frac{1}{9}$
A: There are $6!$ possible orderings of the balls in the urns, all of which we assume are equally likely.  We will show by the method of Rook Polynomials, which is an extension of the Principle of Inclusion / Exclusion, that the number of arrangements in which no ball is placed in an urn of the same color is $80$, so the probability of such  an arrangement is $80/6! = 1/9$.
Number the urns from $1$ to $6$, with urns $1-2$ all one color, $3-4$ the second color, and $5-6$ the third color.  Then the number of acceptable arrangements is the same as the number of ways to place $6$ non-attacking, distinct rooks on the following $6$ by $6$ chessboard, where an X marks a forbidden square:
    X X . . . . 
    X X . . . . 
    . . X X . .
    . . X X . .
    . . . . X X 
    . . . . X X     

We want to find the rook polynomial $R(x)$ of the forbidden sub-board.  By definition
$$R(x) = \sum r_i x^i$$
where $r_i$ is the number of ways to place $i$ identical non-attacking rooks on the forbidden squares, for $0 \le i \le 6$.  We define the number of ways to place zero rooks as $1$, so $r_0=1$.
For a start, let's consider the forbidden $2$ by $2$ sub-board in the upper left hand-corner:
    X X 
    X X

By inspection, the rook polynomial of this sub-board is
$$1 + 4x + 2x^2$$
Since the larger forbidden area consists of three such $2$ by $2$ similar areas with no rows or columns in common among the three areas, the rook polynomial of the forbidden sub-board is
$$R(x) = (1 + 4x + 2x^2)^3$$
On expansion,
$$R(x) =1+12 x+54 x^2+112 x^3+108 x^4+48 x^5+8 x^6$$
Now we can find the number of ways to place $6$ distinguishable non-attacking rooks on the allowable area of the $6$ by $6$ board.  By inclusion / exclusion, that number is
$$1(6!) -12 (5!)+54 (4!)-112 (3!)+108 (2!)-48(1!)+8 (0!) = \boxed{80}$$
A: In the answers above (and in the question) it is assumed that the balls and urns are distinct. If we let identically colored balls be identical (which is reasonable), we arrive at the same result nonetheless! I write this answer to merely demonstrate that. The urns are always distinct since their linear ordering distinguishes them.

The multiset $\mathcal B = \{R,R,B,B,W,W\}$ consists of balls, and the set $\mathcal U = \{R_1,R_2,B_1,B_2,W_1,W_2\}$ consists of the urns. The urns are assumed distinct (even though their colors may be identical) since they are arranged in a straight line - the linear ordering helps us distinguish between any two urns.
The total number of ways of putting balls into urns (no restrictions) would be the same as the total number of ways of arranging the balls in a straight line. In other words, $$\frac{6!}{(2!)^3} = 90$$
Now, let's find the total number of desirable arrangements!
Notation: $\{B_1,...,B_i\} \to \{U_1,...,U_i\}$ is used to replace the following statement: "The ball $B_j$ is put in envelope $U_j$, for all $1\le j\le i$".

*

*Suppose $\{R,R\}\to \{B_1,B_2\}$. This uniquely determines the entire arrangement, as $\{B,B,W,W\} \to \{R_1,R_2,W_1,W_2\}$.


*Suppose $\{R,R\}\to \{W_1,W_2\}$. This uniquely determines the entire arrangement, as $\{B,B,W,W\} \to \{R_1,R_2,B_1,B_2\}$.


*Suppose $\{R,R\} \to \{B_1,W_1\}$. There are two possibilities for the remaining balls, namely $\{B,B,W,W\} \to \{R_1,W_2,R_2,B_2\}$ and $\{B,B,W,W\} \to \{R_2,W_2,R_1,B_2\}$. Simiarly, we get $3\times 2 = 6$ more favorable arrangements corresponding to $\{R_1,R_2\} \to \{B_2,W_2\}$, $\{R_1,R_2\} \to \{B_1,W_2\}$ and $\{R_1,R_2\} \to \{B_2,W_1\}$.
From (1), we have 1 arrangement. From (2), we have 1 arrangement. From (3), we have $4\times 2 = 8$ arrangements. The required probability is then
$$\frac{1+1+2\times 4}{90} = \frac{10}{90} = \frac{1}{9}$$
