4. In how many ways can 8 people be arranged in a line if Alice and Bob must be next to each other, and Carol must be somewhere behind Dan?
Solution:
5040

Let us place Alice and Bob as a single person; there are then $7!=5040$ different arrangements. Alice can be in front of Bob or vice versa, multiplying the number of possibilities by 2, but Carol is behind Dan in exactly half of those, so that the answer is just 5040 .