Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools


Covariance






Covariance: How Two Random Variables Are Related


In many probability settings, two numerical quantities are recorded from the same
experiment or observation. Describing each quantity on its own does not explain how
they behave in relation to one another.

Covariance is the concept used to describe this relationship. It focuses on how the
numerical values of two random variables compare across repeated observations, relative
to their typical levels.

This idea becomes essential whenever probability models involve more than one random
variable.

Key Terms

Covariance— Cov⁡(X,Y)=E[(X−μX)(Y−μY)]\operatorname{Cov}(X,Y) = E[(X-\mu_X)(Y-\mu_Y)]
Correlation Coefficient— ρXY\rho_{XY}, normalized covariance in [−1,1][-1,1]
Uncorrelated Random Variables— variables with Cov⁡(X,Y)=0\operatorname{Cov}(X,Y) = 0
Orthogonal Random Variables— variables with E[XY]=0E[XY] = 0
Variance— Cov⁡(X,X)=Var⁡(X)\operatorname{Cov}(X,X) = \operatorname{Var}(X)
Independent Random Variables— independence implies zero covariance, not vice versa

See All Probability Definitions →


From Single Random Variables to Pairs


Variance describes how a single random variable is distributed around its typical
value. It captures variability, but only for one quantity at a time.

In many applications, two quantities are observed together in each trial or
measurement. Treating them independently ignores how their values are related across
the same observations.

Covariance extends the idea of variability to pairs of random variables by focusing on
their joint behavior rather than on each variable in isolation.

What Covariance Describes


For each random variable, values fluctuate around an average level.
Covariance examines how the positions of two variables relative to their own averages
compare across the same observations.

If both variables tend to be above their averages at the same time, or below them at
the same time, the covariance reflects this alignment.
If one variable tends to be above its average while the other is below, the covariance
reflects an opposing pattern.

In this way, covariance summarizes the directional relationship between the deviations
of two random variable.

Formally, covariance is the average product of the two deviations from the means:

Covariance Definition
Cov⁡(X,Y)=E ⁣[(X−μX)(Y−μY)]\operatorname{Cov}(X, Y) = E\!\left[(X - \mu_X)(Y - \mu_Y)\right]
Learn more about this formula: Covariance Definition →

Twelve paired observations with dashed lines at the two means: most points sit above-and-above or below-and-below, so the covariance is positivexy12345671234567mean of xmean of yblue: deviations agreeamber: deviations disagreeMost deviations agree in sign, so the covariance is positive
Deviations that agree in sign

Twelve paired observations, with dashed lines at the mean of x and the mean of y. Each point’s deviation from the two means is either the same sign (both above or both below: blue) or opposite signs (amber). Covariance averages the products of the two deviations; here the blue points dominate, so the products are mostly positive and the covariance is positive: high x tends to come with high y.

If the amber points dominated instead, the covariance would be negative.

Interpreting the Sign of Covariance


The value of covariance indicates the direction of the relationship between two
random variables, not its strength.

A positive covariance means that higher-than-average values of one variable tend to
occur with higher-than-average values of the other.
A negative covariance means that higher-than-average values of one variable tend to
occur with lower-than-average values of the other.

A covariance close to zero indicates no consistent linear relationship in how the two
variables deviate from their averages.
The sign is the whole message: as the section says, covariance reports direction, not strength. Two of the pairs listed later on this page, height and weight and study time and exam score, tend to deviate the same way, so their covariance is positive. A pair that deviates in opposite ways, such as driving speed and the time a trip takes, has a negative covariance.
DownloadPNG2×PDF
Overview
Covariance averages the products of the two deviations from the means. Only its sign is read here: it reports the direction of the linear relationship, not its strength.
Cov⁡(X,Y)=E[(X−μX)(Y−μY)]\operatorname{Cov}(X, Y) = E[(X - \mu_X)(Y - \mu_Y)]
split by sign of Cov⁡(X,Y)\operatorname{Cov}(X, Y)
One number computed from paired observations. Its sign is read in three ways; its size on its own is not the message.
+
Case 01
Cov⁡>0\operatorname{Cov} > 0
Deviations move the same way
the mean product of deviations is positive
higher-than-average XX tends to come with higher-than-average YY, and lower with lower
products (X−μX)(Y−μY)(X - \mu_X)(Y - \mu_Y) are mostly >0> 0
e.g.height and weight across people
−
Case 02
Cov⁡<0\operatorname{Cov} < 0
Deviations move opposite ways
the mean product of deviations is negative
higher-than-average XX tends to come with lower-than-average YY
products (X−μX)(Y−μY)(X - \mu_X)(Y - \mu_Y) are mostly <0< 0
e.g.driving speed and trip time
0
Case 03
Cov⁡=0\operatorname{Cov} = 0
No consistent linear relationship
the mean product of deviations is zero
the deviations show no steady direction; this does not mean the variables are independent
the products cancel out
e.g.Y=X2Y = X^2 with XX symmetric about 00: YY is fixed by XX, yet the covariance is 00
Takeaway
To compare strength across different pairs, divide by σXσY\sigma_X \sigma_Y: the correlation ρXY\rho_{XY} strips the units away and always lies in [−1,1][-1, 1].
What the sign of the covariance says·/probability/covarianceLearn Math Class
The third card is the one to read twice. A covariance of zero rules out a consistent linear tendency and nothing more; the next section shows that two variables can depend on each other completely and still have covariance exactly zero.

