Consecutive ones
Task number: 3545
Consider a random sequence of one hundred numbers, where each number in the sequence is 0 or 1 and both possibilities occur with probability \(1/2\) independently of the other terms of the sequence. Determine the expected value of the number of occurrences of six consecutive ones. (Optionally generalize for a sequence of \(n\) numbers and consecutive sequences of \(k\) ones.)
Solution
For \(i=1,…,95\) we introduce the event \(A_i\) containing the sequences with ones in positions \(i,i+1,…,i+5\). We have \(P[A_i]=\left(\frac12\right)^6=\frac{1}{64}\).
Let the random variable \(X\) be the sum of indicator random variables for the events \(A_1,…,A_{95}\).
By the linearity of expectation we have:
\(\displaystyle E(X)=E(I_{A_1}+…=I_{A_{95}})=95P(A_1)=\frac{95}{64} \)
Answer
The expected value of the number of occurrences of six consecutive ones is \(\frac{95}{64}\).
In the general case we obtain the value \(\frac{n-k+1}{2^k}\).