
Michael F. answered 09/12/22
PhD in Mat with 30+ Years of Teaching Experience in Math and Comp Sci
First, note that the number of ways of placing balls in the four boxes is the number of ways of assigning number 1, 2, 3, 4 to all 20 balls, with repetition allowed. We'll call that number B. What is the value of B?
[B=420. And all 420 results are equally likely.]
Let's count the number of ways that the balls could all be in boxes 1 and 2, with no balls in boxes 3 or 4, and with neither box 1 or 2 empty. We will call that number B12.
There are 220 ways of placing the 20 balls in just boxes 1 and 2, and among those, there are 2 ways of placing all the balls in box 1 or all the balls in box 2. So what is B12?
[B12=220-2.]
And similarly for pairs i, j from 1 to 4 with i < j [why "<" there?], let Bij represent the number of ways to place the 20 balls all in boxes i and j, with neither box i or j empty. Again, Bij=220-2 for all such i and j. And the number of such pairs i and j is the number of 2-element subsets of the set {1,2,3,4}, which is 6.
No way of placing the balls is counted by more than one of these Bij, so the number of ways of ways of placing all the balls in exactly 2 boxes is 6(220-2).
So the probability that exactly 2 of the 4 boxes has balls placed in them is 6(220-2)/420.