In statistics, covariance is a measure that tells us how two random variables vary together. If both variables tend to rise or fall at the same time, their covariance is positive. If one increases while the other decreases, it's negative.
Understanding covariance meaning helps us explore the strength and direction of a linear relationship between two variables.
Covariance describes the extent to which two random variables vary or move together. It’s not standardized, meaning its magnitude depends on the scale of the variables. The covariance of X and Y is given by:
Covariance and correlation both describe how two variables are related. However, they differ:
So, while correlation and covariance both indicate the direction of a relationship, only correlation indicates its strength.
Let’s break down the steps to find covariance between two variables:
Example 1: Let’s compute the covariance of X and Y with the following data:
Solution:
Step 1: Means
Step 2: Deviations and Products
Step 3: Average
The positive covariance indicates that X and Y increase together.
Example 2: Given: X = [1, 2, 3] Y = [4, 5, 6]
Solution:
Example 3: Given: X = [1, 2, 3] Y = [6, 4, 2]
Solution:
Negative covariance indicates inverse relationship.
Example 4: Given: X = [2, 4, 6, 8] Y = [5, 10, 15, 20]
Solution:
Step 1:
Strong positive linear relationship.
Example 5: Given: X = [1, 2, 3, 4], Y = [7, 7, 7, 7]
Solution:
Since Y is constant, and all deviations from the mean will be zero.
Covariance = 0 when one variable is constant ⇒ No linear relationship.
Example 6 : Given: Math Scores (X) = [80, 85, 90], Science Scores (Y) = [78, 82, 88]
Solution:
Step 1:
Strong positive covariance: students doing well in one subject also do well in the other.
Understanding covariance in statistics is essential in:
Covariance helps us grasp how two variables relate, even if it doesn’t tell us how strong that relation is.
(Session 2025 - 26)