why does $\mathrm{Cov}(x, y) = \mathbb{E}[XY] - \mathbb{E}[X] \cdot \mathbb{E}[Y]$?

162 Views Asked by At

Found this on Wolfram MathWorld:

Covariance provides a measure of the strength of the correlation between two or more sets of random variates. The covariance for two random variates $X$ and $Y$, each with sample size $N$, is defined by the expectation value \begin{align}\operatorname{Cov}(X,Y) =&\; \mathbb E[(X-\mu_X)(Y-\mu_Y)] \tag1\\[2ex] =&\; \mathbb E[XY]-\mu_X\mu_Y .\tag2\end{align}

A link is probably better. http://mathworld.wolfram.com/Covariance.html. I'm looking for a proof of equation $(2)$ on that page.

3

There are 3 best solutions below

0
On BEST ANSWER

Call $\mu_X = \mathbb{E}[X]$ and $\mu_Y = \mathbb{E}[Y]$

\begin{eqnarray} {\rm Cov}(X, Y) &=& \mathbb{E}[(X - \mu_X)(Y - \mu_Y)] \\ &=& \mathbb{E}[X Y - \mu_Y X - \mu_X Y + \mu_X \mu_Y] \\ &=& \mathbb{E}[X Y] - \mathbb{E}[\mu_Y X] - \mathbb{E}[\mu_X Y] + \mathbb{E}[\mu_X \mu_Y] \\ &=& \mathbb{E}[X Y] -\mu_Y \mathbb{E}[X] - \mu_X\mathbb{E}[Y] + \mu_X \mu_Y \\ &=& \mathbb{E}[X Y] -\mu_Y \mu_X - \mu_X\mu_Y + \mu_X\mu_Y \\ &=& \mathbb{E}[X Y] -\mu_X \mu_Y \end{eqnarray}

0
On

Hint: Expand out the definition of covariance and use linearity of expectation.

0
On

The proof is not that hard actually. Let $X$ and $Y$ be any two random variables. By definition, we have: $$\text{Cov}(X,Y) = \mathbb{E}[(X - \mathbb{E}(X))(Y - \mathbb{E}(Y))]$$ But we can simply rewrite this and use the linearity of the expactation to obtain: \begin{align*} \text{Cov}(X,Y) &= \mathbb{E}[(X - \mathbb{E}(X))(Y - \mathbb{E}(Y))] \\ &= \mathbb{E}[XY - \mathbb{E}(X)Y - X\mathbb{E}(Y) + \mathbb{E}(X)\mathbb{E}(Y)] \\ &= \mathbb{E}(XY) - \mathbb{E}(X)\mathbb{E}(Y) - \mathbb{E}(X)\mathbb{E}(Y) + \mathbb{E}(X)\mathbb{E}(Y) \\ &= \mathbb{E}(XY) - \mathbb{E}(X)\mathbb{E}(Y) \end{align*}