How to find the correlation coefficient r by hand

By Jude Wallis · Updated

Use $r = \frac{1}{n-1}\sum z_x z_y$. Turn every x and every y into a z-score, multiply the two z-scores within each pair, add those products, then divide by $n - 1$. Because z-scores carry no units, r carries none either, and it always lands between -1 and 1.

AP Statistics: Unit 5 (topics 5.2 Correlation). Correlation is Unit 5 topic 5.2 of the Fall 2026 AP Statistics course, which asks you to interpret $r$ rather than compute it, since the course states that $r$ is found with technology; Unit 5 carries 10 to 20 percent of the multiple-choice section.

The z-score formula for r

The correlation coefficient rr measures the strength and direction of the linear association between two quantitative variables. Written with z-scores, the formula is short:

r=1n1zxzyr = \frac{1}{n-1} \sum z_x z_y

The symbol \sum (capital sigma) means "add up over all the data points", and the two z-scores are

zx=xxˉsxzy=yyˉsyz_x = \frac{x - \bar{x}}{s_x} \qquad z_y = \frac{y - \bar{y}}{s_y}

where xˉ\bar{x} (x-bar) and yˉ\bar{y} (y-bar) are the sample means and sxs_x and sys_y are the sample standard deviations. The recipe is three moves: standardize both variables, multiply the pair of z-scores at each point, then average those products using n1n - 1 as the divisor.

If standardizing is new, work through how to find a z-score first, and standard deviation by hand for the sxs_x and sys_y step.

Why this formula makes r unitless and bounded

Units cancel inside every z-score. If xx is measured in volunteer shifts, then xxˉx - \bar{x} is in shifts and sxs_x is in shifts, so the ratio is a pure number. The same happens for yy. Multiplying two pure numbers gives a pure number, so rr has no units at all. That is why switching from inches to centimeters, or from dollars to euros, leaves rr completely unchanged, a point spelled out in does changing units change r.

The bound comes from a sum you can check. For any sample, zx2=n1\sum z_x^2 = n - 1 exactly, because sx2=(xxˉ)2n1s_x^2 = \frac{\sum (x - \bar{x})^2}{n-1} rearranges to (xxˉ)2=(n1)sx2\sum (x - \bar{x})^2 = (n-1)s_x^2, and dividing through by sx2s_x^2 leaves zx2=n1\sum z_x^2 = n - 1. The same holds for yy.

Now ask how large zxzy\sum z_x z_y could possibly be. The products are largest when zyz_y matches zxz_x at every point, which gives zx2=n1\sum z_x^2 = n - 1 and therefore r=n1n1=1r = \frac{n-1}{n-1} = 1. The most negative case is zy=zxz_y = -z_x everywhere, giving r=1r = -1. Every other arrangement falls between, so 1r1-1 \le r \le 1, inclusive.

The AP course states the same two facts about rr in Unit 5 topic 5.2: it is unit-free, and it always lies between -1 and 1.

Why points in matching quadrants push r positive

Picture crosshairs drawn on the scatterplot at (xˉ,yˉ)(\bar{x}, \bar{y}), splitting the plot into four quadrants. The sign of each z-score tells you which quadrant a point sits in, and the sign of the product tells you which way that point votes.

  • Upper right: zx>0z_x > 0 and zy>0z_y > 0, so the product is positive.
  • Lower left: zx<0z_x < 0 and zy<0z_y < 0, so the product is positive again, since a negative times a negative is positive.
  • Upper left and lower right: the two z-scores have opposite signs, so the product is negative.

Each point casts a signed vote, and rr is the average of those votes. A cloud that piles up in the lower-left and upper-right quadrants produces mostly positive products and a positive rr. A cloud in the other two quadrants produces mostly negative products and a negative rr. Points scattered evenly across all four quadrants produce products that cancel, pushing rr toward 0.

Size matters as well as sign. A point far from both means has two large z-scores, so its product dominates the sum. A point sitting near the crosshairs contributes almost nothing either way.

The full calculation in a table

An animal shelter recorded, for five weeks, the number of volunteer shifts filled (xx) and the number of adoption applications received (yy). The summary statistics are xˉ=20\bar{x} = 20 shifts, sx=5s_x = 5 shifts, yˉ=70\bar{y} = 70 applications, and sy=10s_y = 10 applications; the worked example below derives them.

Weekxx (shifts)yy (applications)zxz_xzyz_yzxzyz_x z_y
11556-1.0-1.41.40
21672-0.80.2-0.16
31968-0.2-0.20.04
423700.60.00.00
527841.41.41.96
Total1003500.00.03.24

Read the last column as five votes. Weeks 1 and 5 sit in matching quadrants (both below the means, then both above), so they contribute +1.40+1.40 and +1.96+1.96. Week 3 is below both means too, a small positive +0.04+0.04.

Week 2 has fewer shifts than average but more applications than average, the one dissenting vote at 0.16-0.16. Week 4 sits exactly at the mean number of applications, so zy=0z_y = 0 and it contributes nothing.

Add the products and divide by n1=4n - 1 = 4:

r=3.244=0.81r = \frac{3.24}{4} = 0.81

