Variance of number of heads

111 Views Asked by At

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?

2

There are 2 best solutions below

0
On 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$$

0
On

You can use the law of total variance. Let $C$ be a random variable which equals $0$ if coin $X$ is chosen and equals $1$ if coin $Y$ is chosen. Then $Z|C=0$ has the distribution Bin$(10,0.6)$ and $Z|C=1$ has the distribution Bin$(10,0.7)$. So the random variable $\mathbb{E}[Z|C]$ takes the values $10 \cdot 0.6 = 6$ and $10 \cdot 0.7 = 7$ with probability $1/2$ each, and the random variable $\operatorname{var}(Z|C)$ takes the values $10 \cdot 0.6 \cdot 0.4$ and $10 \cdot 0.7 \cdot 0.3$ with probability $1/2$ each.

Therefore we can calculate $$ \operatorname{var}(Z) = \mathbb{E}[\operatorname{var}(Z|C)] + \operatorname{var}(\mathbb{E}[Z|C]) = \frac12( 10 \cdot 0.6 \cdot 0.4 + 10 \cdot 0.7 \cdot 0.3) + \frac14 = 2.5 $$