# Covariance Calculator

## Table of Content

Feedback

The covariance calculator computes the covariance of two discrete random variables, X and Y, and tells how two sets of data are related to each other. Our cov(x y) calculator also shows you fast and accurate results.

## What Is Covariance?

Covariance is the measurement of the relationship between two random variables, X and Y. It indicates how much the random variables can vary together.

The symbol for covariance is Cov(X, Y).

## Formula For Covariance:

The sample covariance calculator online computes sample covariance and population covariance between two changeable variables X and Y.

Population Covariance formula:

\begin{align} \sigma_{XY}=\sum_{i=1}^N\frac{(x_i-\mu_X)(y_i-\mu_Y)}{N}\end{align}

Where,

• \mu_x and the \mu_Y are the population means
• σX is the standard deviation (SD) of the X-variable
• σY is the standard deviation (SD) of the Y-variable

If X and Y are directly related, then σXY is positive. If X and Y are inversely related, then σXY is negative.

Sample Covariance Formula:

\begin{align} s_{XY} &=\frac{\sum_{i=1}^n(x_i-\bar{X})(y_i-\bar{Y})}{n-1}\end{align}

Where,

• Cov (X, Y) = covariance between X and Y
• \overline x \; and \; \overline y =\;mean\; of \; X \; and \;Y
• n indicates the number of values of the data set

Positive covariance values express a positive relationship, and negative covariance values indicate a negative relationship between two variables.

## How To Calculate Covariance?

Covariance statistics shows the tendency in the linear relationships between the variables. Let’s review an example to compute the sample covariance to clarify its concept!

### Example:

Let’s assume the data set in which the values of X and Y are:

X = 3, 4, 1, 5, 2
Y = 2, 6, 3, 4, 5

how to find covariance for the sample and population for these two data set variables?

#### Solution:

Mean X̅ = 3 + 4 + 1 + 5 + 2 / 5 = 3

Mean Ȳ = 2 + 6 + 3 + 4 + 5 / 5 = 4

The population covariance equation is:

\begin{align} \sigma_{XY}=\sum_{i=1}^N\frac{(x_i-\mu_X)(y_i-\mu_Y)}{N}\end{align}

Population Covariance = [(3-3) * (2-4)] + [(4-3) * (6-4)] + [(1-3) * (3-4)] + [(5-3) * (4-4)] + [(2-3) * (5-4)] / 5

= [(0) * (-2)] + [(1) * (2)] + [(-2) * (-1)] + [(2) * (0)] + [(-1) * (1)] / 5

= 3/5

= 0.6

Now we calculate sample covariance with the help of the covariance equation as follows.

\begin{align} s_{XY} &=\frac{\sum_{i=1}^n(x_i-\bar{X})(y_i-\bar{Y})}{n-1}\end{align}

Sample Covariance = [(3-3) * (2-4)] + [(4-3) * (6-4)] + [(1-3) * (3-4)] + [(5-3) * (4-4)] + [(2-3) * (5-4)] / 5-1

=  [(0) * (-2)] + [(1) * (2)] + [(-2) * (-1)] + [(2) * (0)] + [(-1) * (1)] / 4

= 3/4

= 0.75

Using the formula, we can determine whether the units increase or decrease. Covariance doesn't use the unit of measurement, so we cannot solidify the degree to which the variables are moving together.

## Working of Covariance Calculator:

Our online tool computes the statistical relationship between two equal data sets (x, y). You just have to follow the given steps.

Input:

• Choose the calculating option
• Enter the value of the dataset of X
• Enter the value of the dataset of Y
• Tap “calculate”

Output:

Our online covariance calculator with probability gives you the following outputs by putting the required data in the designated fields.

• Set X
• Set Y
• Number of samples
• Mean X̄
• Mean Ȳ
• Sample Covariance
• Population Covariance

## FAQs:

### What Is The Range of The Covariance?

The covariance value range from -∞ to +∞.

### What Is The Difference Between Covariance And Correlation?

Covariance is the measurement to sign out how two variables differ, and on the other side, correlation indicates how two variables are related. Correlation is the scaled version of the covariance.

### How Do We Compare Covariance With The Variance?

Both terms are used in statistical applications. Variance refers to how spread a set of data is around its mean value, while covariance is the measure of the directional relationship between two random variables.

### Can Covariance Be Negative?

Covariance may be positive or may be negative. A negative covariance reveals that there is an opposite relation between the variables. It means that one increase cause to decrease the other.

## References:

From the source Wikipedia: Covariance, Definition, Examples, Properties, Calculating the sample covariance, Generalizations, Numerical computation. ### Shaun Murphy

I'm graduated in biomedical and electrical engineering. Specialization in sports and medical topics but will gladly tackle everything you throw at him. He is a sailor, hiker, and motorcyclist in his free time.