How can I compute $$cov(\sum^N a_k,\sum^{N'}a_k)$$ where $N$, $N'$ are random dependent variables and $a_k$ iid random variables , as a function of (but not necessarily) cov(N,N'), $var(N)$, $var(N')$, $var(a_k)$ and all of their expectation value ?

$N$ and $N'$ are bounded and positive.

My best shot :

\begin{equation} \begin{split} cov(X,Y)&=cov(\sum^Na_k,\sum^{N'}a_k)\\ &=cov(\sum\mathbb{1}_{k<N}a_k,\sum\mathbb{1}_{k<N'}a_k)\\ &=cov(\sum\mathbb{1}_{k<N}a_k,\sum\mathbb{1}_{k<N'}a_k)\\ &=\sum\sum cov(\mathbb{1}_{k<N}a_k,\mathbb{1}_{k'<N'}a_{k'})\\ &=\sum\sum \mathbb{1}_{k<N\cap k'<N'}cov(a_k,a_{k'})\\ &=\sum \mathbb{1}_{k<\min(N,N')}var (a_k)\\ &=\min(N,N')var(a) \end{split} \end{equation}

Feels wrong, is the 4th step right ? I use bilinearity on infinite sums, moreover if $N$ and $N'$ were constants the same method would have worked so...

Thank you

  • 2
    $\begingroup$ So the number of summands is random? In any case, you might want to take advantage of the fact (or better yet, prove to yourself) that the covariance is a bilinear map. $\endgroup$
    – Galen
    Commented Nov 6, 2021 at 17:19
  • $\begingroup$ the number of summand is random, yes. Because that is the case, I do not believe I can use bilinearity straightforwardly as is usually done @Galen $\endgroup$
    – DarkBulle
    Commented Nov 6, 2021 at 17:33
  • 1
    $\begingroup$ N and N' are finite and strictly positive, it's $\sum^n_i\sum^{n'}_j a_i b_j$ $\endgroup$
    – DarkBulle
    Commented Nov 6, 2021 at 17:43
  • 1
    $\begingroup$ Yes they are independent $\endgroup$
    – DarkBulle
    Commented Nov 6, 2021 at 18:03
  • 1
    $\begingroup$ Your idea looks sound, but you made a mistake with the fifth equal sign: when you take the indicator functions out of the covariance, the result is suddenly random (since $N$ and $N'$ are random). This cannot be right, since the left-hand side is not random. $\endgroup$
    – jochen
    Commented Nov 7, 2021 at 10:53

1 Answer 1


Law of total covariance (wiki) helps here. What you found is when $N$ and $N'$ are given:


$$\mathbb E[X|N,N']=N\mathbb E[a], \ \ E[Y|N,N']=N'\mathbb E[a]$$

Plugging in gives us: $$\operatorname{cov}(X,Y)=\operatorname{var}(a)\mathbb E[\min(N,N')]+\mathbb E[a]^2\operatorname{cov}(N,N')$$

I'm not sure how you can simplify the expected value of the minimum.

  • 1
    $\begingroup$ Thanks @gunes, i found the same thing but 3 hours too late ! $\endgroup$
    – DarkBulle
    Commented Nov 7, 2021 at 0:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.