Two checks confirm the table. Both z-score columns sum to 0, which they must, since deviations from a mean always cancel. And zx2=1.00+0.64+0.04+0.36+1.96=4\sum z_x^2 = 1.00 + 0.64 + 0.04 + 0.36 + 1.96 = 4 while zy2=1.96+0.04+0.04+0.00+1.96=4\sum z_y^2 = 1.96 + 0.04 + 0.04 + 0.00 + 1.96 = 4, matching the n1=4n - 1 = 4 rule from the section above.

The practical routes: technology and the slope

On the AP exam you are not expected to grind through that table. The Fall 2026 course says the correlation coefficient is calculated using technology, and a graphing calculator with statistical capability is expected. Entering the two lists and running the linear regression command reports rr along with the slope and intercept; reading calculator output shows where each value appears. The regression calculator does the same thing in a browser.

The second route works when you already have a regression line. The slope of the least-squares line is

b=rsysxb = r \cdot \frac{s_y}{s_x}

so rearranging gives

r=bsxsyr = b \cdot \frac{s_x}{s_y}

For the shelter data, b=0.81×105=0.81×2=1.62b = 0.81 \times \frac{10}{5} = 0.81 \times 2 = 1.62 applications per shift. Going back the other way, r=1.62×510=1.62×0.5=0.81r = 1.62 \times \frac{5}{10} = 1.62 \times 0.5 = 0.81, which returns the value from the table. Notice that rr and bb always share a sign, since sxs_x and sys_y are never negative. More on that line in least-squares regression line.

A third route starts from r2r^2, the coefficient of determination. Here r2=0.812=0.6561r^2 = 0.81^2 = 0.6561, so about 65.61% of the variation in applications is explained by the linear relationship with shifts. Going backward from r2r^2 to rr needs a sign from somewhere else, because both 0.81 and -0.81 square to 0.6561; r vs r-squared explains why the sign is lost.

Why r is not resistant to outliers

Every ingredient in rr is nonresistant. The AP course classifies the mean as a nonresistant measure of center and the standard deviation as a nonresistant measure of variability, and rr is built from both, so one unusual point can move it a long way.

Suppose week 5's applications were entered as 24 instead of 84, a single typing slip. Rerun the calculation: the mean drops to yˉ=56+72+68+70+245=2905=58\bar{y} = \frac{56 + 72 + 68 + 70 + 24}{5} = \frac{290}{5} = 58 applications, the deviations become -2, 14, 10, 12, and -34, and (yyˉ)2=4+196+100+144+1156=1600\sum (y - \bar{y})^2 = 4 + 196 + 100 + 144 + 1156 = 1600, so sy=1600/4=400=20s_y = \sqrt{1600/4} = \sqrt{400} = 20 applications.

The new z-scores for yy are -0.1, 0.7, 0.5, 0.6, and -1.7. Multiplying by the unchanged zxz_x column gives products of 0.10, -0.56, -0.10, 0.36, and -2.38, summing to -2.58, so

r=2.584=0.645r = \frac{-2.58}{4} = -0.645

One changed value flipped rr from +0.81+0.81 to 0.645-0.645. The last point carries most of the damage: its product alone is -2.38 out of a total of -2.58. Drag a point around in the influential point interactive and watch rr swing in real time.

What r does not tell you

A large rr answers one narrow question, and students routinely stretch it into claims it cannot support.

  • **rr only measures linear association.** A perfect U-shaped pattern can produce an rr near 0 even though xx predicts yy exactly. Always look at the scatterplot first.
  • **rr close to 1 does not mean a line is the right model.** The AP course says this outright in topic 5.2. A gently curved pattern can still return r=0.98r = 0.98, and only the residual plot exposes it, as shown in how to interpret residual plots.
  • **rr does not establish causation.** A relationship between two variables does not mean changes in one cause changes in the other, the point developed in correlation vs causation.
  • **rr is symmetric.** Swapping which variable you call xx and which you call yy leaves rr unchanged, because the formula multiplies the two z-scores and multiplication does not care about order. The slope bb does change, which is why the two are not interchangeable.

One arithmetic warning: use n1n - 1, not nn, as the divisor, and use sample standard deviations in the z-scores. Mixing the population divisor into one step and the sample divisor into another produces a value that is close to right and still wrong. Test yourself on the regression practice set.

Compute r by hand for five data points

