Correlation Coefficient

Correlation coefficient measures the strength and direction of a linear relationship between two quantitative variables, ranging from -1 to 1.

r=(xixˉ)(yiyˉ)(n1)sxsyr = \frac{\sum (x_i - \bar{x})(y_i - \bar{y})}{(n-1)s_x s_y}

Solve a problem with Correlation Coefficient

Type the problem. The solver will use Correlation Coefficient where Correlation Coefficient is the right tool, and tell you when it is not.

Drag one in or paste from the clipboard. JPEG, PNG or WebP. You get the transcription to check before anything is solved.

How to get a better answer
  • Paste the whole problem, including the instruction word — "simplify", "solve for x" and "factor" lead to three different answers.
  • Say what you have already tried. "I got x = 4 and the book says 2" turns a solution into a diagnosis.
  • Set the level in the settings button. A calculus shortcut is not a better answer if you have not met derivatives yet.
  • For a photo, get the whole problem in frame and hold the page flat — you get the transcription to fix before anything is solved.

What each symbol means

What Correlation Coefficient takes
rr
xix_i
yiy_i
nn
Correlation Coefficient
SymbolMeaning
rrThe correlation coefficient itself, always ranging from -1 (perfect negative correlation) to 1 (perfect positive correlation); values near 0 indicate weak or no linear relationship.
xix_iThe ii-th individual observation of the first variable; the subscript ii identifies which data point (for example, x3x_3 is the third value of xx).
yiy_iThe ii-th individual observation of the second variable, paired with xix_i from the same subject or time period; both observations must align positionally.
nnThe total number of paired observations in the dataset; appears as (n1)(n-1) in the denominator to apply Bessel's correction for unbiased sample estimation.

When to use it

Use the correlation coefficient when you have two quantitative variables and want to measure how strongly they move together linearly.

Level

Usually taught in: Statistics · Appears on: AP Statistics

Worked examples

1. Correlation coefficient with small integer pairs

Problem

Calculate the correlation coefficient for the dataset: x=1,2,3x = 1, 2, 3 and y=2,3,4y = 2, 3, 4.
  1. xˉ=1+2+33=2,yˉ=2+3+43=3\bar{x} = \frac{1+2+3}{3} = 2, \quad \bar{y} = \frac{2+3+4}{3} = 3

    Calculate the mean of each variable by summing all values and dividing by n=3n = 3.

  2. (xixˉ)=1,0,1 and (yiyˉ)=1,0,1(x_i - \bar{x}) = -1, 0, 1 \text{ and } (y_i - \bar{y}) = -1, 0, 1

    Subtract the mean from each observation to find deviations from the center.

  3. (xixˉ)(yiyˉ)=1,0,1    =2(x_i - \bar{x})(y_i - \bar{y}) = 1, 0, 1 \implies \sum = 2

    Multiply corresponding deviations pair by pair: (1)×(1)=1(-1) \times (-1) = 1, 0×0=00 \times 0 = 0, 1×1=11 \times 1 = 1; then sum these products.

  4. sx2=(1)2+02+1231=22=1,sx=1s_x^2 = \frac{(-1)^2 + 0^2 + 1^2}{3-1} = \frac{2}{2} = 1, \quad s_x = 1

    Calculate the sample variance of xx by summing squared deviations and dividing by n1=2n-1 = 2, then take the square root.

  5. sy2=(1)2+02+1231=22=1,sy=1s_y^2 = \frac{(-1)^2 + 0^2 + 1^2}{3-1} = \frac{2}{2} = 1, \quad s_y = 1

    Calculate the sample variance of yy the same way.

  6. r=2(31)11=22=1r = \frac{2}{(3-1) \cdot 1 \cdot 1} = \frac{2}{2} = 1

    Plug all values into the correlation formula; r=1r = 1 indicates perfect positive linear association.

Answer: r=1r = 1

This example shows a perfect linear relationship: as xx increases by 1 each time, yy also increases by exactly 1. The correlation coefficient captures this perfect association with r=1r = 1, the maximum possible value.

2. Correlation coefficient with negative relationship and decimals

Problem

