[Math] Find out the number of ways the people can be seated in a row

combinatorics

I have a question,

There are $4$ boys and $4$ girls and there are $8$ seats. Find the number of
ways that they can sit alternatively and certain two of them (a boy
and a girl) should never sit together.

I am totally stuck with this one. One way I think I can find the answer is to consider those certain two a single unit and then calculate the seating arrangement ($3!*3!*2$) and then subtract it from the total combinations. Is this the right way to solve such a question?

Thanks

Best Answer

Let $B_0$ and $G_0$ be the boy and girl who must not sit next to each other. Number the seats $1$ through $8$ from left to right. Suppose that $B_0$ sits in seat $1$. Then there are $3$ girls $-$ all of them except $G_0$ $-$ who can sit in seat $2$. After that the other $3$ boys can fill seats $3,5$, and $7$ in any order, and the other $3$ girls can fill seats $4,6$, and $8$ in any order, for a total of $3\cdot 3!\cdot 3! = 108$ ways to fill the seats with $B_0$ in seat $1$. An exactly similar calculation shows that there are also $108$ ways to fill the seats with $B_0$ in seat $8$.

If $B_0$ chooses to sit in one of the six seats in the middle, matters are a little different, because there are now two seats in which $G_0$ cannot sit. Note, though, that as soon as $B_0$ takes his seat, we know which $4$ seats must be taken by the girls, and we know which $3$ seats must be taken by the other $3$ boys. Those $3$ boys can sit as they please among those $3$ seats, so that’s $3!=6$ choices. $G_0$ has a choice of the $2$ ‘girl’ seats not adjacent to $B_0$: that’s another $2$ choices. Finally, the remaining $3$ girls can sit as they please among the remaining $3$ ‘girl’ seats, for another $3!=6$ choices. The grand total is then $6\cdot 2\cdot 6=72$ ways in which they can be seated once $B_0$ chooses a particular middle seat. Since there are $6$ middle seats, that comes to a total of $6\cdot 72 = 432$ ways.

Finally, combine the two cases: we have altogether $2\cdot 108 + 6\cdot 72 = 216+432=648$ ways to seat the $8$ of them.