I'm facing the following problem:
Let $X, X_1, X_2..$ be IID random variables with $P(X=0) = P(X=1) = 1/2$.
- Let $N_1$ be the number of 0's and 1's until the first appearance of the pattern 10. Find $E[N_1]$
I am trying to use the following property:
$$E[X] = \sum_{i=1}^{\infty}P(X\geq i)$$
thus:
$E[N_1] = \sum_{i=1}^{\infty}(1 - P(N_1 < i))$
My tentative is the following:
$P(N_1<1) = P(N_1=0) = \dfrac{1}{2}\times\dfrac{1}{2} = \dfrac{1}{4} $ (i.e the probability of obtaining 1 in the first try and 0 in the second, so:
$P(N_1<2) = P(N_1=0) + P(N_1=1) = \dfrac{1}{4} + \dfrac{1}{2}\times\dfrac{1}{2}\times\dfrac{1}{2}$
$P(N_1<3) = P(N_1=0) + P(N_1=1)+P(N_1=2) = \dfrac{1}{4} + \dfrac{1}{8} + (\dfrac{1}{2})^{4}$
$$\vdots$$
$P(N_1<n) = P(N_1=0) + P(N_1=1) \dots +P(N_1=n-1) = \sum_{i=1}^{n}\Bigg(\dfrac{1}{2} \times \dfrac{1}{2^i}\Bigg)$
Thus: $E[N_1] = \sum_{i=1}^{\infty} \Bigg(1- \sum_{j=1}^{i}\dfrac{1}{2^{i+1}}\Bigg)$
And I don't know how to continue and I think that I'm doing something terribly wrong. Anyone can hep-me? Sorry if a made a huge mistake, I'm a beginner in probability.
What you are doing is needed if you are trying to find the distribution of 0s and 1s until you get 10, but for expected value, you can take a much simpler approach.
w.p. ${1 \over 2}$, you will get 0 in the next trial and you are done in just one more trial.
w.p. ${1 \over 2}$, you will get 1 in the next trial and you are back to where you started (since the trials are independent, the past doesn't matter). This means that you "wasted" a trial and now you need another $X_1$ expected trials to get to 10 (by definition of $X_1$)
So you have $X_1 = {1 \over 2}(1) + {1 \over 2}(X_1+1)$
Solve to get $X_1 = 2$.
w.p. ${1 \over 2}$, you get a 0 and you are back to where you started
w.p ${1 \over 2}$, you get a 1 and now you need another $X_1$ expected trials to get to 10 (remember we defined $X_1$ above
This gives $X_0 = {1 \over 2}(1 + X_0) + {1 \over 2}(1 + X_1)$
Since we know $X_1 = 2$, you can solve the above to get $X_0 = 4$
${1 \over 2}X_0 + {1 \over 2}X_1 + 1 = 4$ (the +1 at the end is because you need to count the very first trial as well)
This is a good problem to learn the idea of a "state". The experiment may wander over different states and once it comes back to the state where it started, the history is forgotten! You will learn a lot more about this when you study Markov chains.