Find the correlation coefficient for x=0.5,1.5,2.5x = 0.5, 1.5, 2.5 and y=3,1,2y = 3, 1, 2.
  1. xˉ=0.5+1.5+2.53=4.53=1.5,yˉ=3+1+23=2\bar{x} = \frac{0.5 + 1.5 + 2.5}{3} = \frac{4.5}{3} = 1.5, \quad \bar{y} = \frac{3 + 1 + 2}{3} = 2

    Calculate the mean of each variable.

  2. (xixˉ)=1,0,1 and (yiyˉ)=1,1,0(x_i - \bar{x}) = -1, 0, 1 \text{ and } (y_i - \bar{y}) = 1, -1, 0

    Find deviations: subtract each mean from the corresponding values.

  3. (xixˉ)(yiyˉ)=1,0,0    =1(x_i - \bar{x})(y_i - \bar{y}) = -1, 0, 0 \implies \sum = -1

    Multiply deviations: (1)(1)=1(-1)(1) = -1, (0)(1)=0(0)(-1) = 0, (1)(0)=0(1)(0) = 0; the negative product indicates the negative trend.

  4. sx2=1+0+12=1,sx=1s_x^2 = \frac{1 + 0 + 1}{2} = 1, \quad s_x = 1

    Calculate sample variance of xx: squared deviations are 1,0,11, 0, 1; sum is 2.

  5. sy2=1+1+02=1,sy=1s_y^2 = \frac{1 + 1 + 0}{2} = 1, \quad s_y = 1

    Calculate sample variance of yy: squared deviations are 1,1,01, 1, 0; sum is 2.

  6. r=1(31)11=12r = \frac{-1}{(3-1) \cdot 1 \cdot 1} = -\frac{1}{2}

    The negative numerator produces negative rr; this weak negative value is closer to 0 than to 1-1, showing weak association.

Answer: r=12r = -\frac{1}{2}

Here the relationship is weakly negative: as xx increases, yy tends to decrease, but not consistently. The value r=0.5r = -0.5 reflects this weak trend and lies between 0 (no relationship) and 1-1 (perfect negative relationship).

3. Correlation coefficient for rectangular garden plot fencing and yield

Problem

A farmer plants three rectangular garden plots and records the perimeter of fencing (in meters) and vegetable yield (in kg). Perimeter: 12 m, 20 m, 28 m; Yield: 30 kg, 50 kg, 70 kg. Calculate the correlation coefficient.
  1. Pˉ=12+20+283=603=20,Yˉ=30+50+703=1503=50\bar{P} = \frac{12 + 20 + 28}{3} = \frac{60}{3} = 20, \quad \bar{Y} = \frac{30 + 50 + 70}{3} = \frac{150}{3} = 50

    Calculate the mean perimeter and mean yield.

  2. (PiPˉ)=8,0,8 and (YiYˉ)=20,0,20(P_i - \bar{P}) = -8, 0, 8 \text{ and } (Y_i - \bar{Y}) = -20, 0, 20

    Find deviations for each plot by subtracting the mean from each measurement.

  3. (PiPˉ)(YiYˉ)=160,0,160    =320(P_i - \bar{P})(Y_i - \bar{Y}) = 160, 0, 160 \implies \sum = 320

    Multiply deviations: (8)(20)=160(-8)(-20) = 160, (0)(0)=0(0)(0) = 0, (8)(20)=160(8)(20) = 160; all non-zero products are positive, strengthening the positive correlation.

  4. sP2=64+0+642=1282=64,sP=8s_P^2 = \frac{64 + 0 + 64}{2} = \frac{128}{2} = 64, \quad s_P = 8

    Calculate sample variance of perimeter: squared deviations (8)2,02,82(-8)^2, 0^2, 8^2 sum to 128; variance is 128÷2=64128 \div 2 = 64.

  5. sY2=400+0+4002=8002=400,sY=20s_Y^2 = \frac{400 + 0 + 400}{2} = \frac{800}{2} = 400, \quad s_Y = 20

    Calculate sample variance of yield: squared deviations (20)2,02,202(-20)^2, 0^2, 20^2 sum to 800; variance is 800÷2=400800 \div 2 = 400.

  6. r=320(31)820=3202160=320320=1r = \frac{320}{(3-1) \cdot 8 \cdot 20} = \frac{320}{2 \cdot 160} = \frac{320}{320} = 1

    Substitute into the formula: numerator is 320, denominator is (n1)sPsY=2×8×20=320(n-1) \cdot s_P \cdot s_Y = 2 \times 8 \times 20 = 320.

Answer: r=1r = 1

This word problem illustrates a perfect positive linear relationship in a real context: each 8-meter increase in fencing corresponds to exactly 20 kg more yield. Perfect correlations (r=1r = 1 or r=1r = -1) are rare in real data, but this example shows how the formula captures when one variable perfectly predicts another.

Common mistakes

