Let $X_1,X_2,...,X_n, n>6$ are independent, $P(X_i=0)=\frac{3}{4}$ or $P(X_i=1)=\frac{1}{4}$. Let $Y_n$ is the number of substring $101$ or $111$ in the string $(X_1,...,X_n)$.
For example: for $(0,0,1,0,1,0,1,1,1,0,0)$ we have $Y_{11}=3$.
Find $EY_{n}$.
My approach:
I thought about it like about n-2 Bernoulli experiment, where
$p=P(X_{k}=1,X_{k+1}\in\{0,1\},X_{k+2}=1)=\frac{1}{4}*1*\frac{1}{4}=\frac{1}{16}.$
$P(Y_n=k)=\binom{n-2}{k}p^k(1-p)^{(n-2)-k}$.
$EY_n=\sum_{k=0}^{n-2}kP(Y_n=k)=...=\frac{n-2}{16} $
But the experiments are not independent so unfortunately this cannot be solve that way. Maybe you have some hints.
The fact that the experiments are not independent does not impact the result. The linearity of expectation still holds.
Let $Z_n$ be equal 1 if the string starting at position $n$ satisfies the desired criterion, and 0 otherwise.
Then, $$E(Y_n) = E(Z_1 + \ldots + Z_{n-2}) = (n-2)p$$
where $$p=1/16.$$
Here is an alternative solution:
and all powers of $P$ greater than or equal to 3 are
where $p=0.046875000000000 + 0.015625000000000=1/16$