a repository of mathematical know-how

To compute covariance, use bilinearity

Quick description

Computing the covariance of two random variables


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 X+Y and X-Y. The covariance of two random variables U and V is defined to be \mathbb{E}(U-\mathbb{E}U)(V-\mathbb{E}V). 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 [X,X] and [Y,Y] are equal to 1 since they are VarX and VarY.)

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.