Variance, covariance, and correlation are statistical measures for finding the relationship between data points in a dataset. If you are learning data science, you need to understand these terms. So if you want to learn more about variance, covariance, and correlation, this article is for you. In this article, I will explain the difference between Variance, Covariance and Correlation.

## Difference Between Variance Covariance and Correlation

#### Variance

Variance measures the spread between all data points in a dataset. It shows how far each data point is from the **mean** value. The formula for calculating the variance is:

**S2 = Σ(x – x̄)2 / n – 1**

In the above formula for calculating variance:

- S2 = variance
- Σ = sum of
- x = value of a data point
- x̄ = mean of all the data points
- n = total number of observations

#### Covariance

Covariance finds the direction of the relationship between two data points. It finds whether two data points are directly or inversely proportional. The formula for calculating the covariance is:

**Cov(x,y) = Σ(xi – x̄)(yi – ȳ) / n – 1**

In the above formula for calculating covariance:

- Cov(x, y) = covariance between x and y
- xi = value of x
- yi = value of y
- x = mean of x
- y = mean of y
- n = total number of values

#### Correlation

**Correlation** finds the relationship between the data points. It can find the direction of the relationship along with the degree of the relationship. It is often confused with covariance. Covariance only measures whether the two data points are directly or inversely related to each other, but correlation also measures the strength of the relationship between the data points. The formula for calculating the correlation is:

**r = Cov(x,y) / σx – σy**

In the above formula for calculating correlation:

- Cov(x,y) = covariance between x and y
- σx = standard deviation of x
- σy = standard deviation of y

### Summary

So below are some of the points about variance, covariance, and correlation that you should take away:

- Variance measures the spread between all data points in a dataset.
- Covariance finds whether two data points are directly or inversely proportional.
- Correlation finds the direction of the relationship along with the degree of the relationship.

I hope you liked this article on the difference between variance, covariance, and correlation. Feel free to ask valuable questions in the comments section below.