5
$\begingroup$

I'm working with a problem from an old exam where one had to calculate the expected value and variance of the number of throws, let's call it $N$, before we get two tails in a row.

We also assume the coin to be fair, meaning the probability of getting head and tails is just as equal. For our sake, let's also form the events $T$ for flipping a tail, and $H$ for flipping a head.

In order to calculate the expected value, we need to find the pmf of our stochastic variable $N$. This can easily be done by first examining some base cases of $p(k):=P(N=k)$.

Furthermore, we have that $V_N \in \{2,3,\dots\}$.

For $N = 2$, $P(N=2) = P(T \cap T) = 1/4$ trivially. For $N = 3$, $P(N=3) = P(H \cap T \cap T) = 1/8$ also trivially.

From this we notice a pattern, before every ending $TT$ we have to place out a $H$, meaning this position is always determined.

For instance $N = 4$, we have that the last three letters are $HTT$, and for the first position, we have 2 choices, meaning $P(N=4) = 2 / 2^4 = 1/8$

So what about the case when $N = k$?

We already know that the last three letters are determined. Meaning we have a total of $2^{k-3}$ choices left to do. But from this, we have to subtract the number of $TT$ - "strings" that may arise in the rest of our $k-3$ positions.

However, from here, I struggle to find the number of combinations for which we don't get a $TT$ somewhere along the $k-3$ positions. I know that as soon as we get $T$, we must choose $H$, but as soon as we get $H$, we have $2$ choices to make. Maybe this is a better way of tackling the problem instead of the method I used above. Still, I don't really see how to cover all the cases, and I'd be glad if anyone could share these details.

Also, I'd be thankful if you didn't share a whole solution to the expected value and variance, since I'll try to solve it on my own.

Thanks.

$\endgroup$
2
  • $\begingroup$ Dear @Tanamas, can you add from which lecture this is? It is quite simple if Markov Chains are allowed. $\endgroup$ Commented Apr 2, 2022 at 14:57
  • $\begingroup$ @PeterKeller We haven't worked with Markov Chains yet, maybe that's why it's hard to solve :/ It's from an old exam so I can't really tell from what lecture it's from, all I saw was that it was about expected values which we started to work with this week and so I wanted to give it a try. $\endgroup$
    – Tanamas
    Commented Apr 2, 2022 at 15:00

2 Answers 2

4
$\begingroup$

Let $H_i, T_i$ being the events that you get a head/tail in the throw $i$. The idea is that every time you throw a head, all the throws up to that point are wasted and you start fresh (unless you throw two tails in a row, in which case you are done).

Then: $$E[N] = E[N|H_1]P(H_1)+E[N|T_1]P(T_1)=\frac{1}{2}\left(E[N]+1\right)+\frac{1}{2}E[N|T_1]$$

And: $$E[N|T_1]=E[N|T_1H_2]P(H_2)+E[N|T_1T_2]P(T_2)=\frac{1}{2}\left(E[N]+2\right)+\frac{1}{2}\cdot 2$$

Putting it all together:

$$E[N] = \frac{1}{2}\left(E[N]+1\right)+\frac{1}{4}\left(E[N]+4\right) = \frac{3}{4}E[N]+\frac{3}{2}$$

So $E[N]=6$

For variance, you need $E[N^2]$, which is calculated with the same idea.

$$E[N^2] = E[N^2|H_1]P(H_1)+E[N^2|T_1]P(T_1)=\frac{1}{2}E[(N+1)^2]+\frac{1}{2}E[N^2|T_1]\\=\frac{1}{2}E[N^2]+\frac{13}{2}+\frac{1}{2}E[N^2|T_1]$$

And:

$$E[N^2|T_1]=E[N^2|T_1H_2]P(H_2)+E[N^2|T_1T_2]P(T_2)=\frac{1}{2}\left(E[(N+2)^2]\right)+\frac{1}{2}\cdot 4\\ =\frac{1}{2}E[N^2]+16$$

I think you can finish it from here. You may use this simulation to check your answer.

$\endgroup$
1
  • $\begingroup$ Thank you. I checked the result through the simulation and it seemed to be the correct answer from the exam too (6). Seems good! $\endgroup$
    – Tanamas
    Commented Apr 3, 2022 at 18:24
1
$\begingroup$

EDIT: My previous idea is right, but not the execution. Indeed, see comments below, we that $\mathbb E(N)\geq 2$.

If we now condition on the last two flips after the initial two, we get $$\mathbb E(N)=2+\mathbb E(N|TT)\mathbb P(TT)+2\mathbb E(N|HT)\mathbb P(HT)+\mathbb E(N|HH)\mathbb P(HH)\\ =\frac14+\frac12(\mathbb E(N)+1)+\frac14(\mathbb E(N)+1)\\ \Leftrightarrow \mathbb E(N)=6$$

$\endgroup$
5
  • 1
    $\begingroup$ My feeling is that the assumption "you have not yet had two consecutive tails" biases the result of the last throw, so it is no longer 50-50... $\endgroup$
    – Momo
    Commented Apr 2, 2022 at 16:16
  • $\begingroup$ @Momo, it's a Bernoulli chain, what happened earlier is completely independent of what happens next. $\endgroup$ Commented Apr 3, 2022 at 15:07
  • 1
    $\begingroup$ Let's say that it's the third throw and you haven't had yet two consecutive tails. Then the valid outcomes for the first two throws are HH, HT, and TH (you cannot have TT). So for the second throw you have P(H)=2/3, P(T)=1/3... $\endgroup$
    – Momo
    Commented Apr 3, 2022 at 17:17
  • $\begingroup$ Thanks @PeterKeller. I think I almost get it. When you add +1 to $E[N]$, is that the same as thinking that the expected value increases by 1? $\endgroup$
    – Tanamas
    Commented Apr 3, 2022 at 18:09
  • 1
    $\begingroup$ Also, I just checked the result and $E(N) = 3/2$ through your equation doesn't seem as a resonable answer, since we'd expect at least 2 throws before we can get a TT. Or I'm thinking wrong? $\endgroup$
    – Tanamas
    Commented Apr 3, 2022 at 18:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .