# Covariance between random variables

Analyzing math theory of random variables. Something fishy messes with my logic. Two questions:

1. When we have two random variables $$X$$ and $$Y$$, to get covariance $$Cov (X, Y)$$ is basically to get how the values of X and Y move relative to each other. Is this true?

2. Because each random variable may generate potentially infinite sets of values, how can we determine the covariance over the infinite sets?

Just to recall the definition I found:

$$Cov(X,Y)=\mathbb E\big[(X-\mathbb E[X])(Y-\mathbb E[Y])\big]=\mathbb E[XY]-(\mathbb E[X])(\mathbb E[Y])$$

Uses expected values to define the covariance. This looks OK.

## 1 Answer

1 - Not quite. The covariance (more specifically, the correlation coefficient), measures how much the variables "depend" on each other linearly. A great correlation coefficient shows us that one variable is "almost" a linear function of the other, I.e. there is $$a$$ and $$b$$ such that $$Y \approx aX+b$$. If two random variables are uncorrelated, that does not mean that here is no relation of dependence between them - just that this relation cannot be a linear one.

2 - Well, you just anwered this in your question: use the expectations! We can compute expectations of random variables even if they assume an uncountable number of values.

• We compute expectations based on pdf or pmf but we may also do directly in case the random variables generate finite sets. Is this true? – Easy Points Aug 19 '20 at 17:33
• We can. But note that what you call "direct computation" is just a special case of the general formula using the cdf. In this case, the probability mass function is non-zero only for a finite number of points, making the calculations easy.. – Célio Augusto Aug 19 '20 at 17:35
• Some distributions don't have the cdf so we must use "direct" approach, isn't it. – Easy Points Aug 19 '20 at 17:37
• Every distribution has a cdf. Maybe you are confunding it with the pmf or the pdf? – Célio Augusto Aug 19 '20 at 17:40
• Take a look at en.wikipedia.org/wiki/Cantor_distribution – Célio Augusto Mar 1 at 16:21