A set of binary data can have either a 1 with probability $\displaystyle p$ or a 0 with probability $\displaystyle 1-p$. A set of outcomes that have to same values is referred to as a run (i.e the set 1,1,0,1,1,1,1 where the first run with have 2 values, the second run would have 1, the third of length 4, and so on).

A)Find the expected length of the 1st run

B)Find the expected length of the 2nd run

$\displaystyle Y = \left\{ \begin{array}{rcl}

1 & \mbox{if} & \mbox{if the first number is a 1} \\ 0 & \mbox{if} & \mbox{if the first number is a 0} \end{array}\right.$

A)$\displaystyle E[N] = E[N|Y=1]P \left( Y=1 \right)+E[N|Y=0]P \left(Y=0\right) $

$\displaystyle E[N] = E[N|Y=1]p+E[N|Y=0](1-p) $

$\displaystyle E[N] = (1)p+1+E[N](1-p)$

$\displaystyle E[N] = \frac{1}{p}$

B)I would think it would be an identical to part A), but I'm unsure of that.