Correlation Co-efficient : Bivariate Continuous Probability Distribution?

I am facing a problem to understand the formula to compute var(x) (variance of x). Any help in this regard would be highly appreciate

$\displaystyle

f(x,y) = x^{2}+\frac{xy}{3}, 0 < x < 1, 0 < y < 2, 0 \ elsewhere

$

Find var(x), var(y)

**Solution:**

$\displaystyle

g(x) = \int^{\infty}_{-\infty} f(x,y) dy = 2x^{2}+\frac{2}{3}x

$

$\displaystyle

h(y) = .......

$

$\displaystyle

E(x) = \int^{\infty}_{-\infty} x.g(x) dx = \frac{13}{18}

$

$\displaystyle

E(y) = ......

$

$\displaystyle

var(x) = E[x-E(X)]^2

$

$\displaystyle

= E(x-E(X))^2

$

$\displaystyle

= \int^{\infty}_{-\infty} (x-E(x))^2 . g(x) dx

$

$\displaystyle

= \int^{1}_{0} (x-\frac{13}{18})^2 . (2x^{2}+\frac{2x}{3}) dx

$

I am unable to understand how $\displaystyle

E(x-E(X))^2$ equals $\displaystyle \int^{\infty}_{-\infty} (x-E(x))^2 . g(x) dx$ ?

Any detail, derivation even a link would be greatly helpful.

Thank you.