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

When two quantities are measured on the same people, the interesting question is whether they move together.
Hours studied and test score, height and weight, temperature and ice-cream sales: each observation gives a pair. Variance describes each quantity separately; it says nothing about whether a high value of one tends to come with a high value of the other.
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.
Four students: those who studied longer than average mostly scored above average too.
Measure each value from its own average — 2.5 hours and 65 points — and multiply the two deviations. When both are above average or both below, the product is positive; when they point opposite ways, it is negative.
studenthours xscore yx − 2.5y − 65product
A150−1.5−1522.5
B260−0.5−52.5
C3650.500
D4851.52030
average2.56555 ÷ 4 = 13.75
The sign of each product is forced by agreement, so their average reports the overall tendency.
Here every product is positive or zero, because no student was above average on one measure and below on the other. Averaging the products gives 13.7513.75: a positive number, saying the two quantities rise together.
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 variables.
The definition
The covariance of two random variables XX and YY is the expected value of the product of their deviations from their means.
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 →
So for the four equally likely students, Cov⁡(X,Y)=13.75\operatorname{Cov}(X, Y) = 13.75 hour-points.
Covariance is a single number attached to a pair of random variables, with the units of both multiplied together.
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.
Covariance is positive when two deviations tend to share a sign and negative when they tend to oppose.
The sign generalizes; the size does not.
A positive covariance always means "together", a negative one "opposite". But 13.7513.75 depends on the units: measure study time in minutes and the covariance becomes 825825, with nothing about the students changed. Covariance gives the direction of a relationship, not its strength, as the next section on interpreting the sign explains.
The rest of the page covers the sign of covariance, its link to independence, why it matters, common examples and the notation.

Interpreting the Sign of Covariance


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

Did you know: Positive, positive, yet negative
Covariance signs do not chain. With independent AA, BB, CC of variance 11, let X=A+BX = A + B, Y=B+CY = B + C and Z=C−AZ = C - A: each pair shares a different piece, so Cov⁡(X,Y)=1\operatorname{Cov}(X, Y) = 1 and Cov⁡(Y,Z)=1\operatorname{Cov}(Y, Z) = 1, yet Cov⁡(X,Z)=−1\operatorname{Cov}(X, Z) = -1.

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.

Did you know: Three-way opposition stops at −12-\frac{1}{2}
Two variables can have correlation −1-1, but if every pair among three variables has the same correlation ρ\rho, then ρ≥−12\rho \geq -\frac{1}{2}. The three standardized variables add up to a sum with variance 3+6ρ3 + 6\rho, which cannot be negative.

Sums show this most directly. The variance of X+YX + Y is Var⁡(X)+Var⁡(Y)+2Cov⁡(X,Y)\operatorname{Var}(X) + \operatorname{Var}(Y) + 2\operatorname{Cov}(X, Y), and with three variables each of the three pairs adds its own covariance, counted twice. Positive covariances make a sum spread more than its parts suggest; negative covariances let deviations cancel, so the sum spreads less.

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.

Pitfall: Judging strength by the size of the covariance
Reading a larger covariance as a stronger relationship ignores units: recording height in centimetres instead of metres multiplies Cov⁡\operatorname{Cov} by 100100, while the relationship stays the same. Strength is compared with the correlation ρXY\rho_{XY}, which does not change.

The pairs in this list are recorded in very different units: centimetres and kilograms, hours and points, degrees and kilowatt-hours, percentage returns. Each deviation from a mean carries the unit of its own variable, so the product of two deviations carries the product of the two units.

