Beware:
If we need to take a function of a random variable,
we cannot in general say that the expectation of the function is
the function of the expectation, look for instance at
the function g(X)=X2, for the random variable
X which takes on -1 with probability 1/5,
+1 with probability .3,
and 0 with probability 1/2.
For this random variable E[X]=.1 and E[X2]=.5 which is NOT the same as .01=(E[X])2.
For any two random variables X and Y,
we have:
Only for independent random variables do we have