I'm hoping someone can explain how this works.
The problem: A man, woman, boy, girl, cat, and dog are walking down a path in single file. How many ways can this happen if the dog is between the man and the boy?
The given solution: There are $2*4! = 48$ lines with the dog directly between the man and the boy. There are $3 * 2 * 2 * 3! = 78$ lines with the dog and one other between the man and boy. There are $3*3!*2*2 = 78$ lines with the dog and two others between them. There are $4! *2 = 48$ lines with the dog and the other 3 between them. so there are a possible $48+72+72+48 = 240$ possible lines with the dog between the man and the boy.
The way I went about this was that there are $6!$ total possible lines and $3!=6$ possible orders. In two of those orders, the dog is between the man and boy. So the possibility of having the dog between them is $\frac{2}{6} * 6! = 240$.
What I don't understand is where the numbers they came up with for each solution came from. For example, There are $3*3!*2*2 = 78$ lines with the dog and two others between them. Where do these numbers comes from?
So we consider (man, _, _, _, boy). We begin by choosing two of the three (woman, cat, girl). We then permute those two with the dog in the three slots. So $\binom{3}{2} = 3$ ways to choose two remaining persons. There are $3!$ ways to permute the two chosen with the dog in the slots between the man and boy. We then consider the symmetry case of the boy appearing before the man (the first two). Finally, we have one unchosen person, which could appear at the front or end of the line (the second two).