I've seen several videos, Khan Academy included, explaining the correlation coefficient formula but none explain the "logic" behind the formula, not to my satisfaction anyways.

The Formula: r = 1 / n-1 ∑(x z-score)(y z-score) condensed the formula a bit for the z-scores

As I have it understood, the r coefficient is the average of the product of the z-scores


  1. But why? What is the logic behind finding the average product of the z-scores?

  2. What does the first part of the equation mean? 1 / n-1 the denominator looks like the sample population but why have 1 divided by the sample population?


The answer(s) I'm looking for would be something like, "We need to calculate the correlation between x and y and in order to do that we need to..." In other words, in intuitive approach to explaining the why of the formula.

Thank you all in advance.

  • $\begingroup$ I think an honest explanation has to have more than one English sentence with no symbols. I have tried to give an intuitive account of this in my Answer. $\endgroup$ – BruceET Dec 29 '18 at 23:41

Here is a scatterplot of 100 points, both x-values and y-values are roughly standard normal (that is, they are z-scores).

enter image description here

Notice in particular the first point, which is circled in red, roughly at $(0.41, 0.18)$ in the upper-right quadrant. It's contribution to the total $T = \sum_i x_iy_1$ is $x_1y_1 = 0.41(0.18) = +0.0738.$

In upper-right quadrant, all points have $x_i > 0$ and $y_i > 0$ and so they will all make positive contributions to $T.$

Similarly, points in the lower-left quadrant will all have $x_i < 0$ and $y_i < 0$ (both coordinates negative), so they will also all make positive contributions to $T.$

By contrast, the points in the other two quadrants will have one positive and one negative coordinate, so they will make negative contributions to the sum $T.$

In our sample, the correlation is positive. That is when $x$-values increase than corresponding $y$-values also tend to increase. Specifically, for the points in the figure $r = +0.567.$ The total $T$ has both positive and negative contributions, but the positive contributions win out because there are many more points in the upper-right and lower-left quadrants than in the other two quadrants.

If all 100 points were on an upward-sloping diagonal line through the origin, then all points would make positive contributions towards the correlation. The largest possible result.

One can prove mathematically that the regression coefficient $r = \frac{1}{n-1}T$ is always between $-1$ and $+1.$ That is, $ -1 \le r \le 1.$

One reason for dividing $T$ by $n - 1$ is so that this convenient rule will hold true. [The denominator has to depend on $n$ because as we add more points to the plot, the total $T$ tends to become increasing large in absolute value.]

Note: Technically, the reason it's $n-1$ instead of $n$ is that in computing $z$-scores we divide by the the two sample standard deviations, both of which have $n-1$ in their denominators: $$r = \frac{1}{n=1}T = \frac{1}{n-1}\sum_i \left(\frac{X_i-\bar X}{S_x}\right) \left(\frac{Y_i -\bar Y}{S_y}\right),$$ where $S_x^2 = \frac{1}{n-1}\sum_i (X_i - \bar X)^2,$ and similarly for $S_y^2.$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.