# Probability question involving computing the number of degenerates, !n

5 different colored balls have matching 5 buckets. Each balls is randomly placed in a bucket. A bucket can only accommodate 1 ball.

What is the probability that:

a.) None of the balls match their buckets b.) Exactly 2 balls match their buckets

My approach is as follows:

a.) I just counted. Let's say I number the balls 1,2,3,4,5 with corresponding buckets, 1,2,3,4,5. I know that there are 4 different ways to get them all in the wrong buckets by just shifting the balls one bucket away. That is, (5,1,2,3,4) (4,5,1,2,3)(3,4,5,1,2) and (2,3,4,5,1). Then, another way to get them all wrong is to choose any 2, interchange their positions, then mix up the remaining three as well. There is only 1 way to mix up the remaining 3 once the first 2 are chosen so this is just 5C2 ways. This also results to the same outcome if instead I choose 3 first and jumble those before interchanging the other 2. So the probability is: $\frac{5C2+4}{5!}$

b.) For exactly 2 to match, we can choose any 2 from 5 and then mix up the other 3 so they won't match. This seems to exhaust all possible ways. So that's just 5C2, making the probability: $\frac{5C2}{5!}$

• Please see en.wikipedia.org/wiki/Derangement. There are many more 5-derangements than you listed. – Łukasz Grad Jul 2 '17 at 10:01
• This is great. Thank you. Honestly, this is the first time I've read the term derangement. – user164144 Jul 2 '17 at 10:25
• Please use a title that describes the topic of your question more precisely than "probability". The "Did I do this correctly" can safely be left for the question body – Glen_b Jul 3 '17 at 4:08

## 1 Answer

Thank you @LukaszGrad for making this answer possible.

There are 5!=120 ways of matching a ball with a bucket.

a.) I just need the number of derangements (Yey) !5, which refers to the number of ways to match the 5 balls with the wrong buckets. Using the recursive relationship, $!n=(n-1)(!(n-1)+!(n-2))$, I get !5=44.

So, the probability is 44/120.

b.) 5C2 is the number of ways of choosing 2 balls with correct buckets. The remaining 3 balls need to go into the wrong buckets so the total number of ways of getting exactly 2 balls in the right buckets is (5C2)(!3) = 10(2)=20.

So, the probability is 20/120.