Where Correlation Coefficient usually goes wrong
Answer came out wrong
Calculate the numerator as xiyi\sum x_i y_i (raw products of the original data) instead of (xixˉ)(yiyˉ)\sum (x_i - \bar{x})(y_i - \bar{y}) (products of deviations from the means).
Always subtract the mean first: compute (xixˉ)(x_i - \bar{x}) and (yiyˉ)(y_i - \bar{y}) for each pair, then multiply these deviations together and sum the products.
Calculate standard deviations using the population formula sx=(xixˉ)2ns_x = \sqrt{\frac{\sum(x_i - \bar{x})^2}{n}} instead of the sample formula sx=(xixˉ)2n1s_x = \sqrt{\frac{\sum(x_i - \bar{x})^2}{n-1}} with (n1)(n-1) in the denominator.
Always use (n1)(n-1) in the denominator when calculating sxs_x and sys_y for correlation: s=(xixˉ)2n1s = \sqrt{\frac{\sum(x_i - \bar{x})^2}{n-1}}, because the correlation coefficient is a sample statistic.
Interpret r=0.8r = 0.8 to mean that '80% of the relationship is explained' or that a value of r0.7r \geq 0.7 automatically indicates a 'strong' or 'useful' relationship.
Remember that rr is a measure on the 1-1 to 11 scale, not a percentage. To find the proportion of variance explained, square rr to get r2r^2 (e.g., r=0.8    r2=0.6464r = 0.8 \implies r^2 = 0.64 \approx 64%). Always evaluate the practical significance of a correlation within your specific context rather than using a universal threshold.
The mistakeWhy it is wrongThe fix
Calculate the numerator as xiyi\sum x_i y_i (raw products of the original data) instead of (xixˉ)(yiyˉ)\sum (x_i - \bar{x})(y_i - \bar{y}) (products of deviations from the means).The formula requires deviations from the means; using raw products xiyix_i y_i ignores where the data center is and produces a value that depends on the scale of the numbers rather than the strength of the linear association.Always subtract the mean first: compute (xixˉ)(x_i - \bar{x}) and (yiyˉ)(y_i - \bar{y}) for each pair, then multiply these deviations together and sum the products.
Calculate standard deviations using the population formula sx=(xixˉ)2ns_x = \sqrt{\frac{\sum(x_i - \bar{x})^2}{n}} instead of the sample formula sx=(xixˉ)2n1s_x = \sqrt{\frac{\sum(x_i - \bar{x})^2}{n-1}} with (n1)(n-1) in the denominator.The correlation coefficient formula requires the sample standard deviation (dividing by n1n-1); using the population formula (dividing by nn) produces an incorrect rr value, especially noticeable with small sample sizes.Always use (n1)(n-1) in the denominator when calculating sxs_x and sys_y for correlation: s=(xixˉ)2n1s = \sqrt{\frac{\sum(x_i - \bar{x})^2}{n-1}}, because the correlation coefficient is a sample statistic.
Interpret r=0.8r = 0.8 to mean that '80% of the relationship is explained' or that a value of r0.7r \geq 0.7 automatically indicates a 'strong' or 'useful' relationship.The correlation coefficient rr ranges from 1-1 to 11 and does not represent a percentage; the proportion of variance explained is r2r^2 (the coefficient of determination), and whether a correlation is 'strong' depends on the field, context, and stakes of the problem.Remember that rr is a measure on the 1-1 to 11 scale, not a percentage. To find the proportion of variance explained, square rr to get r2r^2 (e.g., r=0.8    r2=0.6464r = 0.8 \implies r^2 = 0.64 \approx 64%). Always evaluate the practical significance of a correlation within your specific context rather than using a universal threshold.

Tips and when to use something else

  • Always create a scatter plot before interpreting rr; the correlation coefficient can hide non-linear relationships, outliers, or clusters that would jump out visually.
  • If r0r \approx 0, do not assume the variables are unrelated—they may share a strong curved or non-linear relationship; consider using Spearman's rank correlation for ordinal data or fitting a non-linear regression model.
  • The correlation coefficient is symmetric: r(x,y)=r(y,x)r(x, y) = r(y, x), so swapping which variable is called xx and which is called yy does not change the result.
  • A practical rule (context-dependent): r>0.7|r| > 0.7 typically suggests strong linear association, 0.3<r<0.70.3 < |r| < 0.7 suggests moderate association, and r<0.3|r| < 0.3 suggests weak linear association—but always check the scatter plot and consider your field's standards.

Frequently asked questions

Can the correlation coefficient be greater than 1 or less than -1?
No. The correlation coefficient always ranges from 1-1 to 11, inclusive. If you calculate a value outside this range, you have made a computational error. r=1r = 1 is perfect positive correlation, r=1r = -1 is perfect negative correlation, and r=0r = 0 indicates no linear relationship.
Why does the correlation formula divide by (n1)(n-1) instead of nn?
The correlation coefficient is a sample statistic. Dividing by (n1)(n-1) instead of nn (Bessel's correction) provides an unbiased estimate of the true population correlation. Using nn would underestimate the population value, particularly in small samples.
If I find a high correlation, does that prove one variable causes the other?
No. Correlation shows association (two variables move together) but not causation. High correlation can result from direct causation, reverse causation, a confounding third variable, or even coincidence. Causation requires controlled experimentation, temporal order, and elimination of alternative explanations.
What is the difference between rr and r2r^2?
rr (the correlation coefficient) measures the strength and direction of a linear relationship, ranging from 1-1 to 11. r2r^2 (the coefficient of determination) is the square of rr and represents the fraction (or percentage) of variance in one variable explained by the linear relationship with the other. For example, r=0.8r = 0.8 means r2=0.64r^2 = 0.64, so the linear model explains 64% of the variation in the response variable.

Need a different method?

The full solver is not scoped to one formula — type any problem and it will pick the method.

Open the math solver

Reviewed 2026-09-18