Verification of Proof of Law of Total Covariance

82 Views Asked by At

If $X,Y,Z$ are 3 random variables, then prove that the following holds: $$\mathrm{Cov}(X,Y)=\mathbb{E}(\mathrm{Cov}(X,Y|Z))+\mathrm{Cov}(\mathbb{E}(X|Z),\mathbb{E}(Y|Z))$$

Would the following be a good proof?

I know that $\mathrm{Cov}(X,Y|Z)=\mathbb{E}(XY|Z)-\mathbb{E}(X|Z)\mathbb{E}(Y|Z)$. So taking expectations over $Z$, and using linearity, yields, $$\mathbb{E}(\mathrm{Cov}(X,Y|Z))=\mathbb{E}[\mathbb{E}(XY|Z)]-\mathbb{E}[\mathbb{E}(X|Z)\mathbb{E}(Y|Z)].$$

Also, using the definition of covariance gives that $$\mathrm{Cov}(\mathbb{E}(X|Z),\mathbb{E}(Y|Z))=\mathbb{E}[\mathbb{E}(X|Z)\mathbb{E}(Y|Z)]-\mathbb{E}[\mathbb{E}(X|Z)]\mathbb{E}[\mathbb{E}(Y|Z)].$$

So, adding the two equations gives $$\mathbb{E}(\mathrm{Cov}(X,Y|Z))+\mathrm{Cov}(\mathbb{E}(X|Z),\mathbb{E}(Y|Z))=\mathbb{E}[\mathbb{E}(XY|Z)]-\mathbb{E}[\mathbb{E}(X|Z)]\mathbb{E}[\mathbb{E}(Y|Z)].$$

Now by the Tower law, the RHS is $\mathrm{Cov}(X,Y)=\mathbb{E}(XY)-\mathbb{E}(X)\mathbb{E}(Y)$. Thus, we have that $$\mathrm{Cov}(X,Y)=\mathbb{E}(\mathrm{Cov}(X,Y|Z))+\mathrm{Cov}(\mathbb{E}(X|Z),\mathbb{E}(Y|Z)),$$ as required.