A covariance is therefore a number on its own scale for each pair. A covariance for height and weight is expressed in centimetre-kilograms, one for study time and exam score in hour-points, and the same pair recorded with other units produces a different number.

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.
DownloadPNG2×PDF
Notation · Cheat sheet
Expectation and Spread: Notation at a Glance
The marks from the notation cards across the pages on expected value, variance, covariance, median and mode: how each is read and what it means. Every group links to the full card on its page.
Expected value
E[X],  E[X]E[X], \; \mathbb{E}[X]
the expected value of X
Takes a whole random variable, returns one number.
μ\mu
mu, the mean
The same number as a constant: μ=E[X]\mu = E[X].
E[g(X)]E[g(X)]
expected value of g of X
Weights g(x)g(x), not xx; in general not g(E[X])g(E[X]).
Variance
Var⁡(X)\operatorname{Var}(X)
the variance of X
The expected squared distance from the mean.
σ2\sigma^2
sigma squared
The variance as a constant; never negative.
σ,  SD⁡(X)\sigma, \; \operatorname{SD}(X)
the standard deviation
The square root of the variance, in the units of XX.
CovarianceThis page
Cov⁡(X,Y)\operatorname{Cov}(X, Y)
the covariance of X and Y
How two variables move together.
σXY\sigma_{XY}
sigma X Y
The covariance as a constant; σXX=σX2\sigma_{XX} = \sigma_X^2.
ρXY\rho_{XY}
rho, the correlation
Covariance over σXσY\sigma_X\sigma_Y: always in [−1,1][-1, 1].
Median
median⁡(X),  m\operatorname{median}(X), \; m
the median of X
The middle value: half the probability on each side.
x~\tilde{x}
x tilde
The sample median, as xˉ\bar{x} is the sample mean.
Q2=F−1(0.5)Q_2 = F^{-1}(0.5)
the second quartile
The median as the 0.50.5 quantile.
Mode
mode⁡(X)\operatorname{mode}(X)
the mode of X
The most likely value.
arg⁡max⁡xf(x)\arg\max_x f(x)
where f is largest
The location of the peak, not its height.
{k1,…,km}\{k_1, \ldots, k_m\}
several modes
Braces when values tie: the mode need not be unique.
Same marks, different job
xˉ\bar{x} vs x~\tilde{x}The bar marks the sample mean, the tilde the sample median.
σ2\sigma^2 vs σ\sigmaVariance in squared units against standard deviation in the units of XX.
max⁡\max vs arg⁡max⁡\arg\maxThe height of the peak against where it stands.
F−1F^{-1}The quantile function, not 1F\frac{1}{F}.
Expectation and Spread: Notation at a Glance·/probability/expected-valueLearn Math Class

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 →


Pitfall: Splitting the expectation of a product
Replacing E[XY]E[XY] by E[X] E[Y]E[X]\,E[Y] without independence makes every covariance 00. For a fair coin X∈{0,1}X \in \{0, 1\} and Y=XY = X: E[XY]=12E[XY] = \frac{1}{2} and E[X] E[Y]=14E[X]\,E[Y] = \frac{1}{4}, so Cov⁡(X,Y)=14\operatorname{Cov}(X, Y) = \frac{1}{4}.

The computational formula is the version used with tables of paired data. The first term, E[XY]E[XY], is the average of the products of the paired values, taken observation by observation. The second, E[X] E[Y]E[X]\,E[Y], is the product of two separate averages, each computed from one variable on its own.

The two terms are built from different information: one keeps track of which value of XX came with which value of YY, the other does not. The covariance is exactly the gap between them.

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 →


Pitfall: Dividing by the variances
Using Var⁡(X)Var⁡(Y)\operatorname{Var}(X)\operatorname{Var}(Y) in the denominator: with Cov⁡(X,Y)=3\operatorname{Cov}(X, Y) = 3, Var⁡(X)=4\operatorname{Var}(X) = 4, Var⁡(Y)=9\operatorname{Var}(Y) = 9 this gives 336≈0.083\frac{3}{36} \approx 0.083. The denominator takes the square roots: ρXY=32⋅3=0.5\rho_{XY} = \frac{3}{2 \cdot 3} = 0.5.

The denominator is built so that the units cancel. The covariance in the numerator carries the unit of XX times the unit of YY, and the product in the denominator carries exactly the same pair of units, so the ratio is a pure number.

