# How to work out Covariance ?

1. May 25, 2008

### laura_a

1. The problem statement, all variables and given/known data

I have a joint pdf f_{XY}(x,y) = (2+x+y)/8

and I have to find cov(x,y)
2. Relevant equations
Now I know the formula is cov(X,Y)=E((X-mu)(Y-v)) where E(X)=mu and E(Y)=v

Well I found that formula on wikipedia, but it doesn't make sense to me because if E(X)=mu then doesn't E(X-mu) equal zero?

Well thats my main problem, I dont know how to use the formula.

3. The attempt at a solution

I've worked out the distribution table to see if that would help

. . . . y
. . . -1___0___1
. -1 0, 1/8, 1/4 (X=-1) =3/8
x 0 1/8, 1/4, 3/8 (X=0) =3/4
. .1 1/4, 3/8, 1/2 (X=1)=1/18
(Y=-1) = 3/8 (Y=0)=3/4 (Y=1) = 1/1/8

Sorry its not in LaTex I couldn't remember how to start the code.

I've also worked out that the var(Y) = 1 if that is any help? I have an exam on this very soon and I really want to be able to get a hold of all the main concepts... thanks for any information

2. May 25, 2008

### DavidWhitbeck

$$cov(X,Y) = E[(X-\mu)(Y-\nu)] = E(X Y) - \mu \nu$$

You are right to say that $$E(X) = \mu, E(Y) = \nu$$ which is why the cross terms are gone, but...

since the pdf is not separable the variables are correlated and $$E(XY) \neq E(X) E(Y)$$ and your expression is non-zero.

You must evaluate the expectation values by integration. What is your domain? I ask that because it can't be over the whole space, because your pdf would be non-normalizable.

3. May 25, 2008

### DavidWhitbeck

The expectation value for a random variable, say for example $$X^3 Y^2$$, is given by

$$E(X^3 Y^2) = \int dx dy f(x,y) x^3 y^2$$ if your distribution is already normalized else it's given by

$$E(X^3 Y^2) = \frac{\int dx dy f(x,y) x^3 y^2}{\int dx dy f(x,y)}$$

4. May 26, 2008

### laura_a

The domain is -1 < x < 1 and -1 < y < 1

5. May 26, 2008

### exk

Out of curiosity, why would she need to normalize it? From what I understand normalizing would be done to find the correlation matrix.

Last edited: May 26, 2008
6. May 26, 2008

### DavidWhitbeck

Well the expectation value/mean/average wouldn't be uniquely defined otherwise. It has nothing to do with the correlation matrix, it has to do with the fact that $E(1) = \int f dA = P(\textup{entire domain}) = 1$. See, it's just one step from an axiom of probability theory.

7. May 26, 2008

### exk

Ah of course. I usually check that the pdf integrates to 1 over the domain (general case with classroom problems) and it slipped my mind that this may not be a case like that.