Five students report study hours x = 2, 4, 5, 6, 8 and marks y = 50, 60, 55, 70, 80. Compute Pearson's r and r².
Correlation measures how closely two variables move together along a straight line. Karl Pearson's r runs from −1 to +1 and ignores changes of origin and scale; Spearman's rank coefficient handles ranked data; the probable error and the t-test judge significance.
Bivariate data are pairs of observations (xᵢ, yᵢ) on the same individuals — height and weight, price and demand, temperature and electricity use. Plotting each pair as a point gives a scatter diagram, the first thing to draw before computing anything.
| Scatter pattern | Type of correlation | Typical r |
|---|---|---|
| points rising tightly along a line | strong positive (direct) | close to +1 |
| points falling tightly along a line | strong negative (inverse) | close to −1 |
| loose upward cloud | weak positive | about 0.2 to 0.5 |
| shapeless cloud | no linear correlation | near 0 |
| U-shape or circle | non-linear (curvilinear) relation | can be near 0 despite a strong relation |
Correlation is positive when the variables tend to move in the same direction and negative when they move in opposite directions. It is linear when the points cluster around a straight line and curvilinear when they follow a curve. All points exactly on a line is perfect correlation.
Correlation is not causation. Ice-cream sales and drowning cases rise together every summer — not because one causes the other, but because a lurking third variable, hot weather, drives both. G. Udny Yule called such misleading associations nonsense correlations. A correlation coefficient quantifies association; it never proves cause and effect.
Draw cross-hairs through the point of means (x̄, ȳ). Points in the upper-right and lower-left quadrants give positive products (x − x̄)(y − ȳ); points in the other two quadrants give negative ones. A positive covariance therefore signals an upward trend and a negative covariance a downward trend.
Covariance has a flaw: it carries units (hours × marks) and depends on scale — measure study time in minutes instead of hours and the covariance is multiplied by 60, though nothing real has changed. Dividing by the two standard deviations removes both units and scale, and that is exactly Pearson's r.
The idea of correlation came from Sir Francis Galton's studies of heredity in the 1880s; Karl Pearson gave the product-moment formula in 1896, which is why r is called Pearson's coefficient or the product-moment correlation coefficient. The assumed-mean form works because subtracting constants A and B is a change of origin, which leaves r unchanged.
A quick illustration: x = 1, 2, 3, 4, 5 and y = 2, 4, 5, 4, 5. Here n = 5, Σx = 15, Σy = 20, Σxy = 66, Σx² = 55, Σy² = 86, so nΣxy − ΣxΣy = 330 − 300 = 30, nΣx² − (Σx)² = 275 − 225 = 50 and nΣy² − (Σy)² = 430 − 400 = 30. Then r = 30/√(50 × 30) = 30/38.73 ≈ 0.775 — the deviation form gives the same 6/√60.
When the values are large, subtract convenient assumed means A and B — a change of origin, which leaves r unchanged — and work with the small numbers u = x − A and v = y − B. If the values also share a common factor, divide by it as well (a change of scale), and r is still unchanged. The work then fits a single table.
Advertising x (Rs thousand) and sales y (units); assumed means A = 46, B = 120
x y | u = x - 46 v = y - 120 | u^2 v^2 uv
42 110 | -4 -10 | 16 100 40
44 116 | -2 -4 | 4 16 8
46 114 | 0 -6 | 0 36 0
48 122 | 2 2 | 4 4 4
50 126 | 4 6 | 16 36 24
52 132 | 6 12 | 36 144 72
-----------------------------------------------------------
n = 6 Sum u = 6 Sum v = 0 Sum u^2 = 76 Sum v^2 = 336 Sum uv = 148The correlation is strongly positive (r ≈ 0.965, r² ≈ 0.93). The same table gives both regression lines in the next topic, because regression coefficients are also unaffected by a change of origin.
Why |r| ≤ 1: turn each deviation into a standard score, X = dx/σx and Y = dy/σy. Then ΣX² = ΣY² = n and ΣXY = nr, so Σ(X + Y)² = 2n(1 + r) ≥ 0 and Σ(X − Y)² = 2n(1 − r) ≥ 0, giving −1 ≤ r ≤ 1. Equality needs X = ±Y at every point — exactly the case where all points lie on one straight line.
Dependence with zero correlation: take x = −2, −1, 0, 1, 2 and y = x² = 4, 1, 0, 1, 4. Then Σx = 0 and Σxy = Σx³ = 0, so the covariance and r are both 0 — yet y is completely determined by x. r detects only straight-line association.
Exact linear relations give r = ±1 immediately. If 3x + 4y + 5 = 0, then y = −(3x + 5)/4 lies on a line of negative slope, so r = −1 (a 2025 question). In general, ax + by + c = 0 gives r = −1 when a and b have the same sign and r = +1 when their signs differ.
| |r| | Common description |
|---|---|
| 0.9 – 1.0 | very strong |
| 0.7 – 0.9 | strong |
| 0.5 – 0.7 | moderate |
| 0.3 – 0.5 | weak |
| below 0.3 | very weak or negligible |
The coefficient of determination r² is the fraction of the total variation in y that is explained by the linear relationship with x; 1 − r² is the unexplained fraction (coefficient of non-determination). r = 0.9 explains 81% of the variation, but r = 0.5 explains only 25%. In regression, r² (or R² with several predictors) is the standard measure of the overall strength of the model — exactly what a 2026 question asked.
Example: σx = 3, σy = 4 and Var(x − y) = 13. Then r = (9 + 16 − 13)/(2 × 3 × 4) = 12/24 = 0.5, and consequently Var(x + y) = 9 + 16 + 2(0.5)(12) = 37.
When the data are ranks (two judges ranking contestants), qualitative (honesty, beauty, taste), or contain outliers, we correlate the ranks instead of the values. Rank each variable separately, take the difference d between the two ranks of every individual, and use Spearman's formula. Charles Spearman introduced it in 1904 in his work on intelligence.
Example without ties: two judges rank 8 contestants. Judge A's ranks are 1 to 8; judge B gives them 2, 1, 4, 3, 6, 8, 5, 7. The differences are −1, 1, −1, 1, −1, −2, 2, 1, so Σd² = 1 + 1 + 1 + 1 + 1 + 4 + 4 + 1 = 14 and ρ = 1 − 6(14)/(8 × 63) = 1 − 84/504 = 5/6 ≈ 0.833 — the judges largely agree.
Without ties, Spearman's ρ is exactly Pearson's r computed on the ranks. Because it uses only the order, it also detects any monotonic relation (always rising or always falling), not just a straight line, and it is little affected by outliers.
Example: r = 0.8 from n = 25 pairs. PE = 0.6745 × (1 − 0.64)/5 ≈ 0.0486, and 6·PE ≈ 0.29 is far below 0.8, so the correlation is significant; the population value probably lies between 0.751 and 0.849.
t-test example: r = 0.6 from n = 18 pairs gives t = 0.6 × √16/√0.64 = 2.4/0.8 = 3.0. The two-tailed 5% critical value for 16 degrees of freedom is 2.12, so the correlation is significant at the 5% level.
Try the problem first, then reveal the working one step at a time.
Five students report study hours x = 2, 4, 5, 6, 8 and marks y = 50, 60, 55, 70, 80. Compute Pearson's r and r².
Seven students scored Maths 70, 65, 80, 65, 90, 55, 75 and Physics 68, 60, 78, 62, 85, 60, 70 (in the same order). Find Spearman's rank correlation, correcting for ties.
The correlation between x and y is 0.7. Find the correlation between (a) u = (x − 100)/10 and v = (y − 50)/(−5), (b) u = 3x − 2 and v = 4y + 1, (c) u = −2x and v = −y.
σx = 3, σy = 4 and the variance of x − y is 13. Find r, the covariance and Var(x + y).
The covariance between x and y is 12, σx = 4 and σy = 5. Find r and the percentage of the variation in y explained by x.
Two judges rank 8 candidates and the sum of squared rank differences is 30. Find Spearman's ρ.
If the correlation between x and y is 0.8, what is the correlation between u = 2x + 3 and v = −3y + 1?
Compute Pearson's r for x = 2, 4, 6, 8 and y = 3, 7, 5, 9.
A sample of 64 pairs gives r = 0.6. Find the probable error, decide whether r is significant, and give limits for the population correlation.
12 questions. 70 % passes the topic quiz (+30 XP, +20 more for 100 %). Exam scoring: +1 correct, −⅓ wrong.
Modelled on real KPSC questions (reworded) with the same concept and answer; each links to its original paper.