Covariance measures the relationship between two random variables. Mathematics and Statistics form the core of covariance.

Matric performs as the most crucial tool to evaluate the extent to which a change in the variable is noticed. It is an essential measure of variance between two variables. However metric does not define the dependency on one another.

Covariance is different from correlating coefficient. It is measured in units of the two variables which are computed by multiplying. It serves us two different types of result. First one is positive covariance which indicates two variables moving together in the same direction. The latter one is negative covariance revealing two variables which tends to move in the opposite direction.

Covariance is the primary concept in the field of finance. One of its common applications is in diversification method followed in portfolio theory.

It is covariance that comes into action between the assets in a Portfolio. Moreover nullifying the undiversifiable risk becomes a major factor which explains why choosing the set of correct assets is necessary. The asset that does not show high positive covariance with each other proves to be beneficial.

## Formula Of Covariance

The covariance formula assists in calculating data points from the average value in a data set. It is also quite similar to the formula of correlation.

Let’s say for an example x and y are the two random variables given. Thus the covariance between the two can be calculated with the help of following formula.

Cov (x, y) = Cov(x,y) = SUM [(xi – xm) * (yi – ym)] / n

The formula get slightly adjusted for a sample covariance.

Cov(x,y) = SUM [(xi – xm) * (yi – ym)] / (n – 1)

A pair of x and y values, covariance can be calculated using five variables from that data. They are:

xi = x value in the data set

xm = average of the x values

yi = the y value in the data set that corresponds with xi

ym = mean of the y values

n = the number of data points

## Covariance Vs Correlation

Covariance and correlation both primary add the relationship of variables. The link between variance and standard deviation provides the closest analogy to the relation.

Covariance is the measure of the total variation of two random variables. Although covariance only gauges the relationship direction but fails to compute the relationship strength and its dependency between the variables.

To the contrary correlation gives a measure of relationship strength between the variables. It is a scaled measure of covariance. Correlation Coefficient always churns out a pure value and do not require a unit to measure, hence is a dimensionless quantity.

The following formula explains the relationship between two concepts

P(x, y) = Cov(x, y) /σx σy

Where:

ρ(X,Y) – correlation between the variables X and Y

Cov(X,Y) – covariance between the variables X and Y

σX – standard deviation of the X-variable

σY – standard deviation of the Y-variable

## Example Of Covariance

An Investor name John who’s portfolio primarily tracks down the performance of s and p 500 wants to annex the stocks of ABC Corporation. But before joining the stocks to his portfolio he wishes to assess the directional relationship between the stock and s and p 500.

John aims not to build up any unsystematic risk for his portfolio and thus is not interested in owning securities. He prefers to move in the same direction.

Following are the steps John follows to calculate the covariance between the stock of ABC corporation and the S&P 500.

He obtains the data first and then calculates the mean prices for each asset.

For his security purposes, he finds the difference between each value and means price.

Eventually, he multiplies the results obtained and with the help of the numbers calculated, find the covariance.

Hence a positive covariance is indicated in such a case resulting in the price of the stock and S&P 500 to move in the same direction.

## Covariance Calculator

Below we have attached the calculator for calculating covariance easily.