I have a problem with one exercise from Probability and Random Processes (2001) by Geoffrey R. Grimmett and David R. Stirzaker.
A coin shows heads with probability $p$. Let $X_n$ be the number of flips required to obtain a run of n consecutive heads. Show that $E(X_n) = \sum\limits_{i=1}^n p^{-i}$.
The solution offered by authors is
$E(X_n) = E\{E(X_n|X_{n-1})\} = E\{p(X_{n-1} + 1) + (1-p)(X_{n-1} + 1 + X_{n})\}$.
I am a bit confused with the last equation.
From definition of $E(X|Y)$ we shoud have something like: $$ E(X_n|X_{n-1}) = \begin{cases} v_1, \text{with} \; \text{probability} \; P(X_{n-1} = w_1), \\ v_2, \text{with} \; \text{probability} \; P(X_{n-1} = w_2), \\ \dots \end{cases} $$ But on the right hand we got something like this (from answer to Rigorous proof of the recursion method to compute expectations in probability.) $$ E(X_n) = E(X_n|X_n \; \text{ends})P(X_n \; \text{ends}) + E(X_n|X_n \; \text{starts} \; \text{again})P(X_n \; \text{starts} \; \text{again}) $$
So could someone expand the given answer in a more clear and strict form.
Excuse my English, I'm not a native speaker.
Am I right, in your solution you finding expectation of the following random variable? $$ X_n(\omega) = \begin{cases} X_{n-1}(\omega) + 1, \text{with probability } p, \ X_{n-1}(\omega) + 1 + X_{n}(\omega), \text{with probability } (1-p). \end{cases} $$
– NewUser2020 Dec 31 '19 at 13:32