The following is the question I can't seem to figure out:
At a conference for superheroes and supervillains, 5 pairs of heroes and villains are giving a panel seated in a row. Of course, if anyone sits next to their archenemy, complete chaos will break out and ruin the convention. How many ways can you arrange the panelists so that the program proceeds smoothly?
I have thought about this and all I could come up with for an answer is (10choose5) times the derangement of 4 elements. However it seems that this question is more complicated than that. I would appreciate any help. Thanks!
Total number of arrangements = $10! = 3628800$
Number of arrangements with Hero A next to Villain A = $2\cdot9\cdot8! = 725760$ as there are nine places for a block of two in a row of 10 and the block can be either way round and then the remaining eight people can be arranged however.
Number of arrangements with Hero A next to Villain A and Hero B next to Villain B = $2^2\cdot2!\cdot(\sum_{i=0}^6 (7-i))\cdot6! = 2^2\cdot2!\cdot(7\cdot8)/2\cdot6! = 161280$ as let there be i people between the two pairs. This i can be between 0 and 7 and there are then 7-i places to put the two pairs. Then the pairs can be swapped over or either of their orders can be reversed and then the remaining 6 people can be put in any of the remaining 6 places.
Number of arrangements with pairs A,B and C next to each other = $2^3\cdot3!\cdot(\sum_{i=0}^4 (5-i)(i+1))\cdot4! = 2^3\cdot3!\cdot35\cdot4! = 40320$ as this time if we have i people (not including the second pair) between the first pair and last pair we have to decide whether to distribute these people before or after the second pair and there are i+1 ways of doing this.
Number of arrangements with pairs A,B,C and D next to each other = $2^4\cdot4!\cdot(3+(3\cdot2)+3+3)\cdot2! = 2^4\cdot4!\cdot15\cdot2! = 11520$ as there are now 4 cases. If the pairs are all next to each other (in a block of 8) the remianing 2 people can either be both to the left of the 8, both to the right of the 8 or 1 either side so there are 3 possibilities. If 1 of the remaining people is inside the pairs and 1 is outside then there are 6 possibilities and if they are both inside there are 3 possibilities when they're next to each other and another 3 when they're not.
Number of arrangements with all pairs next to each other = $2^5\cdot5! = 3840$
Hence the total number of possibilities with no pairs next to each other (using inclusion-exclusion) = $3628800 - \binom{5}{1}\cdot725760 + \binom{5}{2}\cdot161280 - \binom{5}{3}\cdot40320 + \binom{5}{4}\cdot11520 - 3840 = 1263360$