# Covariance Calculator

**Covariance Calculator** estimates the statistical relationship (linear dependence) between the two sets of population data X and Y.

## What is Covariance Calculator?

'Cuemath's Covariance Calculator' is an online tool that helps to calculate the covariance for a given data set. Cuemath's online Covariance Calculator helps you to calculate the covariance in a few seconds.

## How to Use Covariance Calculator?

Please follow the below steps to calculate the covariance:

**Step 1:**Enter the data set of x and y in the given input boxes.**Step 2:**Click on the**"Calculate"**button to calculate the covariance.**Step 3:**Click on the**"Reset"**button to clear the fields and enter the new data set values.

## How to Find Covariance Calculator?

Covariance indicates how much two random variables change together. There are two types of covariances: 1. sample covariance 2. population covariance.

**Sample covariance Cov(x,y) = ∑(x _{i} - x ) × (y_{i} - y)/ (N - 1)**

**Population covariance Cov(x,y) = ∑(x _{i} - x ) × (y_{i} - y)/ (N)**

Where x_{i} and y_{i }is individual values in the sample, and x and y are the mean or an average of the sample, N is the number of terms in the sample.

Note: The value of N in data set x and y should be equal.

The** mean **value** **or average of a given data is defined as the sum of all observations divided by the number of observations. The mean is calculated using the formula:

**Mean or Average = Sum of all observations / Number of all observations **

**Solved Example:**

Find covariance for following data set x = {2,5,6,8,9}, y = {4,3,7,5,6}

**Solution:**

Given data sets x = {2,5,6,8,9}, y = {4,3,7,5,6} and N = 5

Mean(x) = 2 + 5 + 6 + 8 + 9 / 5

= 30 / 5

= 6

Mean(y) = 4 + 3 +7 + 5 + 6 / 5

= 25 / 5

= 5

Sample covariance Cov(x,y) = ∑(x_{i} - x ) × (y_{i} - y)/ (N - 1)

= [(2 - 6)(4 - 5) + (5 - 6)(3 - 5) + (6 - 6)(7 - 5) + (8 - 6)(5 - 5) + (9 - 6)(6 - 5)] / 5 - 1

= 4 + 2 + 0 + 0 + 3 / 4

= 9 / 4

= 2.25

Population covariance Cov(x,y) = ∑(x_{i} - x ) × (y_{i} - y)/ (N)

= [(2 - 6)(4 - 5) + (5 - 6)(3 - 5) + (6 - 6)(7 - 5) + (8 - 6)(5 - 5) + (9 - 6)(6 - 5)] / 5

= 4 + 2 + 0 + 0 + 3 /

= 9 / 5

= 1.8

Similarly, you can use the calculator to find the covariance for the following:

- x = { 5, 6, 8, 11, 4, 6} and y = {1, 4, 3, 7, 9, 12}
- x = { 15, 6, 5, 1, 4, 16} and y = {11, 14, 3, 5, 2, 12}

visual curriculum