Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I read from a text book that covariance is $E((X - EX)(Y - EY))$. The book then states that this expression is equivalent to $E(XY) - E(X)E(Y)$. Where did the latter expression come from?

share|cite|improve this question
up vote 4 down vote accepted

$(X-EX)(Y-EY)=XY-(EY)X-(EX)Y+(EX)(EY)$, and expectation is linear, so

$$\begin{align*} E\big((X-EX)(Y-EY)\big)&=E(XY)-(EY)EX-(EX)EY+(EX)(EY)\\ &=E(XY)-(EX)(EY)\;. \end{align*}$$

If you get lost in all the expectations, let $\alpha=E(X)$ and $\beta=E(Y)$; then

$$(X-\alpha)(Y-\beta)=XY-\beta X-\alpha Y+\alpha\beta\;,$$ and

$$\begin{align*} E\big((X-\alpha)(Y-\beta)\big)&=E(XY)-\beta E(X)-\alpha E(Y)+\alpha\beta\\ &=E(XY)-\beta\alpha-\alpha\beta+\alpha\beta\\ &=E(XY)-\alpha\beta\\ &=E(XY)-E(X)E(Y)\;. \end{align*}$$

share|cite|improve this answer
Thanks, that makes sense overall. I also expanded out the factors, but I'm wondering why we can say that $E(E(Y)X) = EYEX$? – David Faux Nov 7 '12 at 23:46
@David: Because $E(Y)$ is a constant, the one that I called $\beta$, and $E$ is linear: $E(\beta X)=\beta E(X)$, just as with any linear function. – Brian M. Scott Nov 7 '12 at 23:48
Ah thank you! That makes sense! – David Faux Nov 7 '12 at 23:50
@David: You’re welcome. – Brian M. Scott Nov 7 '12 at 23:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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