Let a continuous random variable be f(x) at (a, b) and 0 at other places, and divide f(x) into countless points, each of which is dx, and the corresponding X value of each point is X 1, X2, X3. ...
Then its expected ex = x1f (x1) dx+x2f (x2) dx+ ....
This is the integral of xf(x) on (a, b).