Variance of number of heads

probabilityrandom variablesvariance

Given two coins with chance of heads $p=0.6$ for a coin $X$, and $p=0.7$ for a coin $Y$. Pick one coin uniformly at random. Toss the coin 10 times. Find the variance $Z$ of the number of heads. I am thinking of just using the definition of variance.

$E[Z]^2 = \sum_{n=0}^{10}\frac{n}{2}\left(\operatorname{nCr}\left(10,\ n\right)\cdot\left(\frac{6}{10}\right)^{n}\left(\frac{4}{10}\right)^{10-n}+\operatorname{nCr}\left(10,\ n\right)\cdot\left(\frac{7}{10}\right)^{n}\left(\frac{3}{10}\right)^{10-n}\right) = 42.25$
$E[Z^2] = \sum_{n=0}^{10}\frac{n^{2}}{2}\left(\operatorname{nCr}\left(10,\ n\right)\cdot\left(\frac{6}{10}\right)^{n}\left(\frac{4}{10}\right)^{10-n}+\operatorname{nCr}\left(10,\ n\right)\cdot\left(\frac{7}{10}\right)^{n}\left(\frac{3}{10}\right)^{10-n}\right) = 44.75$

$Var[Z] = 2.5$

But is there a faster, cleaner way without all this computation?

Best Answer

your calculations are correct!. To use a shortcut, observe that

Z probability function, using total probability theorem, is the following

$$\mathbb{P}[Z=z]=\frac{1}{2}\mathbb{P}[Z=z|p=0.6]+\frac{1}{2}\mathbb{P}[Z=z|p=0.7]$$

Now observe that the second simple moment for a binomial $B(n;p)=np(1-p)+(np)^2$

Thus the variance is

$$\mathbb{V}[Z]=\mathbb{E}[Z^2]-\mathbb{E}^2[Z]=0.5[(2.4+6^2)+(2.1+7^2)]-[0.5(6+7)]^2=2.5$$