# Combinatorics male, female couple

I have to solve this problem about female-male couples:

There are $n$ males, $k$ females, that buy tickets in a $(n+k)$ row. Everyone sits randomly. Let all the $(n+k)!$ possible arrangements have the same probability. What is the expected Male/Female couple count in this row?

Example: MMMFFMFMMF has 5 M/F couples.

The first part of the solution is:

Let $j = 1, \ldots, n+k-1$

$$X_j = \begin{cases} 1 & \text{if j-th couple is M/F couple} \\ 0 & \text{otherwise} \end{cases}$$

And $E[X_j] = P[\text{j-th couple is M/F}] = \frac{2nk(n+k-2)!}{(n+k)!} = \frac{2nk}{(n+k)(n+k-1)}$

Could someone explain to me how he derived that formula?

The denominator of $(n+k)!$ is simply the number of possible arrangements, so the numerator must be counting the arrangements in which the $j$-th couple is M/F. In order for that to happen, the $j$-th and $(j+1)$-st positions must be either MF or FM. There $nk$ ways to choose the man and woman forming this couple, and they can appear in either order; that accounts for the factor of $2nk$. The remaining $n+k-2$ people can be arranged in any of $(n+k-2)!$ orders in the remaining $n+k-2$ seats; that accounts for the rest of the numerator. That is, there are $2nk(n+k-2)!$ arrangements that have a M/F couple in the $j$-th and $(j+1)$-st seats.