Skip to content

Correlation

Definition

For random variables XX and YY with 0<Var⁡(X)<∞0<\operatorname{Var}(X)<\infty and 0<Var⁡(Y)<∞0<\operatorname{Var}(Y)<\infty, the correlation of XX and YY is

Corr⁡(X,Y)=Cov⁡(X,Y)Var⁡(X)Var⁡(Y)∈[−1,1].\operatorname{Corr}(X,Y)=\frac{\operatorname{Cov}(X,Y)}{\sqrt{\operatorname{Var}(X)\operatorname{Var}(Y)}} \in[-1,1].

Correlation is undefined if either variance is zero.


Interpretation

Correlation is the covariance of the two variables after each has been standardized to mean 00 and variance 11. It is therefore unit-free, lies between −1-1 and 11, and measures how closely the pair follows a straight line. Zero correlation rules out linear association but can coexist with dependence.

Three scatter plots: points on an exact decreasing line, a cloud with a positive but imperfect linear trend, and points on a parabola y = x squared that are uncorrelated although y depends on x.

The left panel shows the exact decreasing relation Y=5−2XY=5-2X, with correlation −1-1. The middle panel shows a positive but imperfect linear association, with correlation about 0.740.74. In the right panel, X∼Unif⁡(−1,1)X\sim\operatorname{Unif}(-1,1) and Y=X2Y=X^2 are uncorrelated but dependent, illustrating that correlation measures linear association only.

Dividing by the standard deviations removes the units: measuring XX in cents instead of euros multiplies the covariance by 100100 but leaves the correlation unchanged. In general Corr⁡(a+bX,c+dY)=Corr⁡(X,Y)\operatorname{Corr}(a+bX,c+dY)=\operatorname{Corr}(X,Y) when bd>0bd>0, and the sign flips when bd<0bd<0. The values ±1\pm1 occur only for an exact linear relation.

There is a useful picture from linear algebra: covariance behaves like an inner product of the centred variables, variance like a squared length, and correlation like the cosine of the angle between them. The bound ∣Corr⁡(X,Y)∣≤1|\operatorname{Corr}(X,Y)|\le1 is then the Cauchy–Schwarz inequality, which returns for random variables later in this course (Cauchy–Schwarz for random variables).

Correlation is not the slope of the line: Y=5−2XY=5-2X and Y=5−0.1XY=5-0.1X both have correlation −1-1.


Key Results

  • −1≤Corr⁡(X,Y)≤1-1\le\operatorname{Corr}(X,Y)\le1.
  • Absolute correlation is 11 exactly when Y=a+bXY=a+bX almost surely for constants a,ba,b with b≠0b\ne0; its sign is the sign of bb.

Examples

  • If Y=5−2XY=5-2X and XX has positive finite variance, the correlation is −1-1.
  • For X∼Unif⁡(−1,1)X\sim\operatorname{Unif}(-1,1) and Y=X2Y=X^2, symmetry gives EX=E[X3]=0\mathbb{E}X=\mathbb{E}[X^3]=0, so correlation is 00 although YY is determined by XX.

Prerequisites

Sources

Aliases: correlation coefficient, Pearson correlation, Pearson's correlation coefficient, product-moment correlation coefficient, linear correlation coefficient Symbols: element of, infinity, square root

Last updated: 22 October 2026 19:04