Karthik Kumar
Last Activity: 9 Years ago
Let us first find the answer for 3 boxes/balls from which we will deduce the answer for 4 boxes/balls. In the case of 3 boxes, there are 3!=6 ways of placing the balls without restriction, and it is easy to see that only 2 of these have no ball in the same color box. (denoting the colors by 1,2,3 then the arrangements 2,3,1 and 3,1,2 are the only ones). So there must be 4 arrangements where at least one ball is the right color. Of these, three have one ball correct and one has all three balls correct.
To build the answer for n=4, we imagine we have just played the game for n=3 and we add the 4th box/ball. If we place the 4th ball directly in its same color box, the arrangement is ineligible. However if we start with a n=3 arrangement that has no ball correct, we can substitute the 4th ball in any of 3 positions and move that ball to the 4th box, giving 2*3=6 wrong arrangements. Also, we could start with a n=3 arrangement that has exactly one ball correctly placed (there are 3 of those), and we could substitute the 4th ball into that position, giving 3 more cases. So the answer is 6+3=9 arrangements where at least one ball is wrong Let us first find the answer for 3 boxes/balls from which we will deduce the answer for 4 boxes/balls. In the case of 3 boxes, there are 3!=6 ways of placing the balls without restriction, and it is easy to see that only 2 of these have no ball in the same color box. (denoting the colors by 1,2,3 then the arrangements 2,3,1 and 3,1,2 are the only ones). So there must be 4 arrangements where at least one ball is the right color. Of these, three have one ball correct and one has all three balls correct.
To build the answer for n=4, we imagine we have just played the game for n=3 and we add the 4th box/ball. If we place the 4th ball directly in its same color box, the arrangement is ineligible. However if we start with a n=3 arrangement that has no ball correct, we can substitute the 4th ball in any of 3 positions and move that ball to the 4th box, giving 2*3=6 wrong arrangements. Also, we could start with a n=3 arrangement that has exactly one ball correctly placed (there are 3 of those), and we could substitute the 4th ball into that position, giving 3 more cases. So the answer is 6+3=9 arrangements where at least one ball is wrong