Two random coins from a hat, let $X$ be the number of heads after flipping the chosen coin $n$ times. Find the variance of $X$.

463 Views Asked by At

One of two identical-looking coins is picked from a hat randomly, where one coin has probability $p_1$ of Heads and the other has probability $p_2$ of Heads. Let $X$ be the number of Heads after flipping the chosen coin n times. Find the variance of $X$.

I not exactly sure how to represent this mathematically because there are variances from both coins. Can I just sum up the variances? That is,

$$Var(X) = \frac{1}{2} Var(X \mid C_1) + \frac{1}{2} Var(X \mid C_2)$$

Here $C_j$ is the event that coin $j$ is chosen where $j \in {1,2}$. And $X \mid C_j \sim Binom(n,p_j)$. This results in:

$$Var(X) = \frac{1}{2}(np_1(1-p_1)+np_2(1-p_2))$$

This is not the same as the solution, the solution is:

$$Var(X) = \frac{1}{2}(np_1(1-p_1)+np_2(1-p_2)) + \frac{1}{4}n^2(p_1-p_2)^2$$

Can anyone please explain why my method did not work? Seems like it's missing a $\frac{1}{4}n^2(p_1-p_2)^2$ term.

3

There are 3 best solutions below

3
On BEST ANSWER

We can write $X=UY_1+VY_2$ where $Y_i$ has binomial distribution with parameters $n,p_i$ and where $U$ has Bernoulli($\frac12$)-distribution and $U+V=1$.

This with independence of $U,Y_1,Y_2$.

Then to be worked out is:

$$\text{Var}X=\text{Var}\left(UY_{1}+VY_{2}\right)=\text{Var}\left(UY_{1}\right)+2\text{Cov}\left(UY_{1},VY_{2}\right)+\text{Var}\left(VY_{2}\right)$$

2
On

enter image description here

enter image description here

When you add the last step, you get

Variance$= \frac{1}{2}\left[np_1(1-p_1) + np_2(1-p_2)\right] + \frac{1}{4}n^2(p_1-p_2)^2$

1
On

You may also try this:

Let $\displaystyle C \sim \text{Bernoulli}\left(\frac {1} {2}\right)$ such that $X|C = 0 \sim \text{Binomial}(n, p_1)$ and $X|C = 1 \sim \text{Binomial}(n, p_2)$

$$ \begin{align} Var[X] & = E[Var[X|C]] + Var[E[X|C]] \\ & = E[(1-C)np_1(1-p_1) + Cnp_2(1 - p_2)] + Var[(1-C)np_1 + Cnp_2] \\ & = \frac {1} {2} np_1(1-p_1) + \frac {1} {2}np_2(1 - p_2) + Var[n(p_2 - p_1)C]\\ & = \frac {1} {2} np_1(1-p_1) + \frac {1} {2}np_2(1 - p_2) + \frac {1} {4} n^2(p_2 - p_1)^2\\ \end{align}$$

Essentially just a more compact way to present the above solutions.