# Covariance Formula

Covariance is one of the statistical measurement to know the relationship of the variance between the two variables. The Covariance indicates how two variables are related and also helps to know whether the two variables vary together or change together.

The Covariance is denoted as Cov(X,Y) and here is the formula.

$\LARGE Cov(X,Y)= \frac{\sum (x_{i}-\overline{x})(y_{i}-\overline{y})}{N}$

Here,
xi = data value of x
yi = data value of y
$\overline{x}$ = mean of x
$\overline{y}$ = mean of y
N = number of data values.

### Solved Examples

Question 1: The table below describes the rate of economic growth (xi) and the rate of return on the S&P 500 (yi). Using the covariance formula, determine whether economic growth and S&P 500 returns have a positive or inverse relationship. Before you compute the covariance, calculate the mean of x and y.

 Economic Growth % ($x_{i}$) S&P 500 Returns % ($y_{i}$) 2.1 8 2.5 12 4.0 14 3.6 10

x = 2.1, 2.5, 4.0, and 3.6 (economic growth)
y = 8, 12, 14, and 10 (S&P 500 returns)
Find $\overline{X}$ and $\overline{Y}$

Solution:
$\overline{X}=\frac{\sum x_{i}}{n}$
$\overline{X}=\frac{2.1+2.5+4+3.6}{4}$
$\overline{X}=\frac{12.2}{4}$
$\overline{X}=3.1$
$\overline{Y}=\frac{\sum x_{i}}{n}$
$\overline{Y}=\frac{8+12+14+10}{4}$
$\overline{Y}=\frac{44}{4}$
$\overline{Y}=11$

Now, $\overline{X}=3.1$ and $\overline{Y}=11$

Now, Substitute these values into the covariance formula to determine the relationship between economic growth and S&P 500 returns.

$Cov(X,Y)= \frac{\sum (x_{i}-\overline{x})(y_{i}-\overline{y})}{N}$

$Cov(X,Y)= \frac{(2.1-3.1)(8-11)}{4-1}$

$Cov(X,Y)= \frac{(-1)(-3)+(-0.6)(1)+(0.9)(3)}{3}$

$Cov(X,Y)= \frac{3+(-0.6)+2.7+(0.5)}{3}$

$Cov(X,Y)= \frac{4.6}{3}$

$Cov(X,Y)= 1.53$

 Related Formulas Coefficient of Determination Formula Compound Interest Formula Completing the Square Formula Cross Product Formula Central Angle of a Circle Formula Cosine Formula Centroid of a Trapezoid Formula Division Formula