We have two coins, A and B. For each toss of coin A, the probability of getting head is 1/2 and for each toss of coin B, the probability of getting Heads is 1/3. All tosses of the same coin are independent. We select a coin at random and toss it till we get a head. The probability of selecting coin A is ¼ and coin B is 3/4. What is the expected number of tosses to get the first heads?

The above problem is taken from the website https://www.analyticsvidhya.com/blog/2017/04/40-questions-on-probability-for-all-aspiring-data-scientists/ question 11

My solution is either 1/(1/4*1/2 + 3/4*1/3)=8/3, including the success toss, or 5/3, not including the success toss. My understanding is that it is geometric distribution question.

But the solution provided is 2.75, with the following explanation: "If coin A is selected then the number of times the coin would be tossed for a guaranteed Heads is 2, similarly, for coin B it is 3. Thus the number of times would be Tosses = 2 * (1/4)[probability of selecting coin A] + 3*(3/4)[probability of selecting coin B] = 2.75"

Is the solution provided incorrect? Or am I missing something?


It is just the application of the Law of total Expectation.

$$E(X)=\sum_{i} E(X|A_i)\cdot P(A_i)$$

In your case the definitions are: $X:=$random variable for the number of heads, $A_1$: Coin with head probabilty equal to $\frac12$ is selected, $A_2$: Coin with head probabilty equal to $\frac13$ is selected.

Due to the geometric distribution (as you mentioned) $E(X|A_1)=\frac{1}{p_1}=2$ and $E(X|A_2)=\frac{1}{p_2}=3$. And $P(A_1)=\frac14,P(A_2)=\frac34$. Consequently we have

$$E(X)=E(X|A_1)\cdot P(A_1)+E(X|A_2)\cdot P(A_2)=\frac14\cdot 2+\frac34\cdot 3=\frac{11}{4}$$

I think you are already familiar to the Law of total probability. This has a similar structure as the Law of total expectation, but for probabilities:

$$P(A)=\sum_{i} P(A|B_i)\cdot P(B_i)$$

One may say that $E(X)$ is the weighted mean of the conditional expectations.


The provided answer of $2.75$ is correct. I wouldn't say that the explanation is great. The use of the word 'guaranteed' is misleading. It makes it sound like if the fair coin is selected there is a guarantee of getting a heads in $2$ tosses, which is, of course, not the case.

Your proposed solution tries to make a weighted average of geometric distributions into a geometric distribution, which it is not.

Here is an explanation for the correct answer of $2.75$:

If you were to repeat the experiment many times, about $\frac14$ of the time (when you got the fair coin), it would take an average of $2$ flips for heads; and $\frac34$ of the time it would take an average of $3$ flips. So in $n$ repetitions of the experiment, it would take about $\frac14 \cdot n \cdot 2 + \frac34\cdot n\cdot 3$ total flips. This works out to about $2.75$ flips per trial on average to get heads.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.