Probability of heads and tails are $\frac{1}{17}$ and $\frac{16}{17}$ . Find expected number of flips so that at least one head and one tail turns up

combinatoricsexpected valueprobability

QUESTION: An unfair coin lands heads with probability $\frac{1}{17}$ and tails with probability $\frac{16}{17}$ . Matt flips the coin repeatedly until he flips at least one head and at least one tail. What is the expected number of times that Matt flips the coin?


MY ANSWER: Assume that $E_h$ is the expected number of moves left after a head turns up and $E_t$ is the expected number of moves left after a tail turns up.. If $E$ denotes the total number of turns Matt has to toss, we can set up relations like –
$$$$
$E=$ $\big($a head turns up$\big)$and$\big($number of moves left until a tail turns up$\big)$ OR $\big($a tail turns up$\big)$and$\big($number of moves left until a head turns up$\big)$
$$\implies E=\frac{1}{17}E_t+\frac{16}{17}E_h$$
Similarly, $E_t=$ if head turns up then sequence is over (since according to our assumption the previous flip was a tail) OR if tail turns up then we start over again..
$$\implies E_t=\frac{1}{17}+\frac{16}{17}E_t$$
Just like this $E_h=$ if a tail turns up then the sequence is over (since the last flip was a head) OR if a head turns up, we start over again..
$$\implies E_h=\frac{16}{17}+\frac{1}{17}E_h$$
Solving the equations we get $E_h$ and $E_t$ both to be $1$.. Which yields $E$ to be $1$..
But this is clearly wrong! $$$$

I do not understand where is my reasoning wrong? I have presented my logic in clear words before you.. Can someone please correct me..

Also, is/are there different way/ways to solve this sum? If so, it will be very much helpful if you introduce me to it/them.. Thank You so much..

Best Answer

If $X$ is the number of tosses we still need to throw, we can condition on the first toss $T_1$:

$E(X) = 1 + E(\text{nr of tosses after } T_1 = t)P(T_1 = t) + E(\text{nr of tosses after } T_1 =h)P(T_1 = h)$, where the $1+$ is to account for the first throw.

$E (\text{nr of tosses after } T_1 = t)$ is just the expectation of a geometric distribution with success chance $P(h)=\frac{1}{17}$ so this is $17$.

Similarly $E (\text{nr of tosses after } T_1 = h)$ is just $\frac{17}{16}$.

So in total we get $$1+ 17\cdot \frac{16}{17} + \frac{17}{16} \cdot \frac{1}{17} = 17\frac{1}{16}$$