Tutorials › Introduction to Statistics › Why Correlation Stays Between Minus One and One

Scatterplots and Correlation · Tutorial 234 of 996

Why Correlation Stays Between Minus One and One

Use the Cauchy–Schwarz inequality to understand the limits of Pearson’s correlation and what its endpoint values say about paired data.

Beginner 9 min read

What You'll Learn

  • Write Pearson’s correlation using centered observations.
  • Apply the Cauchy–Schwarz inequality to show correlation is bounded by minus one and one.
  • Identify the equality condition in the inequality.
  • Explain why correlation of plus one or minus one means the data lie exactly on a straight line.
  • Recognize when correlation is undefined and why two nonconstant pairs always give an endpoint.

Why Correlation Has Fixed Limits

Pearson’s correlation summarizes the direction and strength of a linear pattern between two quantitative variables. Its values always fall between \(-1\) and \(1\). These limits are not a convention imposed on the calculation; they follow from a basic inequality about sums of products. Understanding that inequality also explains what the endpoint values mean: a correlation of \(1\) or \(-1\) occurs only when the observed pairs lie exactly on a straight line with positive or negative slope.

To see the structure behind the result, center each variable by subtracting its sample mean. The centered values describe how far each observation is above or below its own mean. Correlation compares the products of these paired deviations with the overall sizes of the deviations in each variable.

Definition: For \(n\) paired observations \((x_i,y_i)\), let \(\bar{x}\) and \(\bar{y}\) be the sample means. If both variables have nonzero sample standard deviations, Pearson’s sample correlation is $$ r=\frac{\sum_{i=1}^{n}(x_i-\bar{x})(y_i-\bar{y})}{\sqrt{\left[\sum_{i=1}^{n}(x_i-\bar{x})^2\right]\left[\sum_{i=1}^{n}(y_i-\bar{y})^2\right]}}. $$ If either variable has zero variability, the denominator is zero and \(r\) is undefined.

This expression is equivalent to the covariance formula for correlation: the factors involving \(n-1\) in the sample covariance and the two sample standard deviations cancel. In the definition above, the numerator is the sum of paired centered products, and the denominator scales that sum by the sizes of the two sets of centered values.

The Inequality Behind the Bound

The Cauchy–Schwarz inequality says that for any two finite lists of real numbers \(a_1,\ldots,a_n\) and \(b_1,\ldots,b_n\),

$$ \left|\sum_{i=1}^{n}a_i b_i\right| \leq \sqrt{\left(\sum_{i=1}^{n}a_i^2\right)\left(\sum_{i=1}^{n}b_i^2\right)}. $$

In the correlation formula, choose \(a_i=x_i-\bar{x}\) and \(b_i=y_i-\bar{y}\). The numerator is then \(\sum a_i b_i\), while the denominator is the square root of \((\sum a_i^2)(\sum b_i^2)\). Provided that denominator is positive, divide both sides of the inequality by it. The result is

$$ |r|\leq 1, \qquad\text{so}\qquad -1\leq r\leq 1. $$

The bound applies to any finite set of paired numerical observations for which \(r\) is defined. It does not require a random sample, a particular probability model, or a specific distribution of the data. Those considerations can matter for other statistical questions, but the bound itself is a direct consequence of the values in the data.

Why Equality Means a Perfect Line

The inequality gives more than the limits. It also gives an exact condition for reaching them. To establish that condition, consider the centered lists \(a_i=x_i-\bar{x}\) and \(b_i=y_i-\bar{y}\). For any real number \(t\), a sum of squares cannot be negative:

$$ \sum_{i=1}^{n}(b_i-t a_i)^2\geq 0. $$

Expanding the squares produces a quadratic expression in \(t\):

$$ \left(\sum a_i^2\right)t^2 -2\left(\sum a_i b_i\right)t +\sum b_i^2 \geq 0 \quad\text{for every real }t. $$

When both centered lists have nonzero sums of squares, the coefficient of \(t^2\) is positive. A quadratic with positive leading coefficient can stay nonnegative for every real \(t\) only if its discriminant is at most zero. Applying that condition gives

$$ \left[-2\sum a_i b_i\right]^2 -4\left(\sum a_i^2\right)\left(\sum b_i^2\right)\leq 0, $$ $$ \left(\sum a_i b_i\right)^2 \leq \left(\sum a_i^2\right)\left(\sum b_i^2\right). $$

This is the Cauchy–Schwarz inequality for the two centered lists. Equality holds precisely when the quadratic has a repeated root, meaning the sum of squares is zero for some \(t\). A sum of squares is zero only when every squared term is zero, so equality requires \(b_i=t a_i\) for every observation. In the original variables, this means

$$ y_i-\bar{y}=t(x_i-\bar{x})\quad\text{for every }i, \qquad\text{or equivalently}\qquad y_i=\bar{y}+t(x_i-\bar{x}). $$

Thus every observed point lies exactly on one straight line. If \(t>0\), the line has positive slope and the centered products add to a positive value, giving \(r=1\). If \(t<0\), the line has negative slope and the products add to a negative value, giving \(r=-1\). The case \(t=0\) would make all \(y_i\) equal, so \(y\) would have zero variability and correlation would be undefined rather than an endpoint.

Worked Examples

Worked Example: A Correlation Strictly Inside the Bounds

Suppose three hypothetical paired measurements are \(x=(1,2,3)\) and \(y=(2,4,5)\). Calculate \(r\), then check that the result falls within the permitted range.

