# Variance of two sets of independent bernoulli variables

Suppose $$X_1, \ldots, X_n$$ are independent Bernoulli variables with probability $$p_1, \ldots,p_n$$ and $$Y_1,\ldots,Y_n$$ is another set of independent Bernoulli variables with probability $$q_1,\ldots,q_n$$. ($$X_1, \ldots, X_n$$ and $$Y_1,\ldots,Y_n$$ are also independent)

Now, let $$\bar{X} = \frac{\sum_{i = 1}^n X_i}{n}$$ and $$\bar{Y} = \frac{\sum_{i = 1}^{n}Y_i}{n}$$

What I want to know is how to calculate $$Var(\bar{X}\cdot\bar{Y})$$

Not sure about how much we can simplify, just try to group the terms in a systematic way:

\begin{align} Var[\bar{X}\bar{Y}] &= Cov[\bar{X}\bar{Y},\bar{X}\bar{Y}] \\ &= Cov\left[\left(\frac {1} {n} \sum_{i=1}^n X_i\right) \left(\frac {1} {n} \sum_{j=1}^n Y_j\right), \left(\frac {1} {n} \sum_{k=1}^n X_k\right) \left(\frac {1} {n} \sum_{l=1}^n Y_l\right) \right] \\ &= \frac {1} {n^4} \sum_{i=1}^n\sum_{j=1}^n\sum_{k=1}^n\sum_{l=1}^n Cov[X_iY_j, X_kY_l] \end{align}

For $$i \neq k, j \neq l$$, by the mutual independence, $$Cov[X_iY_j, X_kY_l] = 0$$

For $$i = k, j \neq l$$, \begin{align} Cov[X_iY_j, X_kY_l] &= Cov[X_iY_j, X_iY_l] \\ &= E[(X_iY_j)(X_iY_l)] - E[X_iY_j]E[X_iY_l] \\ &= E[X_i^2Y_jY_l] - E[X_i]E[Y_j]E[X_i]E[Y_l] \\ &= E[X_i]E[Y_j]E[Y_l] - p_i^2q_jq_l \\ &= p_i(1 - p_i)q_jq_l \end{align}

Similarly, for $$i \neq k, j = l$$

$$Cov[X_iY_j, X_kY_l] = p_ip_kq_j(1 - q_j)$$

and for $$i = k, j = l$$

$$Cov[X_iY_j, X_kY_l] = p_iq_j(1 - p_iq_j)$$

So putting all these together,

\begin{align} Var[\bar{X}\bar{Y}] &= \frac {1} {n^4} \Bigg[ 2\sum_{i=1}^n \sum_{j=1}^{n-1} \sum_{l=j+1}^n p_i(1 - p_i)q_jq_l \\ &~~~~~~~~~~~~~ + 2\sum_{i=1}^{n-1} \sum_{k=i+1}^n \sum_{j=1}^n p_ip_kq_j(1 - q_j) \\ &~~~~~~~~~~~~~ + \sum_{i=1}^n \sum_{j=1}^n p_iq_j(1 - p_iq_j) \Bigg] \end{align}

• It helps, thank you for your help Nov 4, 2020 at 17:48
• Corrected error in the last term
– BGM
Nov 5, 2020 at 15:56