# What is the relationship between correlation and covariance?

Banking & FinanceFinance ManagementGrowth & Empowerment

#### Ethical Hacking & Cyber Security Online Training

36 Lectures 5 hours

#### Machine Learning & BIG Data Analytics: Microsoft AZURE

Best Seller

46 Lectures 3.5 hours

#### Advance Big Data Analytics using Hive & Sqoop

Best Seller

50 Lectures 4 hours

In simple words, both correlation and covariance show the relationship and the dependency between two variables.

• Covariance shows the direction of the path of the linear relationship between the variables while a function is applied to them.

• Correlation on the contrary measures both the power and direction of the linear relationship between two variables.

In simple terms, correlation is a function of the covariance. The fact that differentiates the two is that covariance values are not standardized while correlation values are. The correlation coefficient of two variables can be obtained by dividing the covariance values of these variables by the multiplication of the standard deviations of the given values.

Covariance is a quantitative calculation that shows the extent to which the deviation function of one variable from its mean matches the deviation of the other function from its mean. It is a mathematical relationship that is defined as −

$$\mathrm{Cov(X,Y) = E[(X − E[X])(Y − E[Y])]}$$

In the given equation above,

• If X and Y are both valued above their respective means, or if X and Y are both valued below their respective means, the expression inside the outer expectation will be positive.

• The term becomes negative if one value of the variables is above its mean and the other is below.

• The two random variables will have a positive correlation if this expression is positive on average. The equation can be rewritten as −

$$\mathrm{Cov(X,Y) = E[XY] − E[Y]E[X]}$$

Using this equation and using the fact that the product of two independent random variables is equal to the multiplication of the expectations, it is easily seen that if two random variables are independent, their covariance is 0.

The reverse is not always true in general − if the covariance value of two random variables is 0, they are not always independent!

So, we can write −

$$\mathrm{Cov(X,Y) = Cov(Y, X)}$$

$$\mathrm{Cov(X, X) = E[X 2 ] − E[X]E[X] = Var(X)}$$

$$\mathrm{Cov(aX + b,Y) = aCov(X,Y)}$$

Correlation between two random variables, given by ρ(X, Y) is the covariance of the two variables that is normalized by the variance of each variable. This normalization removes the units and normalizes the measure so that it is always in the range [0, 1] −

$$\mathrm{ρ(X, Y) = Cov(X, Y)\sqrt{Var(X) Var(Y)}}$$

When ρ(X, Y) = 0, If two variables are independent from each other, then their correlation will be 0.

Updated on 29-Sep-2021 06:11:45