# Expected number of tosses until showing differently from first result

What is the expected number of coin tosses (heads comes with probability 0.5) until we get a result which is different from the first toss?

My first intuition is 3: we need to toss once, and then we have a geometric distribution with expectation of 2.

But, there are 2 possible scenarios: one scenario is when the first toss is heads and the other scenario is when the first toss is tails. So, this might suggest that the expectation is less than 3.... A bit confusing...

PMF I got:

• What is the pmf that you have a result which is different from the first toss? Hint: Sum both cases. Dec 11, 2021 at 10:25
• @callculus42-I did that, and this is what I got.... but I would expect that we should get less than 3... No? What should I actually get? Dec 11, 2021 at 10:28
• Sorry, but what is your pmf? Dec 11, 2021 at 10:29
• It seems OK, if x is the total number of tosses. It's a weighted sum of conditional probabilities. According to the exercise it is $p=0.5$. Dec 11, 2021 at 10:37
• Yes, but only if $X$ is the total number of tosses. But I'm not sure if we have to regard the first toss. Dec 11, 2021 at 10:45

$$P(Y=y)=\left(\frac{1}{2} \right)^{y-1}$$

Where $$y=2,3,4\dots$$

This rv is $$Y=X+1$$ where $$X$$ is a geometric rv counting the trials before the first success.

Thus

$$\mathbb{E}[Y]=1/p+1=3$$

• I added my reasoning for the expectation (for p being the probability of getting a head). Does this makes sense? Dec 11, 2021 at 10:48

I've used the conditional probability for this question. I hope this point of view helps.

Let $$Y_k$$ the number of tosses until you get a result which is different from the first toss. And $$X_k$$ is the random variable for the first toss. $$k$$ is the index for tail ($$t$$) or head ($$h$$). I make a case decision:

a) The probability to get a head at the n-th toss, given a tail has been thrown at the first toss is $$P(Y_h=n|X_t=1)=p^{n-1}$$.

Then $$P(Y_h=n\cap X_t=1)=P(Y_h=n|X_t=1)\cdot P(X_t=1)=p^{n-1}\cdot (1-p)$$

b) The probability to get a tail at the n-th toss, given a head has been thrown at the first toss is $$P(Y_t=n|X_h=1)=(1-p)^{n-1}$$.

Then $$P(Y_t=n\cap X_h=1)=P(Y_t=n|X_h=1)\cdot P(X_h=1)=(1-p)^{n-1}\cdot p$$

Finally we have to sum the two probabilities. It confirms your result and indeed the expected value is $$3$$, if $$p=0.5$$.