One of the formulae for coefficient of correlation is given as

-----eq(1)

For coding method of bivariate frequency table, it's given as

-----eq(2)

I need to derive eq(2).

I began by , wherecis class interval, and and got

, similarly , but I do not know how to get to

I have a hunch that I need to make a table, but how?

Can anyone point me in the right direction?