4

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.

1 Answers1

3

Let $E_i=E[X_i]$ for convenience.

The idea is to wait until you have thrown $n-1$ Heads for the first time. Then, you either get $H$ on the next toss (in which case you are done) or you throw $T$ in which case you start over. Since you expect it to take $E_{n-1}$ tosses to get that string of $n-1$ $H's$ we get the recursion $$E_n=p(E_{n-1}+1)+(1-p)(E_n+E_{n-1}+1)$$

After all, if you do get $H$ as the next toss after the $n-1$ Heads, then you expect it to have taken $E_{n-1}+1$ tosses. If you get a $T$ instead then you expect to have thrown $E_{n-1}+1$ times and you have to start over, so you expect to need another $E_n$ throws.

Thus $$E_n=1+E_{n-1}+(1-p)E_n\implies pE_n=1+E_{n-1}\implies E_n=\frac 1p+\frac 1p\times E_{n-1}$$

Starting with $E_0=0$ (or with $E_1=\frac 1p$ if you prefer) we get the desired result by induction.

lulu
  • 77,692
  • 6
  • 89
  • 141
  • Thanks for answer, lulu!

    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
  • Well, I'm not happy with the notion of a self-referential random variable. More comfortable phrasing the whole thing in terms of expectations. – lulu Dec 31 '19 at 13:39
  • Is it ok, that we define values of one random variable with another random variable? If so, we could replace $X_n$ in cases to $\hat{X_n}$, where $\hat{X_n}$ has the same distribution as $X_n$. This way, there is no problem of self-reference. – NewUser2020 Dec 31 '19 at 13:46
  • Consider the simplest example of the argument. Say we are tossing a fair coin and let $X$ be the variable which counts the number of times until $H$ is seen. Then, as expectation, we have $E[X]=\frac 12\times 1 +\frac 12\times (E[X]+1)$ which quickly resolves to $E[X]=2$. But I would never say $X=1, X+1$ with equal probability. – lulu Dec 31 '19 at 13:47
  • This seems clear. So, using this way to solve a such problem, we can write down the expectation in some intuitive form, instead of using the definition of expectation, which requires the knowledge of random variable distribution? – NewUser2020 Dec 31 '19 at 13:57
  • Well, I am certainly using the definition of expectation. I'd say rather that, as the question asked only about expectation, I focussed entirely on that. If you next asked about the variance of $X_n$, you'd have to revisit. As a general point...expectation has many nice properties (like linearity) that aren't available for higher moments. Thus, when asked about expectation it is often the case that one can discard a lot of information about the underlying distribution and drill directly down to the specific answer. – lulu Dec 31 '19 at 14:03
  • The only form of expectation I know is the sum of values multiplied by probability to get such values. According to this, I can rewrite your example with fair coin using geometric distribution. However your solution seems intuitively correct to me. But it confuses me because the expression you wrote doesn't have form of expectation in sense of its definition. I could only understand it, if you define your random variable as the following: $$ X = \begin{cases} 1, ; p=0.5\ E[X], ; p=0.5 \end{cases} $$ which brings us back to a problem of self-referencing. – NewUser2020 Dec 31 '19 at 15:00
  • $E[X] + 1$ of course – NewUser2020 Dec 31 '19 at 15:06
  • You mean $E[X]$ equals those things? But $E[X]\neq E[X]+1$. That's the problem. Sure you can get around that by introducing a new variable with the same distribution, if you want. i don't find that helpful, but if it clarifies things for you, go for it. – lulu Dec 31 '19 at 15:14