Covariance Identity: $\operatorname{Cov}(X,Y) = E(\operatorname{Cov}(X,Y\mid Z)) + \operatorname{Cov}(E(X\mid Z),E(Y\mid Z))$

How can I show that:$$\DeclareMathOperator{\Cov}{Cov}$$

$$\Cov(X,Y) = E(\Cov(X,Y\mid Z)) + \Cov(E(X\mid Z),E(Y\mid Z))$$?

With $$X, Y$$ and $$Z\;$$ r.v with finite variances.

• If you want to try this yourself with a hint, search for 'This follows directly from the tower property' on this page isical.ac.in/~arnabc/prob1/condl.html – Anvit Jan 26 at 16:36

\begin{align}E[\DeclareMathOperator{\Cov}{Cov}\Cov[X,Y|Z]]&=E[E[XY|Z]-E[X|Z]E[Y|Z]]\\[2ex] &=E[E[XY|Z]]-E[E[X|Z]E[Y|Z]]\\[2ex] &=E[XY]-E[E[X|Z]E[Y|Z]] \end{align} Similarly, \begin{align} \Cov[E[X|Z],E[Y|Z]]&=E[E[X|Z]E[Y|Z]]-E[E[X|Z]]E[E[Y|Z]]\\[2ex] &=E[E[X|Z]E[Y|Z]]-E[X]E[Y]\\[2ex] \end{align}
Add the two results to get the desired result. This proof utilizes the tower property. A simple version of which is $$E[E[X|Y]]=E[X].$$ Here is the wikipage Tower Property