Covariance and Independence


THEOREM
If two random variables are independent, their joint behavior separates into two
unrelated components. As a result, their covariance evaluates to zero.

The converse does not hold. A covariance value of zero does not rule out dependence.
Two variables may exhibit structured relationships that covariance does not capture.

Covariance therefore reflects only one limited aspect of how random variables may be
related.
X takes -2, -1, 0, 1, 2 equally and Y = X^2: Y is fixed by X, yet Cov(X, Y) = 0xy−3−2−11234512345Y = X²: dependentyet Cov(X, Y) = 0the halves cancelZero covariance yet total dependence: only linear trends count
Dependent, with zero covariance

Let X take the values −2, −1, 0, 1, 2 with equal probability and set Y = X². Knowing X fixes Y completely. Yet the points on the left of the parabola mirror those on the right: every positive product of deviations is matched by a negative one, so Cov(X, Y) = E[X³] − E[X]E[X²] = 0. Covariance measures linear tendency only, and a symmetric curve has none.

So independence implies zero covariance, but zero covariance does not imply independence.

Why Covariance Is Important


Covariance provides a way to describe how two random variables are related beyond their
individual behavior. It captures information that variance alone cannot express.

This concept plays a central role in many areas of probability and statistics, including
the study of joint distributions, linear relationships, and multivariate models.
It is also a key component in formulas involving sums of random variables.

Understanding covariance is essential before introducing correlation, covariance
matrices, and more advanced multivariate concepts.

Common Examples of Covariance


Covariance arises whenever two numerical quantities are recorded from the same set of
observations.

Examples include pairs such as height and weight, study time and exam score, daily
temperature and energy usage, or returns of two financial assets.
In each case, the interest is not only in the individual values, but in how the two
quantities are related across the same observations.

These situations motivate the use of covariance as a basic descriptive tool for joint
behavior.

Covariance Notation

Notation

Covariance Notation

A two-argument operator, its subscripted Greek shorthand, and the normalized cousin that strips the units away. All are catalogued among the probability symbols.
XX, YY and the expectation E[⋅]E[\cdot] come from the probability function and expected value notation; σ2\sigma^2, σ\sigma and μ\mu from variance notation.
Cov⁡(X,Y)\operatorname{Cov}(X, Y)
the covariance of X and Y
A two-argument operator: it consumes a pair of random variables and returns one number measuring how they move together — E[(X−μX)(Y−μY)]E[(X - \mu_X)(Y - \mu_Y)]. Print sets the name upright, like Var⁡\operatorname{Var} and EE.
CasesThe arguments commute — Cov⁡(X,Y)=Cov⁡(Y,X)\operatorname{Cov}(X,Y) = \operatorname{Cov}(Y,X) — and feeding the same variable twice collapses it to variance: Cov⁡(X,X)=Var⁡(X)\operatorname{Cov}(X,X) = \operatorname{Var}(X), which is why the two operators share a family.
Do not confuseA statement about dependence. Cov⁡(X,Y)=0\operatorname{Cov}(X,Y) = 0 means uncorrelated, not independent — the two coincide only in special cases, as Covariance and Independence above explains; independence forces zero covariance, never the reverse.
σXY\sigma_{XY}
sigma X Y — the covariance
The parameter-side spelling, matching the σ2\sigma^2 of variance: a double subscript names the pair. With this convention σXX\sigma_{XX} is just σX2\sigma_X^2, and the whole family collects into a covariance matrix.
CasesMatrix work makes the subscripts indices — σij\sigma_{ij} for the covariance of the ii-th and jj-th variables — the coordinate-slot subscript job applied to a pair rather than a position.
Do not confuseA product of sigmas. σXY\sigma_{XY} is one symbol with a two-letter subscript, not σX⋅σY\sigma_X \cdot \sigma_Y — that product appears in the denominator of the correlation below, which is a different quantity entirely.
ρXY\rho_{XY}
rho — the correlation coefficient
Covariance with the units divided out: ρ=Cov⁡(X,Y)σXσY\rho = \dfrac{\operatorname{Cov}(X,Y)}{\sigma_X \sigma_Y}, which forces the value into [−1,1][-1, 1] and makes different variable pairs comparable — something raw covariance, carrying the product of two units, can never be.
Also writtenCorr⁡(X,Y)\operatorname{Corr}(X,Y) — the spelled-out operator, preferred where ρ\rho is already taken; sample estimates switch to Latin rr, following the population-versus-estimate convention that pairs μ\mu with xˉ\bar{x}.
Do not confuseA measure of any relationship. ρ\rho detects linear association only — a perfect parabola can have ρ=0\rho = 0 while the variables determine each other completely; the sign carries direction, the magnitude carries linear strength, and neither carries causation.

