Compute $\mathrm{Cov}(\sum_{i=1}^NX_i,\sum_{i=1}^NY_i)$ Let $X_1,X_2,\dots$ be i.i.d. Bernoulli random variables with parameter $\frac{1}{4}$. Let $Y_1,Y_2, \dots $ be another sequence of i.i.d. Bernoulli random variables with parameter $\frac{3}{4}$. And let $N$ be a geometric random variable with parameter $\frac{1}{2}$ (i.e., $\mathrm{P}(N = k) =\frac{1}{2^k},\, \forall\ k=1,2,\dots$). Assume the $X_i$’s, $Y_j$ ’s and $N$ are all independent. Compute $$\mathrm{Cov}(\sum_{i=1}^NX_i,\sum_{i=1}^NY_i).$$
Here $N$ is also an r.v. so I think I need to use conditional covariance. How can I solve this? 
Where to start? I am stuck in the first step?
 A: $Cov(\sum_{i=1}^NX_i,\sum_{i=1}^NY_i)=E(\sum_{i=1}^NX_i \sum_{i=1}^NY_i)-E(\sum_{i=1}^NX_i)E(\sum_{i=1}^NY_i)$
Define $S_N^X=\sum_{i=1}^NX_i$
Note that $E(S_N^X)=E(E(S_N^X|N))$
Now $E(S_N^X|N=n)=E(S_n^X|N=n)=E(\sum_{i=1}^nX_i|N=n)=E(\sum_{i=1}^nX_i)$[Due to independence of $N$ and $X_i$'s ]$=nE(X_1)$
So, $E(S_N^X)=E(N.E(X_1))=E(N)E(X_1)=2.\frac{1}{4}=\frac{1}{2}$ Similarly $E(S_N^Y)=\frac{3}{2}$
Again $E(\sum_{i=1}^NX_i \sum_{i=1}^NY_i)=E(S_N^XS_N^Y)=E(E(S_N^XS_N^Y)|N)$
Here $E(E(S_N^XS_N^Y)|N=n)=E(nX_1.nY_1)=n^2E(X_1)E(Y_1)$[Due to independence of $X_i$'s and $Y_i$'s]
So,$E(\sum_{i=1}^NX_i \sum_{i=1}^NY_i)=E(N^2E(X_1)E(Y_1))=6.\frac{1}{4}\frac{3}{4}=\frac{9}{8}$
So,$Cov(\sum_{i=1}^NX_i,\sum_{i=1}^NY_i)=\frac{9}{8}-\frac{1}{2}\frac{3}{2}=\frac{3}{8}$
A: Cov(∑X$_i$, ∑Y$_i$)=E(∑X$_i$ ∑Y$_i$)-E(∑X$_i$)E(∑Y$_i$)  where the sum is taken up to the random integer N.  To calculate this you do need to take the expectation with respect to the geometric distribution for N of the conditional expectation given N=n. Now conditioned on N=n ∑X$_i$ is binomial n, 1/4 and ∑Y$_i$ is binomial n, 3/4 So E(∑X$_i$|N=n)=E(∑Y$_i$|N=n)=3n/16. Now you need to compute E(∑X$_i$ ∑Y$_i$|N=n).
Suppose f(n) denotes the conditional covariance given N=n.  Then to get the unconditional covariance you would compute the following sum:
∑f(n)/2$^n$  where the sum runs from n=1 to ∞.
