The Problem: Consider the family of distributions with density $f(x) = \frac{1}{2\theta} exp[-\frac{|x|}{\theta}] , x \in (-\infty, \infty)$. Compute $E(|x|)$.
The Attempt: I was going to examine the cases when x is positive and when x is negative. When $x>0$, then $E(X) = \int_{0}^{\infty} x \frac{1}{2\theta} exp[-\frac{x}{\theta}] dx$. I am actually having a hard time integrating this function. Can you guys give some hints on how to solve this problem. Please do not work on the problem completely.
Thank you very much!
Since $|X| = X\mathsf 1_{\{X\geqslant0\}} -X\mathsf 1_{\{X<0\}}$, it follows that $$ \mathbb E[|X|] = \int_0^\infty xf(x)\ \mathsf dx + \int_{-\infty}^0 xf(-x)\ \mathsf dx.$$ Since $f$ is an even function $f(x)=f(-x)$ for all $x$, the above simplifies to \begin{align} 2\int_0^\infty xf(x)\ \mathsf dx &=2\int_0^\infty\frac1{2\theta} x e^{-\frac x\theta}\ \mathsf dx\\ &=\int_0^\infty \frac1\theta x e^{-\frac x\theta}\ \mathsf dx\\ &=\theta. \end{align}