Seven balls labeled with number 1 to 7 are distributed randomly among seven boxes also labeled with number 1 to 7. And each box can contain at most 1 ball. What is the probability that exactly 2 balls go to boxes with the same number?

It seems that we should fix the 2 correct boxes first, and consider the remaining 5 boxes with inclusion-exclusion principle. But I am not sure how to apply the principle in this situation, what event we should denote here. Can anyone explain it for me?


1 Answer 1


You're right about the first step, however I disagree with your other steps.

First, we must choose and place two balls in their corresponding boxes. This can be done in ${7 \choose 2}$ ways.

Next, we need to place the remaining five balls in such a way that none of them are in their corresponding boxes. The number of ways to do this is equal to the number of derangements of $5$. So, this can be done in $44$ ways.

To find the probability of this situation occurring, we note that the balls can be arranged in a total of $7!$ ways. Therefore, the probability is

$${7 \choose 2}\frac{44}{7!}=\frac{11}{60}.$$

  • 1
    $\begingroup$ The final answer cannot be 44, because it is not a probability. $\endgroup$ Oct 4, 2015 at 8:21
  • 1
    $\begingroup$ This is not a correct answer because you ignore the fact that there are $\binom{7}{2}$ ways to choose the two balls that are correctly identified with their respective numbered boxes. $\endgroup$
    – heropup
    Oct 4, 2015 at 8:21
  • 1
    $\begingroup$ Made some corrections. My apologies. $\endgroup$
    – eloiprime
    Oct 4, 2015 at 8:25
  • 1
    $\begingroup$ Thank you for your reply and I think this is the correct answer. After some searching on derangement, however, I think we can use principle of inclusion and exclusion here as the formula for derangement can be obtained from this principle, just think of the complement of having all of them go to the corresponding boxes. $\endgroup$
    – Jacky
    Oct 4, 2015 at 23:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .