How to show $\operatorname{Cov}(X,Y)=\sum_{x}(x-\mu_X)E(Y|X=x)f(X=x)$

42 Views Asked by At

I am trying to show $\operatorname{Cov}(X,Y)=\sum_{x}(X-\mu_X)\color{red}{E(Y|X=x)}f(X=x)\\$

My attempt

$$\operatorname{Cov}(X,Y)=\sum_{x}\sum_{y}(x-\mu_X)(y-\mu_Y)f(X=x,Y=y)\\ \operatorname{Cov}(X,Y)=\sum_{x}\sum_{y}(x-\mu_X)(y-\mu_Y)f(Y=y|X=x)f(X=x)\\ \operatorname{Cov}(X,Y)=\sum_{x}(x-\mu_X)\color{red}{\sum_{y}(y-\mu_Y)f(Y=y|X=x)}f(X=x) $$

Just compare the red part, how to eliminate the $\mu_Y$

Appreciate for your help.

1

There are 1 best solutions below

2
On

It's clearer to use expectation notation rather than the series form.

To start you off, first distribute:

$\qquad\begin{align}\mathsf {Cov}(X,Y)&=\mathsf E\bigl((X-\mu_X)(Y-\mu_Y)\bigr)\\&=\mathsf E\bigl((X-\mu_X)Y-(X-\mu_X)\mu_Y\bigr)\end{align}$

Next apply Linearity of Expectation and it should start to fall into place for you.