A covariance matrix is a square matrix that represents that covariance between each pair of elements in a given multivariate random variable.

For a 2D random variable, the covariance matrix is

The off-diagonal entries are equal since . If and are uncorrelated, the off-diagonal entries of the covariance matrix are zero.

For a -dimensional random variable, the covariance matrix is given by

Properties

  1. The diagonal entries of the covariance matrix are the variances of the components of the multivariate random variable.
  1. Since the diagonal entries are all non-negative, the trace (sum of diagonal entries) is also non-negative:
  1. Since , the covariance matrix is symmetric:
  1. The covariance matrix is positive semidefinite. The matrix is called positive semidefinite if for any vector . The eigenvalues of are non-negative.

Covariance Matrix and Expectation

Assume a vector with elements:

The covariance matrix of the vector is

where is the mean of the random variable.