I have 3 pieces of candy to place in 4 lunch boxes. In how many ways can I do this if Exactly two of the candies are the same (but the third is different) and all of the lunch boxes are different?
We can place all three candies in any box = 4 ways
We can place the same candies in any one of the 4 boxes and the different one in any of the remaining 3 boxes
= 4 * 3 = 12 ways
We can place the different candy and either piece of the same candy in any of the 4 boxes and the other piece of the same candy in any of the remaining 3 boxes = 4 * 3 = 12 ways
[ The same candies are indistinguishable, so choosing either doesn't matter]
We can place the different candy in one of the four boxes and choose any 2 of the remaining 3 boxes to put one piece of each of the same candies in = 4 * 3C2 = 4 * 3 = 12 ways
So......
4 + 3(12) = 40 ways