# 5 black, 7 red, 9 blue, and 6 white marbles.

I'm having trouble finding how many ways there is to arrange 5 black, 7 red, 9 blue, and 6 white marbles to find the probability that every white marble is adjacent to at least one other white marble.

If you could help me out that would be great!

-

There are, in general, $n!$ ways to arrange $n$ objects. So you'd have $(5+7+9+6)!$ but then as all the black marbles are identical, their permutations shouldn't be counted. For every 'good' permutation, you also have another $5!7!9!6!$ that only differ from it by permutations of same colored marbles. Thus the result is $\frac{(5+7+9+6)!}{5!7!9!6!}$.

For the probability, consider that whites must be in pairs or triples. This is equivalent to solving the previous problem for $3$ and $2$ white marbles. Notice that the two cases overlap when all $6$ marbles are in one group.

-

We describe one way to count the number of ways to arrange the balls.

Let the number of ways to place the white marbles be $W$. Each of these ways leaves $21$ empty slots. Let $N$ be the number of ways to fill these slots. Then our answer is $WN$.

Finding $N$ is probably a standard problem for you.

Finding $W$ is more complicated. We can split into cases. First count the number of ways to place the white marbles so they are all together.

Then count the $4$-$2$ splits (and the $2$-$4$ splits). Then count the $3$-$3$ splits, and finally the $2$-$2$-$2$ splits.

The counting of, for example, the $4$-$2$ splits is not hard. Imagine the non-whites lined up. Then there are $22$ gaps between them, including the end "gaps." Choose $2$ of these.

For the probability, divide by the number of ways to place the balls with no restriction.

-

First find the total probability space of the marbles. I assume the marbles of each color are otherwise indistinguishable and so order doesn't matter.

$N_{all} = \frac{(5+7+9+6)!}{5!\cdot7!\cdot9!\cdot6!}$

Second, create an expression for the number of combinations of the black, red, and blue marbles, this will be the number of contexts for the white marbles .

$N_{contexts} = \frac{(5+7+9)!}{5!\cdot7!\cdot9!}$

Our total probability is going to equal...

$P = \frac{N_{contexts} \cdot N_{whites}}{N_{all}} = \frac{21!6!}{27!} \cdot N_{whites}$

Next think about how many ways every white marble can be adjacent to at least one other white marble: (2,2,2), (2,4), (3,3), and (6,0)

The (6,0) case is the easiest because there is only one moveable entity. There are (5+7+9)+1 possible locations within the other marbles (5+7+9 locations before another marble and an extra 1 location at the very end).

$N_{1} = 22$

The (3,3) case and the (4,2) case have equal combinations because they both have two moveable entities. The first set of white marbles can be in (5+7+9)+1 possible locations, and that leaves (5+7+9) locations for the second set. Order shouldn't matter, so we get...

$N_{2} = \frac{(5+7+9+1)(5+7+9)}{2} = 231$

For the (2,2,2) case (our last one!), we have (5+7+9)+1 locations for our first pair, (5+7+9) for our second, and (5+7+9)-1 for our third. Again order shouldn't matter, so we get...

$N_{3} = \frac{22!}{19!\cdot3!} = 1540$

Now, we say that $N_{whites} = N_1 + 2 \cdot N_2 + N_3 = 2024$ and plug that value into the original formula and we get...

$P = \frac{21!6!}{27!} \cdot 2024 = .00683...$

So the final probability is about 0.7%.

-
Just realized that for calculation of $N_2$, order doesn't matter for the (3,3) sets but does matter for the (2,4) sets, i.e. they should be distinct from (4,2) arrangements. Therefore the formula for $N_{whites}$ should be $N_{whites} = N_1 + 3 \cdot N_2 + N_3 = 2255$. The final probability would then be about .00761 (0.761%). – cheepychappy Sep 27 '12 at 18:12
Should give hints to homework, not a complete solution. – Michael Chernick Sep 27 '12 at 21:16
@MichaelChernick That was my first answer on stack exchange. I'll know better next time! – cheepychappy Sep 28 '12 at 0:35
I was just trying to inform nit to reprimand. Thank you for adding the tag. – Michael Chernick Sep 28 '12 at 13:48

A simple way is to compute the complement.

The 21 "non-white" marbles have 22 "interstices" (including ends), so the white marbles can be placed in C(22,6) "non-adjacent" ways and the others permuted in 21!/(5!7!9!) ways in their positions

Pr = 1 - [C(22,6)*21!/(5!7!9!)]/[27!/(5!7!9!6!)]

= 1 - C(22,6)*6!21!/27!

-