What's the expected number of pairs to arrange 9 cats and 8 dogs into 17 places on a row? What's the expected number of pairs to arrange 9 cats and 8 dogs into 17 places in a row. A pair means a dog sits next to a cat.
My approach is to think it as $$P(X=1) \cdot 1 + P(X=2) \cdot 2 + \cdots + P(X=8) \cdot 8$$ where $X$ is the number of pairs appearing in the row. But this approach requires lots of calculations for $P(X=1)$ to $P(X=8)$ and it is not trivial.
Any help is appreciated!
 A: This is mostly about defining appropriate indicator variables, simplifying using linearity of expectation and symmetry, then using combinatorial arguments to solve the simplified expression.
Let's define indicator variables: for $i \in \{1,\ldots,16\}$,

*

*$X_i = \begin{cases} 1 & \text{if there is a dog in seat } i \text{ and a cat in seat } i+1 \\ 0 & \text{otherwise} \end{cases}$

*$Y_i = \begin{cases} 1 & \text{if there is a cat in seat } i \text{ and a dog in seat } i+1 \\ 0 & \text{otherwise} \end{cases}$
(It is possible to define the indicator variables differently and still come to the same result.)
So we're after the expected value: $$E(X_1 + \cdots + X_{16} + Y_1 + \cdots + Y_{16}).$$
By linearity of expectation this is equal to $$E(X_1) + \cdots + E(X_{16}) + E(Y_1) + \cdots + E(Y_{16}).$$
From here,

*

*we use symmetry to argue that $E(X_1)=\cdots=E(X_{16})=E(Y_1)=\cdots=E(Y_{16})$, which enables us to simplify the expression; and


*we note
$$
\begin{align*}
E(X_1) &= \mathrm{Prob}(\text{there is a dog in seat } 1 \text{ and a cat in seat } 2) \\
&= \frac{\text{number of arrangements in which there is a dog in seat } 1 \text{ and a cat in seat } 2}{\text{total number of arrangements}}. \\
\end{align*}
$$
and then use combinatorial arguments to find a value of $E(X_1)$.
