# Find probability and expectation [closed]

18 boys and 2 girls are made to stand in a line in a random order.Let $X$ be the number of boys standing in between the girls .Find $P[X=5]$ and $E[X]$. I proceed in this way: Note that $$P[X=0]=\frac{19.18!.2!}{20!}=\frac{19-0}{20\choose2}$$ $$P[X=1]=\frac{18.18!.2!}{20!}=\frac{19-1}{20\choose2}$$$$P[X=2]=\frac{17.18!.2!}{20!}=\frac{19-2}{20\choose2}$$So, $$P[X=x]=\frac{19-x}{20\choose2}$$,$x=0(1)18.$ so.$$P[X=5]=\frac{19-5}{20\choose2}=0.0737$$ and $$E[X]=\sum_{x=0}^{18}x.\frac{19-x}{20\choose2}=6$$

-
Crosspost: stats.stackexchange.com/q/33558/2970 –  cardinal Aug 2 '12 at 16:29
You got it all correct. Just to add a little bit of proof here, imagine the boys as black dots and the two girls as red dots. The configuration $X=5$ implies that the distance between the two red dots is $7$ dots. The number of working configurations is thus $20-7+1=14$ (just translate the fixed line between the red dots). Total configurations correspond to the choice of the position of red dots, which is $$\binom{20}{2} = 190$$ Thus $$P(X=5) = \frac{14}{190} = 0.0737$$ You got the rest correct.
This is a recurrent way of thinking in many brainteasers. You just fix one variable (how the guys are positioned) and just count configurations by looking at the other variable (girls). An example is the following : you got a $n\times p$ rectangle filled with $1 \times 1$ squares (like in a notepad). You start from the bottom-left corner. You can only go up or right. How many path will lead you to the top-right corner ? –  vanna Aug 2 '12 at 16:37