That is what makes correlation comparable across pairs and unchanged by a change of scale: recording XX in centimetres instead of metres multiplies the numerator and the denominator by the same factor 100100. The bounds then give the number a fixed reading, with values near 11 or −1-1 for an almost exact linear relationship and values near 00 for little linear tendency.

Correlation is covariance with the units divided out: one scale, from −1-1 to 11, for every pair of variables.

Covariance at a Glance

This summary collects covariance into ten rows. Each row names an aspect with a short note and a link to the section that explains it, gives its statement, and adds a note or an example.

The rows run from the definition and the symmetry and self-covariance identities to the meaning of a positive, a negative and a zero covariance. Next comes the one-way relationship with independence: independent variables have zero covariance, but not the other way round. The last rows say what covariance does and does not capture, list common pairs of quantities, and name the concepts it leads into, with the correlation coefficient written out.
DownloadPNG2×PDF
AspectStatementNote or example
DefinitionThe average product of the two deviations from the means, from what covariance describes.Cov⁡(X,Y)=E ⁣[(X−μX)(Y−μY)]\operatorname{Cov}(X, Y) = E\!\left[(X - \mu_X)(Y - \mu_Y)\right]extends variance from one variable to a pair
SymmetryThe product in the definition reads the same in either order.Cov⁡(X,Y)=Cov⁡(Y,X)\operatorname{Cov}(X, Y) = \operatorname{Cov}(Y, X)order of the variables doesn't matter
Self-covarianceBoth deviations become the same, so the definition turns into the variance.Cov⁡(X,X)=Var⁡(X)\operatorname{Cov}(X, X) = \operatorname{Var}(X)pairing a variable with itself recovers its variance
Positive covarianceOne of the three cases in interpreting the sign of covariance.Cov⁡(X,Y)>0\operatorname{Cov}(X, Y) > 0both variables tend to be above (or below) their averages together
Negative covarianceThe opposite case, from interpreting the sign.Cov⁡(X,Y)<0\operatorname{Cov}(X, Y) < 0one variable above its average tends to occur with the other below its average
Zero covarianceThe third case of interpreting the sign.Cov⁡(X,Y)=0\operatorname{Cov}(X, Y) = 0no consistent linear relationship; non-linear dependence may still exist
IndependenceOnly one direction holds, as covariance and independence shows.X,YX, Y independent   ⟹  Cov⁡(X,Y)=0\implies \operatorname{Cov}(X, Y) = 0the converse does not hold: zero covariance is not independence
What it capturesThe sign is the message and the size is not, as interpreting the sign stresses.direction (not strength) of the linear relationshipmagnitude depends on the units; normalize via correlation ρ\rho for scale-free strength
Typical examplesEach pair is discussed, with its units, in common examples of covariance.height and weight; study time and exam score; temperature and energy use; returns of two assetspaired numerical quantities recorded from the same observations
Leads toWhat comes next defines ρXY=Cov⁡(X,Y)σX σY\displaystyle \rho_{XY} = \frac{\operatorname{Cov}(X, Y)}{\sigma_X\,\sigma_Y}, which always lies between −1-1 and 11.correlation coefficient ρ\rho; covariance matrices; joint distributionsbasis for multivariate models, linear regression, and portfolio theory
Covariance formulas·All probability formulasLearn Math Class
Read a covariance for its sign first: it tells the direction of the linear relationship and nothing more. To judge strength, or to compare different pairs, divide by both standard deviations and work with the correlation instead.

Common Pitfalls

