Can covariance be negative

covarianceprobabilityprobability theoryvariance

So I always thought that covariance could take any real number. However, in class today my professor gave us a problem where we were supposed to find the covariance, $q$

$$0 = q^2 – 2q – 3 = (q – 3)(q + 1)$$
$$q = 3 \text{ or } q = -1$$

He then said that we should reject the negative case since covariance always needs to be non-negative.

In this case, the covariance is a scalar.

I know that the covariance matrix needs to be positive, semi-definite and that the elements along the diagonal of that matrix needs to be non-negative(since they're variances). So, since we have a scalar covariance does that mean it necessarily needs to be non-negative?

Looking online, people mention that a negative covariance means that a greater value in one variable leads to lesser values in the other, so I'm guessing that covariance is allowed to be negative even in the scalar case?

Best Answer

Covariance $\mathrm{Cov}(X, Y)=E\left[(X-E[X])(Y-E[Y])\right]$ is clearly linear in $X$ and $Y$. Therefore, if $\mathrm{Var}[X]$ exists and is positive then

$$ \mathrm{Cov}(X, -X) = -\mathrm{Cov}(X, X) = -\mathrm{Var}[X] < 0. $$

However, the variance $\mathrm{Var}[X]=\mathrm{Cov}(X, X)$ cannot be negative.

Related Question