There are 2 engineers, 2 doctors and 2 teachers ( total of 6 people) that needs to be seated linearly. How many different ways they can be seated given that people with same profession cannot be seated next to each other?

It might be easiest to find out the number of patterns first, then figure out the possible arrangements of those patterns. For example, you could take a pattern like 123231, assuming that lower numbers appear first. You can multiply the number of these patterns by 6 (3!) to account for the actual ways you could match the numbers 1, 2, 3 to the professions E, D, and T, and then finally multiply by a further 8 (23) to account for the arrangements where the people in the same profession are swapped.

Following these rules, the patterns must all start with:

12????

Clearly 2 can't be next. If it's 1, you can work out that there's actually only one possible resulting arrangement. On the other hand if it's 3, then there's a few possibilities, but it's still fairly easy to enumerate them. Then you could just multiply the total number of arrangements by 6*8 = 48 due to the reasoning earlier and you're done.

/r/askmath Thread