Four mistakes account for most wrong conclusions drawn from covariance. Three are marked where they happen in the sections above; the first is the one the section on independence warns about. Here each is worked through in full, with the wrong and the right working side by side.
DownloadPNG2×PDF
1Treating zero covariance as independence
A covariance of 00 is computed, and the two variables are declared independent.
Start
Let XX take the values −2,−1,0,1,2-2, -1, 0, 1, 2 with probability 15\frac{1}{5} each, and let Y=X2Y = X^2.
Wrong turn
Error here
Then E[X]=0E[X] = 0 and E[XY]=E[X3]=0E[XY] = E[X^3] = 0, so
Cov⁡(X,Y)=E[XY]−E[X] E[Y]\operatorname{Cov}(X, Y) = E[XY] - E[X]\,E[Y]

=0−0⋅2=0= 0 - 0 \cdot 2 = 0
And the conclusion is that XX and YY are independent.
Right path
YY is fixed by XX, so they are as dependent as two variables can be. Independence would need P(X=0,Y=0)=P(X=0) P(Y=0)=15⋅15=125P(X = 0, Y = 0) = P(X = 0)\,P(Y = 0) = \frac{1}{5} \cdot \frac{1}{5} = \frac{1}{25}, but X=0X = 0 forces Y=0Y = 0, so P(X=0,Y=0)=15P(X = 0, Y = 0) = \frac{1}{5}. The variables are uncorrelated, not independent.
Why it happensThe implication "independent, so covariance 00" is true and is used often, and it is easy to run it backwards.
How to checkTest one pair of values against the product rule P(X=x,Y=y)=P(X=x) P(Y=y)P(X = x, Y = y) = P(X = x)\,P(Y = y). A single pair that fails proves dependence, whatever the covariance is.
2Judging strength by the size of the covariance
Two covariances are compared, and the larger one is read as the stronger relationship.
Start
Height and weight have Cov⁡=0.5\operatorname{Cov} = 0.5 with height in metres, and study time and exam score have Cov⁡=20\operatorname{Cov} = 20.
Wrong turn
Error here
Since 20>0.520 > 0.5, study time and score seem far more closely related. With height in centimetres the first covariance becomes 5050, and the ranking reverses.
Right path
Compare correlations. With σH=0.1\sigma_H = 0.1 m and σW=10\sigma_W = 10 kg, ρ=0.50.1⋅10=0.5\rho = \frac{0.5}{0.1 \cdot 10} = 0.5; with σT=5\sigma_T = 5 hours and σS=10\sigma_S = 10 points, ρ=205⋅10=0.4\rho = \frac{20}{5 \cdot 10} = 0.4. Height and weight are the more strongly related pair, in any units.
Why it happensFor most quantities a bigger number means more of something, and the units of a covariance, such as metre-kilograms, are rarely written next to it.
How to checkChange the units of one variable. If the comparison flips, it was a comparison of scales, not of relationships. In centimetres, ρ=5010⋅10=0.5\rho = \frac{50}{10 \cdot 10} = 0.5 is unchanged.
3Splitting the expectation of a product
The computational formula Cov⁡(X,Y)=E[XY]−E[X] E[Y]\operatorname{Cov}(X, Y) = E[XY] - E[X]\,E[Y] is used, and E[XY]E[XY] is replaced by E[X] E[Y]E[X]\,E[Y].
Wrong turn
Error here
For a fair coin X∈{0,1}X \in \{0, 1\} and Y=XY = X:
E[XY]=E[X] E[Y]=12⋅12E[XY] = E[X]\,E[Y] = \frac{1}{2} \cdot \frac{1}{2}

=14,= \frac{1}{4},

