One of the formulae for coefficient of correlation is given as

$\displaystyle r=\frac{n\Sigma XY-(\Sigma X)(\Sigma Y)}{\sqrt{[N\Sigma X^2-(\Sigma X)^2][N\Sigma Y^2-(\Sigma Y)^2]}}$ -----eq(1)

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

$\displaystyle r=\frac{n\Sigma fu_Xu_Y-(\Sigma f_Xu_X)(\Sigma f_Yu_Y)}{\sqrt{[N\Sigma f_Xu_X^2-(\Sigma f_Xu_X)^2][N\Sigma f_Yu_Y^2-(\Sigma f_Yu_Y)^2]}}$ -----eq(2)

I need to derive eq(2).

I began by$\displaystyle \overline X=A+(\frac{\Sigma f_Xu_X}{n})c$, wherecis class interval, and $\displaystyle u=0, \pm1, \pm 2, ...$ and got

$\displaystyle \Sigma X = NA_x+c\Sigma f_xu_x $, similarly $\displaystyle \Sigma Y = NA_y+c\Sigma f_yu_y$, but I do not know how to get to $\displaystyle \Sigma XY$

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

Can anyone point me in the right direction?