### Quick description

Computing the covariance of two random variables

### Prerequisites

Definition of covariance, basic linear algebra

### Example 1

Suppose X and Y are independent random variables each equipped with the standard normal distribution, and you want to know the covariance of and . The covariance of two random variables and is defined to be . You might be tempted to work directly from this definition, but it is better to use the key mathematical property of covariance, namely that it is *bilinear*. Writing [ , ] for covariance, we have the following simple calculation.

Cov(X + Y, X - Y) = [X + Y, X - Y] = [X, X] - [X, Y] + [Y, X] - [Y, Y] = [X, X] - [Y, Y] = 1 - 1 = 0.

(The first cancellation is due to symmetry of inner products, and and are equal to since they are Var and Var.)

### General discussion

Because covariance is a bilinear operator on pairs of random variables (i.e. Cov(X, Y) is linear in both X and Y), one can use inner product notation and standard properties of inner products to compute the covariance of two random variables. (Strictly speaking, covariance is only an inner product when restricted to the set of random variables with finite second moment and expected value zero; if 'expected value zero' is dropped from the requirements, the fact that Cov(X, c) = 0 for c constant means that covariance is a positive SEMIdefinite symmetric bilinear form).

This trick is a special case of the more general advice not to start from scratch when proving something.

5 years 40 weeksago5 years 48 weeksago5 years 49 weeksago6 years 27 weeksago6 years 47 weeksago