[Math] We have two coins, A and B. For each toss of coin A, the probability of getting head is 1/2…

expected valueprobability

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?

Best Answer

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 tosses to get head first, $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.

Related Question