NOTICE: Citizendium is still being set up on its newer server, treat as a beta for now; please see here for more. |

Citizendium - a community developing a quality comprehensive compendium of knowledge, online and free. Click here to join and contribute—free |

CZ thanks our previous donors. Donate here. Treasurer's Financial Report -- Thanks to our content contributors. -- |

# Covariance/Citable Version

The **covariance** — usually denoted as **Cov** — is a statistical parameter used to compare
two real random variables on the same sample space (more precisely, the same probability space).

It is defined as the expectation (or mean value)
of the product of the deviations (from their respective mean values)
of the two variables.

The sign of the covariance indicates a linear trend between the two variables.

- If one variable increases (in the mean) with the other, then the covariance is positive.
- It is negative if one variable tends to decrease when the other increases.
- If it is 0 then there is no linear correlation between the two variables.

In particular, this is the case for stochastically independent variables. But the inverse is not true because there may still be other – nonlinear – dependencies.

The value of the covariance is scale-dependent and therefore does not show how strong the correlation is. For this purpose a normed version of the covariance is used — the correlation coefficient which is independent of scale.

## Formal definition

The covariance of two real random variables *X* and *Y*
with expectation (mean value)

is defined by

**Remark:**

If the two random variables are the same then
their covariance is equal to the variance of the single variable: Cov(*X*,*X*) = Var(*X*).

In a more general context of probability theory
the covariance is a second-order central moment
of the two-dimensional random variable (*X*,*Y*),
often denoted as μ_{11}.

## Finite data

For a finite set of data

the covariance is given by

or, using a convenient notation

introduced by Gauss, by

This is equivalent to taking the uniform distribution
where each item (*x*_{i},*y*_{i})
has probability 1/*n*.

## Unbiased estimate

The expectation of the covariance of a random sample —
taken from a probability distribution — depends on the size *n* of the sample
and is slightly smaller than the covariance of the distribution.

An unbiased estimate of the covariance is

**Remark:**

The distinction between the covariance of a sample and
the estimated covariance of the distribution
is not always clearly made.
This explains why one finds both formulae for the covariance
— that taking the mean with " 1 / *n* " and that with " 1 / (*n*-1) " instead.

## Properties

The covariance is

- (1) symmetric
- (2) bilinear
- (3) positive definite

because the following holds:

Since the covariance cannot distinguish between random variables *X*_{1} and *X*_{2} that have the same deviation,
(i.e., *X*_{1} − E(*X*_{1}) = *X*_{2} − E(*X*_{2}) holds almost surely)
it does not define an inner product for random variables, but only for random variables with mean 0 or, equivalently, for the deviations.