# Tricky permutations question

There are 8 buckets, each bucket is a different color (for simplicity, let's label the colors A, B, C, D, E, F, G and H; if you like: Aqua, Brown, Cyan, Diamond, Eggshell, Fuchsia, Green, Hot-pink). There are 8 balls, each a different colour (also A, B, C, D, E, F, G, H).

Someone randomly throws all 8 balls into all 8 buckets, such that all buckets have exactly 1 ball in them after all 8 balls are thrown, and the process of throwing the balls into each bucket is completely random.

Q: What's the probability of exactly 3 colour matches? That is, what's the probability that 3 (and only 3) buckets have a ball tossed in them that is the same color as the bucket?

Here is what I've done so-far:

The no. of sample points in the sample space is P(8,8) = 8!.

The number of sample points in the event of exactly 3 color matches is C(8,3) (no. of ways of chooisng the 3 'matched' colors of 8), multiplied by the number of ways of arranging the 'unmatched colors' is (8 - 3 - 1 )! = 4! (For example, suppose the unmatched colors are D, E, F, G and H: The color of the ball in the D bucket can be E, F, G or H, i.e. 4 choices to prevent a color match. The number of choices to prevent a match in bucket E will be 3, then 2 in F, then 1 in G.)

So, the answer I have is: C(8,3)*4! / 8!.

One possible issue is with the calculation of 4! To follow from the example in the previous paragraph, suppose an Eggplant ball is placed in the Diamond bucket. Now, there are 4 choices on the second 'unmatched' throw rather than 3... And I don't know how to resolve this. I'm also not sure if the '3 from 8' color matches should be a combination as written, or permutation.

If anyone has any thoughts on this problem -- suggestions for improvement or validation of what I've done -- I would really appreciate it. Incidentally, the problem is based on Example 2.22 from Wackerly et. al.'s 'Mathematical Statistics with Applications' 7ed, 2007, but an extension (they use 3 and 1 instead of 8 and 3), and using a different method from what was done in the example.

## 3 Answers

Let $X$ be the number of color matches that occur in a round of this game. Consider $P(X = 3)$. We know that for the event $\{X = 3\},$ we need three of the balls to match the color assigned to them. Hence, Given $8$ balls, there are $\binom{8}{3}$ ways to get three balls such that those three balls will match colors with their placed buckets. We now need to assign the last $5$ balls such that none of them are assigned to their matched color. This can be done through an inclusion-exclusion procedure, where the event $A_i$ represents the event that the $i$th ball is matched. I will leave the full argument as an exercise, but for brevity using a standard inclusion exclusion procedure, we can see that the number of ways to derange these $5$ balls is $$5! - 5 \cdot 4! + \binom{5}{2} 3! - \binom{5}{3} 2! + \binom{5}{4} 1! - \binom{5}{5} = 44.$$

Thus, $|\{X = 3\}| = \binom{8}{3}(44).$ Divide this by the number of ways to arrange the $8$ balls into the $8$ buckets ($8!$), and we see that

$$P(X = 3) = \frac{\binom{8}{3}(44)}{8!} = \frac{11}{180}.$$

The reasoning that led to the $\binom{8}{3}$ was good. We now need to multiply by the number of permutations of $5$ objects that leave no object fixed. This is the number of derangements of $5$ objects, and is often denoted by by $D_5$.

So the number of favourables is $\binom{8}{3}D_5$. It turns out that $D_5=44$. And yes, then for the probability one divides by $8!$.

For information about how to count derangements, please see this Wikipedia article, or search MSE.

could the unmatch part be calculated as (5!-(one match)-(two matches)-(3 matches)-(4 matches)-(5 matches))=5!-C(5,1)-C(5,2)-C(5,3)-C(5,4)-C(5,5)?

• That is incorrect. See the answers posted by Claire and Andre Nicolas. – N. F. Taussig Jun 30 '16 at 9:52