Covariance and Correlations
Published in Fall, 2024
Click to show/hide proof
Since $X,Y$ are independent, so for any functions $h,g$, we have $$ \mathbb{E}\{ g(X)h(Y) \} = \mathbb{E}\{ g(X) \} \mathbb{E}\{ h(Y) \} $$ So we have $\mathbb{E}(XY) = \mathbb{E}(X)\mathbb{E}(Y)$, which finishes the proof.
The proofs are left as an exercise. One important remark is that we have
\[\mathbf{Var}\left( \sum_{i=1}^n X_i \right) = \sum_{i=1}^n \mathbf{Var}(X_i) + 2 \sum \sum_{i<j} \mathbf{Cov}(X_i,X_j).\]Click to show/hide proof
Suppose $X,Y$ have variances given by $\sigma_x^2, \sigma_y^2$ respectively, then on the one hand, $$ \begin{align*} 0 &\leq \mathbf{Var} \left( \frac{X}{\sigma_x} + \frac{Y}{\sigma_y} \right)\\ &= \frac{\mathbf{Var}(X)}{\sigma_x^2} + \frac{\mathbf{Var}(Y)}{\sigma_y^2} + \frac{2 \mathbf{Cov}(X,Y)}{\sigma_x \sigma_y} \\ & = 2[1 + \rho(X,Y)] \end{align*} $$ implying that $$ -1 \leq \rho(X,Y). $$ On the other hand, $$ \begin{align*} 0 &\leq \mathbf{Var} \left( \frac{X}{\sigma_x} - \frac{Y}{\sigma_y} \right)\\ &= \frac{\mathbf{Var}(X)}{\sigma_x^2} + \frac{\mathbf{Var}(Y)}{\sigma_y^2} -\frac{2 \mathbf{Cov}(X,Y)}{\sigma_x \sigma_y} \\ & = 2[1 - \rho(X,Y)] \end{align*} $$ implying that $$ \rho(X,Y) \leq 1. $$
The correlation coefficient is a measure of the degree of linearity between $X$ and $Y$. A value of $\rho(X,Y)$ near $+1$ or $-1$ indicates a high degree of linearity between $X$ and $Y$, whereas a value near $0$ indicates that such linearity is absent. A positive value of $\rho(X, Y)$ indicates that $Y$ tends to increase when $X$ does, whereas a negative value indicates that $Y$ tends to decrease when $X$ increases. If $\rho(X,Y) = 0$, then $X$ and $Y$ are said to be uncorrelated.
Click to show/hide solution
We have $$ \begin{align*} \mathbf{Cov}(X_i - \overline{X}, \overline{X}) &= \mathbf{Cov}(X_i, \overline{X}) - \mathbf{Cov}(\overline{X}, \overline{X}) \\ &= \mathbf{Cov} \left( X_i, \frac{1}{n} \sum_{j=1}^n X_j \right) - \mathbf{Var}(\overline{X}) \\ & = \frac{1}{n} \sum_{j=1}^n \mathbf{Cov}(X_i,X_j) - \frac{\sigma^2}{n}\\ & = \frac{\sigma^2}{n} - \frac{\sigma^2}{n} \\ &=0. \end{align*} $$
Click to show/hide proof
If we denote $\mu_X = \mathbb{E} X, \mu_Y = \mathbb{E} Y$, then we have $$ \mathbb{E} X' = a\mathbb{E} X + b = a \mu_X + b $$ $$ \mathbb{E} Y' = c\mathbb{E} Y + d = c \mu_Y + d $$ Also $$ \begin{align*} \mathbf{Var}(X') &= \mathbb{E}[(X - \mu_{X'})^2]\\ & = \mathbb{E}[ (aX + b - a\mu_X - b)^2] \\ & = \mathbb{E}[ a^2(X - \mu_X)^2] \\ & = a^2 \mathbb{E}[ (X - \mu_X)^2] = a^2 \sigma_X. \end{align*} $$ Likewise, we have $$ \mathbf{Var}(Y') = c^2 \sigma_Y. $$ So $$ \begin{align*} \rho(X',Y') & = \frac{\mathbf{Cov}(X',Y')}{\sigma_{X'} \sigma_{Y'}}\\ & = \frac{\mathbb{E}[(X' - \mu_{X'})(Y' - \mu_{Y'})]}{\sigma_{X'} \sigma_{Y'}} \\ & = \frac{ac \mathbf{Cov}(X,Y)}{\sigma_{X'} \sigma_{Y'}}\\ & = \frac{ac\mathbf{Cov}(X,Y)}{(a\sigma_X)(c\sigma_Y)} \\ & = \rho(X,Y). \end{align*} $$
It shows that shifting and re-scaling of random variables does not change the correlation.
Click to show/hide solution
Number those $N$ people from $1$ to $N$, let $X_i$ be the random variable defined as $$ X_i = \begin{cases} 1:\text{if the person receives the present} \\ 0: \text{otherwise} \end{cases} $$ then clearly $X = X_1+X_2+\cdots+X_n$. And observe that $\mathbb{P}(X_i = 1) = 0.25$, this is because all possible outcomes of that person and his/her neighbors are: $$ HHH,TTT,HTT,HHT,HTH,THH,THT,TTH $$ and then by linearity we have $$ \mathbb{E} X = \mathbb{E} X_1 + \cdots +\mathbb{E} X_n = \frac{N}{4}. $$ The variance is left as an exercise.
Click to show/hide proof
This follows from the fact that $$ \vert a + b \vert^r \leq C_r [ \vert a \vert^r + \vert b \vert^r ]. $$
Recommended citation: Jiajun Zhang, (2024) Covariance and Correlations
