when is the expectation of absolute value of X equal to the expectation of X? If X is a continuous random variable, under what conditions is the following condition true E[|x|] = E[x] ? 
 A: Answered in comments:  
If $X$ only takes nonnegative values, then $X=|X|$ always. And I guess if it takes negative values only in a zero-measure set it is also true that $E[|X|]=E[X]$, but you should prove it properly. – Anna SdTC 
Hint: by definition, $E(X)=E(X^+)−E(X^−)$ where $X^+=(|X|+X)/2$ and $X^−=(|X|−X)/2$. (Both expectations involve non-negative random variables. This identity enables us to extend the definition of integrals of non-negative random variables to integrals of any random variables.) Your condition implies $E(X)=E(X^+)$, so you may immediately deduce $E(X^−)=0$. What can you say about any non-negative random variable whose expectation is zero?  – whuber 
A: $$
E[X] = \int_{-\infty}^\infty x f(x) dx = \int_{-\infty}^0 x f(x) dx + \int_0^\infty x f(x) dx
$$
$f(x)$ is a non-negative density so $x f(x) \ge 0$ if $x \ge 0$ and $x f(x) \le 0$ if $x \le 0$. Thus the first integral is $\le 0$ and second integral is $\ge 0$. Intuitively, positive values of $X$ pull the average up and negative values of $X$ pull the average down.
For $E[|X|]$ we may use the Law of the Unconscious Statistician to find we are integrating over $|x| f(x)$ which is always non-negative. Then you should be able to determine when $E[|X|] = E[X]$.