An animal shelter recorded, for five weeks, the number of volunteer shifts filled (xx) and the number of adoption applications received (yy): (15, 56), (16, 72), (19, 68), (23, 70), (27, 84). Find rr using the z-score formula.

  1. Find the means. xˉ=15+16+19+23+275=1005=20\bar{x} = \frac{15+16+19+23+27}{5} = \frac{100}{5} = 20 shifts and yˉ=56+72+68+70+845=3505=70\bar{y} = \frac{56+72+68+70+84}{5} = \frac{350}{5} = 70 applications.

  2. Find the deviations. For xx: 5,4,1,3,7-5, -4, -1, 3, 7. For yy: 14,2,2,0,14-14, 2, -2, 0, 14. Each list sums to 0, a quick check that the means are right.

  3. Find sxs_x. (xxˉ)2=25+16+1+9+49=100\sum (x - \bar{x})^2 = 25 + 16 + 1 + 9 + 49 = 100, so sx=10051=25=5s_x = \sqrt{\frac{100}{5-1}} = \sqrt{25} = 5 shifts.

  4. Find sys_y. (yyˉ)2=196+4+4+0+196=400\sum (y - \bar{y})^2 = 196 + 4 + 4 + 0 + 196 = 400, so sy=40051=100=10s_y = \sqrt{\frac{400}{5-1}} = \sqrt{100} = 10 applications.

  5. Standardize xx. Divide each deviation by 5: zx=1.0,0.8,0.2,0.6,1.4z_x = -1.0, -0.8, -0.2, 0.6, 1.4.

  6. Standardize yy. Divide each deviation by 10: zy=1.4,0.2,0.2,0.0,1.4z_y = -1.4, 0.2, -0.2, 0.0, 1.4.

  7. Multiply the pairs. (1.0)(1.4)=1.40(-1.0)(-1.4) = 1.40; (0.8)(0.2)=0.16(-0.8)(0.2) = -0.16; (0.2)(0.2)=0.04(-0.2)(-0.2) = 0.04; (0.6)(0.0)=0.00(0.6)(0.0) = 0.00; (1.4)(1.4)=1.96(1.4)(1.4) = 1.96.

  8. Add the products. 1.400.16+0.04+0.00+1.96=3.241.40 - 0.16 + 0.04 + 0.00 + 1.96 = 3.24.

  9. Divide by n1=4n - 1 = 4. r=3.244=0.81r = \frac{3.24}{4} = 0.81.

  10. Verify with the equivalent sum-of-products form. (xxˉ)(yyˉ)=(5)(14)+(4)(2)+(1)(2)+(3)(0)+(7)(14)=708+2+0+98=162\sum (x-\bar{x})(y-\bar{y}) = (-5)(-14) + (-4)(2) + (-1)(-2) + (3)(0) + (7)(14) = 70 - 8 + 2 + 0 + 98 = 162, and 162100×400=162200=0.81\frac{162}{\sqrt{100 \times 400}} = \frac{162}{200} = 0.81, the same answer.

r=0.81r = 0.81. The positive sign and the size say that weeks with more volunteer shifts filled tended to bring in more adoption applications, with a fairly strong linear pattern. The value has no units, so it would stay 0.81 if shifts were recorded in half-shifts instead.

Recover r from a regression slope

A used-car listing site fits a least-squares line predicting price in thousands of dollars from a car's age in years. The output reports a slope of b=1.5b = -1.5 thousand dollars per year, with sx=4s_x = 4 years and sy=10s_y = 10 thousand dollars. Find rr and r2r^2.

  1. Start from the slope formula, b=rsysxb = r \cdot \frac{s_y}{s_x}, and solve for rr: r=bsxsyr = b \cdot \frac{s_x}{s_y}.

  2. Substitute. r=1.5×410=1.5×0.4=0.6r = -1.5 \times \frac{4}{10} = -1.5 \times 0.4 = -0.6.

  3. Check the sign. The slope is negative, and sxs_x and sys_y are positive, so rr has to be negative. It is.

  4. Check by going forward. b=0.6×104=0.6×2.5=1.5b = -0.6 \times \frac{10}{4} = -0.6 \times 2.5 = -1.5, matching the reported slope.

  5. Square it. r2=(0.6)2=0.36r^2 = (-0.6)^2 = 0.36.

r=0.6r = -0.6 and r2=0.36r^2 = 0.36. Older cars tend to list for less, a moderate negative linear relationship, and about 36% of the variation in listed price is explained by the linear relationship with age.

Frequently asked questions

Why divide by n - 1 instead of n?

Because the z-scores use sample standard deviations, which already use the n1n - 1 divisor. Keeping n1n - 1 throughout makes the identity zx2=n1\sum z_x^2 = n - 1 hold, which is exactly what forces rr to top out at 1. Dividing by nn instead would shrink every correlation slightly and could not reach 1.

Does r change if I swap x and y?

No. The formula multiplies zxz_x by zyz_y, and multiplication is symmetric, so relabeling the variables gives the identical value. The slope bb does change, because b=r(sy/sx)b = r(s_y/s_x) depends on which spread sits on top.

Do I have to compute r by hand on the AP exam?

No. The Fall 2026 course states that rr is calculated using technology, and a graphing calculator with statistical capability is expected. Working the z-score formula once is still worth it, because it explains why rr has no units, why it stops at 1, and why a single stray point can wreck it.

What happens if all the x-values are the same?

Then sx=0s_x = 0 and every zxz_x would require dividing by zero, so rr is undefined. That matches the picture: a vertical stack of points has no linear direction to describe, so there is no correlation to report.

Is r = 0.81 strong?

Strength is judged by how close rr sits to -1 or 1, so 0.81 counts as a fairly strong positive linear association. Avoid fixed cutoffs, though. Describe the strength, the direction, and the form you see in the scatterplot rather than leaning on a single label.