Suppose we are given N men and M women.They are to sit in a row of size K such that no two women sit next to each other.What are the number of ways. Like if suppose their are 3 men and 2 women and size of row is also 3 then answer in this case is 5. Possible arrangements are :
Arrangement 1 W M W
Arrangement 2 W M M
Arrangement 3 M W M
Arrangement 4 M M W
Arrangement 5 M M M
How to find count of these ways for given N,M and K?
Let's see. say e have $K$ places in the row, $N$ men and $M$ women. First we consider each man and each woman as a distinct object, then we see what changes if we distinguish people only by sex, i.e. if each man is considered identical to each other and same for women. We suppose $K=M+N$, so the people we have fill the whole row. First, we calculate $K!$ and that is how many arrangements we get if each person is distinct from each other. Now naturally, if we swap two men the arrangement is considered the same, since we only distinguish sex, and not, for example, name or surname. So we divide by $N!$, the number of possible arrangements of the men, and then by $M!$, the number of possible arrangements of the women. Thus, we get: $$\dfrac{K!}{M!N!}.$$ The next question is naturally: what if $K\neq M+N$? In that case it's the first part that changes. The second part stays the same. Naturally, we want all people to find a seat, so we suppost $K>M+N$, strictly major since the equality case has been dealt with by the previous part of the answer. We want to know in how many ways $M+N$ distinct objects can be placed in $K$ places. For every place, we have $M+N$ possibilities. That gives us $(M+N)!$ possible placements. The problem is: what places do we leave empty? So we really need to see in how many ways we can select those $K-(M+N)$ empty seats. For the first one we have $K$ possibilities. For the second one, $K-1$. And so on, until we have chosen all the empty seats. This gives us $\frac{K!}{(M+N)!}$. Now that distinguishes whether we choose a certain seat as the first empty seat or the second one, which we do not want. To avoid that, we divide by $[K-(M+N)]!$, the permutations of the empty seats. So we get: $$\dfrac{K!}{(M+N)![K-(M+N)]!}.$$ Now we want to distinguish the people only by sex, so we again divide by $M!N!$, strongly hoping the division is possible, as it naturally should. So we should get: $$\dfrac{K!}{(M+N)![K-(M+N)]!M!N!}.$$ If instead $K<M+N$, then I leave it to you to calculate in a similar fashion how many ways there are to choose those that won't sit and then apply the only-by-sex distinction.