## Covariance

Covariance measures the degree of dependence between two random variables. The covariance of two random variables X and Y is defined as follows:

Cov(X, Y) = E(XY) − E(X) E(Y)

Various properties of covariance include:

- Cov(X, X) = Var(X)

- Cov(X, Y) = Cov(Y, X)

- Cov(aX, bY) = abCov(X, Y) for constants a and b

- Cov(X+a, Y+b) = Cov(X, Y) for constants a and b

Example:

Determine the covariance between two random variables X and Y representing the numbers on the top and bottom of a fair die respectively.

Solution:

Using the entries above:Using
the fact that top and bottom numbers of dice always equal seven, in
conjunction with the knowledge regarding a probability of 1/6 for each
possible outcome for a fair die, it follows that:

x | y | xy | Pr(X=x) and Pr(Y=y) |

1 | 6 | 6 | 1/6 |

2 | 5 | 10 | 1/6 |

3 | 4 | 12 | 1/6 |

4 | 3 | 12 | 1/6 |

5 | 2 | 10 | 1/6 |

6 | 1 | 6 | 1/6 |

E(X) = (1)(1/6) + (2)(1/6) + (3)(1/6) + (4)(1/6) + (5)(1/6) + (6)(1/6)

E(X) = (1 + 2 + 3+ 4 + 5 + 6)/6

E(X) = 21/6

E(X) = 7/2 = 3.5

E(Y) = (6)(1/6) + (5)(1/6) + (4)(1/6) + (3)(1/6) + (2)(1/6) + (1)(1/6)

E(Y) = (6 + 5 + 4+ 3 + 2 + 1)/6

E(Y) = 21/6

E(Y) = 7/2 = 3.5

E(XY) = (6)(1/6) + (10)(1/6) + (12)(1/6) + (12)(1/6) + (10)(1/6) + (6)(1/6)

E(XY) = (6 + 10 + 12 + 12 + 10 + 6)/6

E(XY) = 56/6

E(XY) = 28/3 = 9.3333

Employing Cov(X, Y) = E(XY) − E(X) E(Y):

Cov(X, Y) = 9.3333 − (3.5)(3.5)

Cov(X, Y) = 9.3333 − 12.25

Cov(X, Y) = −2.9167

Related Topic: