Esta lección aún no está traducida. Por ahora se muestra en inglés; la versión en español está en camino.
Do $X$ and $Y$ tend to be large together, or does one tend to be large when the other is small? Covariance measures that tendency, using the variance shortcut idea. It is computed from a joint distribution, and scaled, it becomes the correlation $\rho$.
🔑 Idea clave
$$\operatorname{Cov}(X, Y) = E[(X - \mu_X)(Y - \mu_Y)] = E[XY] - E[X]E[Y], \qquad \rho = \frac{\operatorname{Cov}(X, Y)}{\sigma_X\sigma_Y},$$ with $-1 \le \rho \le 1$. Independent variables have covariance 0, but covariance 0 does not imply independence.
💡 Por qué funciona
$(X - \mu_X)(Y - \mu_Y)$ is positive when both are above (or both below) their means, and negative when they are on opposite sides; its average measures the trend. Expanding and using linearity gives the shortcut. For $\lvert \rho \rvert \le 1$: let $U = \frac{X}{\sigma_X}$ and $V = \frac{Y}{\sigma_Y}$. Then $0 \le \operatorname{Var}(U + V) = 1 + 1 + 2\rho$ and $0 \le \operatorname{Var}(U - V) = 2 - 2\rho$, so $-1 \le \rho \le 1$. If $X$ and $Y$ are independent, $$E[XY] = \sum xy\,p_X(x)p_Y(y) = E[X]E[Y]$$ so the covariance is 0. The converse fails because covariance only sees straight-line trends.
X is minus 1, 0 or 1 with equal chances and Y is X squared. The signed products cancel, so the covariance is 0, yet Y is completely determined by X.
Worked examples
✏️ Ejemplo resuelto: From a table
$P(X = 0, Y = 0) = 0.4$, $P(X = 0, Y = 1) = 0.1$, $P(X = 1, Y = 0) = 0.2$, $P(X = 1, Y = 1) = 0.3$. Find $\operatorname{Cov}(X, Y)$ and $\rho$.
$E[X] = 0.5$, $E[Y] = 0.4$, and $E[XY] = P(X = 1, Y = 1) = 0.3$.
Respuesta: 0, although $Y$ depends on $X$ completely.
⚠️ Error común
Concluding independence from zero covariance. Covariance measures only a linear trend; a perfect curved relationship, as above, can have covariance 0. Check: independence needs every cell (or the density everywhere) to factor; covariance 0 is only a consequence of it.
Práctica
Apruebas con 3 respuestas correctas, las 2 últimas seguidas. Cada respuesta correcta da 3 XP.
MIT OpenCourseWare 18.05, Introduction to Probability and Statistics (Spring 2014), readings on covariance and correlation
Grinstead and Snell, Introduction to Probability (2nd revised edition, American Mathematical Society; free from Dartmouth College), chapter 6 (Expected Value and Variance), section 6.2