Three identities describe how covariance is computed and how it behaves:

Covariance Computational Formula
Cov⁡(X,Y)=E[XY]−E[X] E[Y]\operatorname{Cov}(X, Y) = E[XY] - E[X]\,E[Y]
Learn more about this formula: Covariance Computational Formula →

Covariance Self-Identity
Cov⁡(X,X)=Var⁡(X)\operatorname{Cov}(X, X) = \operatorname{Var}(X)
Learn more about this formula: Covariance Self-Identity →

Covariance Bilinearity
Cov⁡(aX+b,  cY+d)=ac Cov⁡(X,Y)\operatorname{Cov}(aX + b,\; cY + d) = ac\,\operatorname{Cov}(X, Y)
Learn more about this formula: Covariance Bilinearity →


What Comes Next


Covariance serves as the foundation for more structured ways of describing relationships
between multiple random variables.

It leads directly to correlation, covariance matrices, and the study of joint
distributions. These tools extend the ideas introduced here to broader multivariate
settings and applications.

Correlation rescales covariance by the two standard deviations, and its value always stays within a fixed range:

Correlation Coefficient Definition
ρXY=Cov⁡(X,Y)σX σY\rho_{XY} = \frac{\operatorname{Cov}(X, Y)}{\sigma_X\,\sigma_Y}
Learn more about this formula: Correlation Coefficient Definition →

Correlation Bounds
−1≤ρXY≤1-1 \leq \rho_{XY} \leq 1
Learn more about this formula: Correlation Bounds →


Covariance at a Glance

The table below collects covariance into a single reference card — its definition, the symmetry and self-covariance identities, the sign interpretation (positive, negative, zero), the one-way relationship with independence, what covariance does and does not capture, common examples of paired quantities, and the concepts it leads into.
Aspect Statement Note / example
Definition Cov(X, Y) = E[(X − μX)(Y − μY)] extends variance from one variable to a pair
Symmetry Cov(X, Y) = Cov(Y, X) order of the variables doesn't matter
Self-covariance Cov(X, X) = Var(X) pairing a variable with itself recovers its variance
Positive covariance Cov(X, Y) > 0 both variables tend to be above (or below) their averages together
Negative covariance Cov(X, Y) < 0 one variable above its average tends to occur with the other below its average
Zero covariance Cov(X, Y) = 0 no consistent linear relationship — non-linear dependence may still exist
Independence X, Y independent ⟹ Cov(X, Y) = 0 the converse does not hold — zero covariance ≠ independence
What it captures direction (not strength) of the linear relationship magnitude depends on the units; normalize via correlation ρ for scale-free strength
Typical examples height & weight; study time & exam score; temperature & energy use; returns of two assets paired numerical quantities recorded from the same observations
Leads to correlation coefficient ρ; covariance matrices; joint distributions basis for multivariate models, linear regression, and portfolio theory

Covariance FAQ

Does zero covariance mean independence?

+
No — the implication runs one way only. Independence forces covariance to zero, but zero covariance does not force independence. Covariance detects linear association, so a relationship with no linear component slips past it: for a perfect parabola the variables determine each other completely, yet the covariance can be exactly zero. Zero covariance means uncorrelated, which is strictly weaker.Read more →

What is the difference between covariance and correlation?

+
Units. Covariance carries the product of both variables' units, so its size means nothing on its own — you cannot tell a large covariance from a small one without knowing the scales. Correlation divides that out, forcing the value into [−1, 1] and making different pairs comparable. Both detect linear association only, and neither carries causation.Read more →

Why does Cov(X, X) equal the variance?

+
Because feeding the same variable into both slots reproduces the variance definition. Cov(X, Y) is E[(X − μ_X)(Y − μ_Y)]; set Y = X and the two factors become identical, giving E[(X − μ_X)²], which is Var(X). Variance is the special case of covariance where a variable is paired with itself, which is why the two operators share a family.Read more →

Is σ_XY the same as σ_X times σ_Y?

+
No. σ_XY is a single symbol with a two-letter subscript naming a pair — it is the covariance, not a product. The product σ_X σ_Y is a different quantity, and it appears in the denominator of the correlation coefficient. Reading the subscript as multiplication gives something with the wrong units and the wrong value.Read more →