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 measures the strength and direction of the linear association between two quantitative variables. Written with z-scores, the formula is short:
The symbol (capital sigma) means "add up over all the data points", and the two z-scores are
where (x-bar) and (y-bar) are the sample means and and 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 as the divisor.
If standardizing is new, work through how to find a z-score first, and standard deviation by hand for the and step.
Why this formula makes r unitless and bounded
Units cancel inside every z-score. If is measured in volunteer shifts, then is in shifts and is in shifts, so the ratio is a pure number. The same happens for . Multiplying two pure numbers gives a pure number, so has no units at all. That is why switching from inches to centimeters, or from dollars to euros, leaves completely unchanged, a point spelled out in does changing units change r.
The bound comes from a sum you can check. For any sample, exactly, because rearranges to , and dividing through by leaves . The same holds for .
Now ask how large could possibly be. The products are largest when matches at every point, which gives and therefore . The most negative case is everywhere, giving . Every other arrangement falls between, so , inclusive.
The AP course states the same two facts about 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 , 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: and , so the product is positive.
- Lower left: and , 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 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 . A cloud in the other two quadrants produces mostly negative products and a negative . Points scattered evenly across all four quadrants produce products that cancel, pushing 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 () and the number of adoption applications received (). The summary statistics are shifts, shifts, applications, and applications; the worked example below derives them.
| Week | (shifts) | (applications) | |||
|---|---|---|---|---|---|
| 1 | 15 | 56 | -1.0 | -1.4 | 1.40 |
| 2 | 16 | 72 | -0.8 | 0.2 | -0.16 |
| 3 | 19 | 68 | -0.2 | -0.2 | 0.04 |
| 4 | 23 | 70 | 0.6 | 0.0 | 0.00 |
| 5 | 27 | 84 | 1.4 | 1.4 | 1.96 |
| Total | 100 | 350 | 0.0 | 0.0 | 3.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 and . Week 3 is below both means too, a small positive .
Week 2 has fewer shifts than average but more applications than average, the one dissenting vote at . Week 4 sits exactly at the mean number of applications, so and it contributes nothing.
Add the products and divide by :
Two checks confirm the table. Both z-score columns sum to 0, which they must, since deviations from a mean always cancel. And while , matching the 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 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
so rearranging gives
For the shelter data, applications per shift. Going back the other way, , which returns the value from the table. Notice that and always share a sign, since and are never negative. More on that line in least-squares regression line.
A third route starts from , the coefficient of determination. Here , so about 65.61% of the variation in applications is explained by the linear relationship with shifts. Going backward from to 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 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 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 applications, the deviations become -2, 14, 10, 12, and -34, and , so applications.
The new z-scores for are -0.1, 0.7, 0.5, 0.6, and -1.7. Multiplying by the unchanged column gives products of 0.10, -0.56, -0.10, 0.36, and -2.38, summing to -2.58, so
One changed value flipped from to . 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 swing in real time.
What r does not tell you
A large answers one narrow question, and students routinely stretch it into claims it cannot support.
- ** only measures linear association.** A perfect U-shaped pattern can produce an near 0 even though predicts exactly. Always look at the scatterplot first.
- ** 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 , and only the residual plot exposes it, as shown in how to interpret residual plots.
- ** 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.
- ** is symmetric.** Swapping which variable you call and which you call leaves unchanged, because the formula multiplies the two z-scores and multiplication does not care about order. The slope does change, which is why the two are not interchangeable.
One arithmetic warning: use , not , 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 () and the number of adoption applications received (): (15, 56), (16, 72), (19, 68), (23, 70), (27, 84). Find using the z-score formula.
Find the means. shifts and applications.
Find the deviations. For : . For : . Each list sums to 0, a quick check that the means are right.
Find . , so shifts.
Find . , so applications.
Standardize . Divide each deviation by 5: .
Standardize . Divide each deviation by 10: .
Multiply the pairs. ; ; ; ; .
Add the products. .
Divide by . .
Verify with the equivalent sum-of-products form. , and , the same answer.
. 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 thousand dollars per year, with years and thousand dollars. Find and .
Start from the slope formula, , and solve for : .
Substitute. .
Check the sign. The slope is negative, and and are positive, so has to be negative. It is.
Check by going forward. , matching the reported slope.
Square it. .
and . 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 divisor. Keeping throughout makes the identity hold, which is exactly what forces to top out at 1. Dividing by instead would shrink every correlation slightly and could not reach 1.
Does r change if I swap x and y?
No. The formula multiplies by , and multiplication is symmetric, so relabeling the variables gives the identical value. The slope does change, because 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 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 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 and every would require dividing by zero, so 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 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.