Question: how to calculate correlation between x and y?
Answer: Find the mean of all the x-values.
Find the standard deviation of all the x-values (call it sx) and the standard deviation of all the y-values (call it sy). ... 
For each of the n pairs (x, y) in the data set, take.
Add up the n results from Step 3.
Divide the sum by sx ∗ sy.