Cov⁡(X,Y)=14−14=0\operatorname{Cov}(X, Y) = \frac{1}{4} - \frac{1}{4} = 0
Right path
Compute E[XY]E[XY] from the pairs. Here XY=X2=XXY = X^2 = X, so E[XY]=12E[XY] = \frac{1}{2} and
Cov⁡(X,Y)=12−14=14\operatorname{Cov}(X, Y) = \frac{1}{2} - \frac{1}{4} = \frac{1}{4}
Why it happensThe rule E[XY]=E[X] E[Y]E[XY] = E[X]\,E[Y] is true for independent variables and is met early. Applied without independence, it turns every covariance into 00.
How to checkCov⁡(X,X)\operatorname{Cov}(X, X) must equal Var⁡(X)\operatorname{Var}(X), and for this coin Var⁡(X)=12⋅12=14\operatorname{Var}(X) = \frac{1}{2} \cdot \frac{1}{2} = \frac{1}{4}, not 00.
4Dividing by the variances
The correlation is computed with the two variances in the denominator instead of the two standard deviations.
Wrong turn
Error here
With Cov⁡(X,Y)=3\operatorname{Cov}(X, Y) = 3, Var⁡(X)=4\operatorname{Var}(X) = 4 and Var⁡(Y)=9\operatorname{Var}(Y) = 9:
ρXY=34⋅9=112≈0.083\rho_{XY} = \frac{3}{4 \cdot 9} = \frac{1}{12} \approx 0.083
Right path
σX=4=2\sigma_X = \sqrt{4} = 2 and σY=9=3\sigma_Y = \sqrt{9} = 3, so
ρXY=32⋅3=0.5\rho_{XY} = \frac{3}{2 \cdot 3} = 0.5
Why it happensVariances are often the numbers given, and σX σY\sigma_X\,\sigma_Y looks like it could be σX2 σY2\sigma_X^2\,\sigma_Y^2 with the squares left off.
How to checkTry Y=XY = X, whose correlation must be 11. With Var⁡(X)=4\operatorname{Var}(X) = 4, the right formula gives 42⋅2=1\frac{4}{2 \cdot 2} = 1, while the wrong one gives 44⋅4=0.25\frac{4}{4 \cdot 4} = 0.25. The wrong version also changes when the units change, which a correlation never does.
Common pitfalls with covariance·/probability/covarianceLearn Math Class
Each slip reads more into covariance than it says. A covariance of 00 does not give independence, its size depends on the units, E[XY]E[XY] is not E[X] E[Y]E[X]\,E[Y] in general, and the correlation divides by the standard deviations, not the variances. Testing one pair of values, changing the units, or trying Y=XY = X catches each slip.

Skills You Should Learn

Each skill opens its step-by-step method page. Skills marked "On this page" are taught above.
Taught on this page
Random variable methods

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 →

If X and Y are positively correlated, and Y and Z are too, are X and Z?

+
Not necessarily; covariance signs do not chain. Take independent AA, BB, CC of variance 11 and set X=A+BX = A + B, Y=B+CY = B + C, Z=C−AZ = C - A. Each pair shares a different piece: Cov⁡(X,Y)=1\operatorname{Cov}(X, Y) = 1 through BB and Cov⁡(Y,Z)=1\operatorname{Cov}(Y, Z) = 1 through CC, yet Cov⁡(X,Z)=−1\operatorname{Cov}(X, Z) = -1 through AA, which enters ZZ with a minus sign.Read more →

Can three variables all be negatively correlated with each other?

+
Yes, but not strongly. Two variables can reach correlation −1-1, but if all three pairs share the same correlation ρ\rho, then ρ≥−12\rho \ge -\frac{1}{2}. The sum of the three standardized variables has variance 3+6ρ3 + 6\rho, and a variance cannot be negative. The floor −12-\frac{1}{2} is reached when the three standardized variables always add up to a constant.Read more →

When does E[XY] equal E[X]E[Y]?

+
Exactly when the covariance is zero, since Cov⁡(X,Y)=E[XY]−E[X] E[Y]\operatorname{Cov}(X, Y) = E[XY] - E[X]\,E[Y]. Independence is enough, but it is not required: uncorrelated dependent variables satisfy it too. Splitting the product without checking is the mistake: for a fair coin X∈{0,1}X \in \{0, 1\} and Y=XY = X, E[XY]=12E[XY] = \frac{1}{2} while E[X] E[Y]=14E[X]\,E[Y] = \frac{1}{4}, and the gap 14\frac{1}{4} is the covariance.Read more →