each element of a sequence of binary data is either 1 with probability p or 0 with probability 1-p. a maximal sub sequence of consecutive value having identical values is called a run. Ex. in 1,1,0,1,1,1,0 first run=2 second run= 0

find expected length of the first run

conditioning on the first run

E[x]=E[x]Y=y]

when y=1 i saw this as gemotric distribution with probability of success= p and its mean 1/(p)

and when y=0, same thing but with probability of success= 1-p and mean 1/(1-p)

And E(x)= Ex]y=0 * P(y=0) + Ex]y=1 * p(y=1)

= p* (1/p) + (1-p)*(1/(1-P))=

1+1=2

but i have a bad feeling!