# Covariance

${\displaystyle Covariance(X,Y)=\operatorname {E} {{\big [}(X-\operatorname {E} [X])(Y-\operatorname {E} [Y]){\big ]}}}$
Where ${\displaystyle x_{i}}$ and ${\displaystyle y_{i}}$ are the realized values of X and Y in a sample of n observations and ${\displaystyle {\bar {x}}}$ and ${\displaystyle {\bar {y}}}$ are their respective means, the sample covariance is estimated as:
${\displaystyle Covariance(x,y)={\frac {1}{n-1}}\sum _{i=1}^{n}(x_{i}-{\bar {x}})(y_{i}-{\bar {y}})}$