We start with a raw table of values and for each value, a probability of getting that value.

x |
1 |
2 |
3 |
4 |
5 |

P(X=x) |
0.1 |
0.3 |
0.15 |
0.25 |
0.2 |

From this table we can find

There are formulae for and They are

Suppose we need to find and

No matter how we transform the variables x and y, the correlation coefficient remains the same. The coefficient for the transformed variables is the same as for the original variables. The correlation coefficient is a fundamental property of the relationship and does not depend on the coordinates we are using.