# Sample/Population Covariance Calculator

## Calculate sample/population covariance step by step

For the given two sets of values, the calculator will find the covariance between them (either sample or population), with steps shown.

Related calculator: Correlation Coefficient Calculator

### Your Input

**Find the sample covariance between $$$\left\{4, 6, 1, 2, 3\right\}$$$ and $$$\left\{1, 4, 5, 3, 2\right\}$$$.**

### Solution

The sample covariance of data is given by the formula $$$cov(x,y) = \frac{\sum_{i=1}^{n} \left(x_{i} - \mu_{x}\right)\cdot \left(y_{i} - \mu_{y}\right)}{n - 1}$$$, where $$$n$$$ is the number of values, $$$x_i, i=\overline{1..n}$$$ and $$$y_i, i=\overline{1..n}$$$ are the values themselves, $$$\mu_{x}$$$ is the mean of the x-values, and $$$\mu_{y}$$$ is the mean of the y-values.

The mean of the x-values is $$$\mu_{x} = \frac{16}{5}$$$ (for calculating it, see mean calculator).

The mean of the y-values is $$$\mu_{y} = 3$$$ (for calculating it, see mean calculator).

Since we have $$$n$$$ points, $$$n = 5$$$.

The sum of $$$\left(x_{i} - \mu_{x}\right)\cdot \left(y_{i} - \mu_{y}\right)$$$ is $$$\left(4 - \frac{16}{5}\right)\cdot \left(1 - 3\right) + \left(6 - \frac{16}{5}\right)\cdot \left(4 - 3\right) + \left(1 - \frac{16}{5}\right)\cdot \left(5 - 3\right) + \left(2 - \frac{16}{5}\right)\cdot \left(3 - 3\right) + \left(3 - \frac{16}{5}\right)\cdot \left(2 - 3\right) = -3.$$$

Thus, $$$cov(x,y) = \frac{\sum_{i=1}^{n} \left(x_{i} - \mu_{x}\right)\cdot \left(y_{i} - \mu_{y}\right)}{n - 1} = \frac{-3}{4} = - \frac{3}{4}$$$.

### Answer

**The sample covariance is $$$cov(x,y) = - \frac{3}{4} = -0.75$$$A.**