The means are \(\bar{x}=2\) and \(\bar{y}=11/3\). The centered values are \(x_i-\bar{x}=(-1,0,1)\) and \(y_i-\bar{y}=(-5/3,1/3,4/3)\). Therefore,

$$ \sum (x_i-\bar{x})(y_i-\bar{y}) =\frac{5}{3}+0+\frac{4}{3}=3, $$ $$ \sum (x_i-\bar{x})^2=1+0+1=2, \qquad \sum (y_i-\bar{y})^2 =\frac{25+1+16}{9}=\frac{14}{3}. $$

Substituting these values into the formula gives

$$ r=\frac{3}{\sqrt{2(14/3)}} =\frac{3}{\sqrt{28/3}} \approx 0.9820. $$

Both variables vary, so the denominator is positive and \(r\) is defined. The calculated value is positive and less than \(1\), as required. Since it is not an endpoint, these three points do not lie exactly on one straight line, even though their pattern is strongly positive.

Worked Example: Correlation of Minus One

Consider the hypothetical pairs \((1,8)\), \((2,6)\), and \((4,2)\). Each value of \(y\) follows the rule \(y=10-2x\). Verify the correlation and relate it to the equality condition.

The means are \(\bar{x}=7/3\) and \(\bar{y}=16/3\). The centered lists are \((-4/3,-1/3,5/3)\) and \((8/3,2/3,-10/3)\). Their sums of products and squares are

$$ \sum (x_i-\bar{x})(y_i-\bar{y}) =\frac{-32-2-50}{9}=-\frac{28}{3}, $$ $$ \sum (x_i-\bar{x})^2=\frac{42}{9}=\frac{14}{3}, \qquad \sum (y_i-\bar{y})^2=\frac{168}{9}=\frac{56}{3}. $$

Thus

$$ r= \frac{-28/3}{\sqrt{(14/3)(56/3)}} = \frac{-28/3}{28/3} =-1. $$

Here each centered \(y\)-value is \(-2\) times the corresponding centered \(x\)-value. The centered lists are exact negative multiples, so they meet the equality condition with a negative multiplier. In the scatterplot, all three points lie exactly on a straight line with negative slope.

Worked Example: Checking for Exact Linearity

Suppose four hypothetical observations are \(x=(1,2,3,4)\) and \(y=(1,2,2,4)\). Calculate \(r\) and check whether the equality condition holds.

The means are \(\bar{x}=2.5\) and \(\bar{y}=2.25\), giving centered lists \((-1.5,-0.5,0.5,1.5)\) and \((-1.25,-0.25,-0.25,1.75)\). The required sums are

$$ \sum (x_i-\bar{x})(y_i-\bar{y})=4.5, \qquad \sum (x_i-\bar{x})^2=5, \qquad \sum (y_i-\bar{y})^2=4.75. $$

Substitution gives

$$ r=\frac{4.5}{\sqrt{5(4.75)}} =\frac{4.5}{\sqrt{23.75}} \approx 0.9234. $$

The centered lists are not multiples of one another: for example, the ratios of corresponding centered values are \((-1.25)/(-1.5)\approx 0.8333\) and \((-0.25)/(-0.5)=0.5\), which are not equal. The points therefore do not lie exactly on a straight line, and the correlation is positive but strictly below \(1\).

What the Endpoints Do—and Do Not—Tell You

An endpoint correlation is a statement about the observed pairs: they fit an exact straight-line rule. It is not simply a claim that a pattern looks very strong, nor does it mean every observation is identical. For \(r=1\), the values of \(y\) increase in exact proportion to the centered values of \(x\); for \(r=-1\), they decrease in exact proportion. Either variable may have any nonzero scale of variation.

The requirement that both variables vary is essential. If all \(x_i\) are the same, then \(\sum (x_i-\bar{x})^2=0\). If all \(y_i\) are the same, then \(\sum (y_i-\bar{y})^2=0\). In either case, the denominator in the formula is zero. It is incorrect to describe such a data set as having correlation zero: the correlation is undefined because the formula cannot be evaluated.

A further special case helps clarify why exact endpoints are about the data points rather than a guarantee of a broad pattern. With only two paired observations, if both variables vary, each centered list has two entries that are negatives of one another. One centered list must therefore be a positive or negative multiple of the other, so the correlation is \(1\) or \(-1\). Two points always determine a straight line; this endpoint alone does not provide evidence of a stable pattern among a larger set of observations.

Common pitfall: “The correlation is close to \(1\), so the observations must lie exactly on a line.” A value such as \(0.9820\) is below \(1\), so it indicates that the data are not perfectly linear. Only \(r=1\) or \(r=-1\), when defined, requires exact linearity; values near an endpoint indicate a strong but not necessarily perfect linear pattern.
Key takeaway: Pearson’s correlation is a normalized sum of paired centered products. The Cauchy–Schwarz inequality bounds it between \(-1\) and \(1\), and equality occurs exactly when the two centered lists are scalar multiples—equivalently, when all observed pairs lie on a straight line.

Check Your Understanding

Use the centered-value formula and the equality condition to answer the questions.

  1. In the correlation formula, what choices of \(a_i\) and \(b_i\) make the Cauchy–Schwarz inequality apply?
  2. What does \(r=-1\) imply about the observed points and the slope of their line?
  3. A data set has the same \(x\)-value for every observation. Is its correlation zero, one, minus one, or undefined? Explain.
  4. Can a correlation of \(0.95\) correspond to points that are not exactly collinear? Explain using the equality condition.
  5. Why can two nonconstant paired observations have correlation \(1\) or \(-1\) even though the result may not indicate a dependable pattern in a larger population?