[Math] Variance of number of heads in three flips of a coin selected from a set of fair and unfair coins

probability

We have $10$ coins, $2$ are two-tailed, $2$ are two-headed, the other $6$ are fair ones. We (randomly) pick a coin and we flip it $3$ times. Find the variance of the number of gotten heads.

My attempt:

$X$ – number of heads that we got

$\mathbb{P}\left(X=0\right)=\frac{2}{10}\cdot1\cdot1\cdot1 + \frac{6}{10}\cdot\frac{1}{2}\cdot\frac{1}{2}\cdot\frac{1}{2}$ – we picked two-tailed coin or fair one

$\mathbb{P}\left(X=1\right)=\frac{6}{10}\cdot\frac{1}{2}\cdot\frac{1}{2}\cdot\frac{1}{2}\cdot 3$ – we picked fair one and we have 3 possibilites: HHT, HTH, THH

$\mathbb{P}\left(X=2\right)=\frac{6}{10}\cdot{3\choose2}\cdot\left(\frac{1}{2}\right)^2\cdot\left(\frac{1}{2}\right)^1$ – again we picked fair one and we have to have 2 successes in 3 tries

$\mathbb{P}\left(X=3\right)=\frac{2}{10}\cdot1\cdot1\cdot1+\frac{6}{10}\cdot\left(\frac{1}{2}\right)^3$ – we can pick two-headed or fair one coin

And the rest is simple,

$\text{Var}X=\sum_{i=0}^3i^2\cdot\mathbb{P}\left(X=i\right)-\left(\sum_{i=0}^3i\cdot\mathbb{P}\left(X=i\right)\right)^2$

Is my solution correct?

Best Answer

That's one approach.   It is good.   Here's another,

We know $X\mid C \sim \mathcal{Bin}(3, C)$ and $\mathsf P(C=c)=\tfrac 15\mathbf 1_{c=0}+\tfrac 35\mathbf 1_{c=1/2}+\tfrac 15\mathbf 1_{c=1}$

So $\mathsf E(C)= \tfrac 1{2}$ and $\mathsf {Var}(C)=\tfrac 1{10}$ and $\mathsf E(C^2)=\frac 7{20}$

By the Law of Total Probability: $\mathsf E(X) \\ = \mathsf E(\mathsf E(X\mid C)) \\ = \mathsf E(3C) \\ = \frac 32$

Then by the Law of Total Variance: $\quad\mathsf {Var}(X) \\ = \mathsf{Var}(\mathsf E(X\mid C))+\mathsf E(\mathsf{Var}(X\mid C)) \\ = \mathsf {Var}(3C)+\mathsf E(3C(1-C)) \\ = \frac 9{10}+\frac 32-\frac {21}{20} \\ = \frac {27}{20}$