## Sample Covariance between X and Y

Let `$(x_i, y_i), i=1,2, \cdots , n$`

be $n$ pairs of observations.

Covariance measures the simultaneous variability between the two variables. It indicates how the two variables are related. A positive value of covariance indicate that the two variables moves in the same direction, whereas a negative value of covariance indicate that the two variables moves on opposite direction.

## Formula

The sample covariance between $x$ and $y$ is denoted by $Cov(x,y)$ or $s_{xy}$ and is defined as

`$Cov(x,y) =s_{xy}=\dfrac{1}{n-1}\sum_{i=1}^{n} (x_i-\overline{x})(y_i-\overline{y})$`

OR

`$s_{xy} = \dfrac{1}{n-1}\bigg(\sum xy - \dfrac{(\sum x)(\sum y)}{n}\bigg)$`

where,

`$\overline{x} =\dfrac{1}{n}\sum_{i=1}^{n}x_i$`

sample mean of $x$,`$\overline{y}=\dfrac{1}{n}\sum_{i=1}^{n}y_i$`

sample mean of $y$

## Related Resources

Suggestions and comments will be appreciated.