Given is a two-dimensional random variable $(X,Y)$. Here is the table of single probabilities $p_{ij}$ of $(X,Y)$ which was incomplete and I filled it with needed values so it's correct and complete.
\begin{array}{r|rrrr|r} X\setminus Y & 1 & 2 & 3 & 4 & p_i \\ \hline -1 & 0 & 0.01 & 0.09 & 0.10 & 0.2 \\ 0 & 0.6 & 0.03 & 0 & 0.07 & 0.7 \\ 1 & 0 & 0.06 & 0.01 & 0.03 & 0.1 \\ \hline p_j & 0.6 & 0.1 & 0.1 & 0.2 & 1 \\ \end{array}
Now I want calculate correlation between $X$ and $Y$ but not know how do it correctly? Because it can be asked in exam and I don't see example for it.
When I understand it correct I need find expected values of $X$ and $Y$, e.g. $E(X)$ and $E(Y)$ then
$$\mathrm{correlation}(X,Y)=E(XY) - E(X) \cdot E(Y).$$
Assuming this is correct, I still have no idea how compute these expected value from the table :(
We know that $$E(X) = \sum xp(x) = - 0.2+0+0.1=-0.1$$ $$E(X^2) = 0.2+0+0.1=0.3$$ $$E(Y)= \sum yp(y) = 0.6+0.2+0.3+0.8=1.9$$ $$E(Y^2) = 0.6+0.4+0.9+3.2=5.1$$ $$E(XY) = \sum xyp(x, y) = - 0.18$$ Hence, $$\operatorname{Cov} (X, Y) = E(XY) - E(X) E(Y) = 0.01$$ $$\sigma_x^2 = E(X^2)-[E(X)]^2 = 0.29$$ $$ \sigma_y^2 = E(Y^2)-[E(Y)]^2 = 1.49$$ Therefore, $$r_{XY} = \frac{0.01}{\sqrt{1.49\times 0.29}} = 0.015$$