Whenever we need to find out the type of relationship between two variables/columns in a dataset. Co-variance concept comes into the picture. It is used to determine relationships between different random variables.

NO. | X | Y |

1. | x1 | y1 |

2. | x2 | y2 |

3. | x3 | y3 |

4. | x4 | y4 |

5. | x5 | y5 |

6. | x6 | y6 |

We can calculate the co-variance between X and Y using the below formula:

**cov (X, Y) = (1/N)* Sum ( (X _{i }– Mu_{x}) * (Y_{i} – Mu_{y}) )**

N – > Total Number of Data Points in the table

X_{i } -> i_{th} Data Point in column X in the table

Y_{i} -> i_{th} Data Point in column Y in the table

Mu_{x} -> Mean of the column X in the table

Mu_{y} -> Mean of the column Y in the table

**Sign of co-variance is indicative of the relationship between column X and Y. It’s value is not the indicative of strength between X and Y.**

If Cov (X, Y) > 0 i.e. sing of Cov(X, Y) is positive, it means as X increases Y also increases.

If Cov(X, Y) < 0 i.e. sign of Cov(X, Y) is negative, it means as X increase Y decreases.