Probability/Linearity of expectation - Foxes and Hounds I came across this question on a probability problems app I found. Can't seem to get my head around it.
"Five foxes and seven hounds run into a foxhole. While they're inside they get all jumbled up, so that all orderings are equally likely.
The foxes and hounds run out of the hole in a neat line. On average, how many foxes are immediately followed by a hound?"
The given hint: Linearity of expectation will help:
frame the foxes 1,2..,5, and X_i be an indicator of whether a fox is followed by a hound. The answer is E[X_1 + ... + X_5] = E[X_1] + .. E[X_5].
I tried to individually frame each term in the aforementioned formula but I can't seem to get it right. The approach was something like this.
So for the first time I assumed a situation where there exists only one such fox-hound pair(let a be foxes and b be hounds):
bbbbbbaaaa ab.
Which is equivalent to calculating the unique ways to place one object in 11 distinguishable boxes. And so on for other number of pairs.
I also tried an approach where I calculated all the orderings with 1,2..5 pairs, i.e, "fox followed by a hound" instances, multiplied them with the respective number of pairs and divided by the total number of possible pairings, however, I wasn't able to get the right answer.
Any hints or direction towards the right approach(s) are appreciated.
Thanks!
 A: Just imagine the foxes and hounds  all placed randomly  in a row, their position won't change when they come out.
Then P(a fox is in any position) $=\frac{5}{12}$,
and P(a hound is in any position) $= \frac{7}{12}$.
For P(get a fox immediately followed by a hound), the logic is more subtle, the probabilities of a fox-hound pair occupying any  two positions will be the same, hence the same as a fox-hound pair occupying positions $1$ and $2$.
Let $X_i$ be an indicator variable that $= 1$ if a fox-hound pair starts at $i$, and $0$ otherwise.
$P[X_i] =\frac5{12}\cdot\frac7{11} = \frac{35}{132}$
The expectation of an indicator variable is the same as its probability, 

 thus $E[X_i] = \frac{35}{132}$

Such fox-hound pairs can start  at 

 any of the first $11$ positions, 

thus by linearity of expectation, 

 $E[X] =  11\cdot\frac{35}{132} = \frac{35}{12}$ 

A: Let $X_i$ be the indicator function that canid #$i$ out of the hole is a fox and followed by a hound.
Then the average count of canids who are a fox and followed by a hound is: $\mathsf E(\sum_{i=1}^{12}X_i)$
We note that the 12th canid cannot be followed by any other (end of line), but for all 11 other foxes $\mathsf E(X_i)=\mathsf P(X_i=1)= \tfrac 5{12}\cdot\tfrac 7{11}$.   Then the Linearity of Expectation says, "The expectation of the sum is the sum of the expectations!"

 $$\mathsf E(\sum_{i=1}^{12}X_i) ~=~ \sum_{i=1}^{11} \mathsf P(X_i=1)+0 ~=~ \dfrac {35}{12}$$


Alternatively, let $Y_j$ be the indicator that fox $j$ is followed by a hound.   Now we are after $~\mathsf E(\sum_{j=1}^5 Y_j)~$, though this is the same average count as above.
We observe that there are 11 of 12 positions any fox can be followed by something, and when given such a position, 7 of the 11 possible pursuers are hounds.   Thus: $\mathsf E(Y_j)~=~\mathsf P(Y_j=1) ~=~ \tfrac 7{12}$.   Hence by Linearity of expectation we sum over the five foxes:

 $$\mathsf E(\sum_{j=1}^5 Y_j) ~=~ \sum_{j=1}^5 \mathsf P(Y_j=1) ~=~ \dfrac {35}{12}$$

Same answer, different approach.
