# What is the expected value of the random variable with the following pdf

Let $X$ be a random variable with pdf $$f(x \mid \sigma) = \dfrac{1}{2\sigma}\exp\left(-\dfrac{|x|}{\sigma}\right)\text{, } x \in (-\infty, \infty)\text{, }\sigma > 0\text{.}$$

Here are my steps: $$E(X) = \int^{∞}_{-∞}\frac{xe^\frac{-|x|}{σ}}{2σ}dx = \int^{0}_{-∞}\frac{xe^\frac{x}{σ}}{2σ}dx + \int^{∞}_{0}\frac{xe^\frac{-x}{σ}}{2σ}dx = [\frac{1}{2}(\frac{x}{σ} - 1)e^\frac{x}{σ}]|^{0}_{-∞} - [\frac{1}{2}(\frac{x}{σ} + 1)e^\frac{-x}{σ}]|^{∞}_{0} = \frac{1}{2}(-1) - \frac{1}{2} = -1$$

But this doesn't make sense... Where did I go wrong? I'm very confused!

• for the first integral you forgot the minus sign
– Alex
Feb 7, 2015 at 21:51
• I just forgot to type it, I just fixed it
– PPDS
Feb 7, 2015 at 21:56
• @PPDS, the $-\frac{1}{2}$ just before the final "$=$" should be $\frac{1}{2}$; evaluating the antiderivative at the lower limit of integration should introduce an additional minus which should make this term positive. This is a reason why you should be careful to use that minus sign that is part of the second antiderivative. More trivially, your antiderivatives are off by a factor of $\sigma$, although this does not change the answer fundamentally.
– ki3i
Feb 7, 2015 at 23:43

Here $f(x) = \frac{1}{2\sigma} e^{-\frac{|x|}{\sigma}};\quad -\infty < x < \infty,\quad \sigma > 0$.
Now, $$\begin{eqnarray} E(X) &=& \frac{1}{2\sigma} \int_{-\infty}^{\infty} x e^{-\frac{|x|}{\sigma}} dx\\ &=& \frac{1}{2\sigma} \int_{-\infty}^{0} x e^{-\frac{|x|}{\sigma}} dx + \frac{1}{2\sigma} \int_{0}^{\infty} x e^{-\frac{|x|}{\sigma}} dx\\ &=& I_1 + I_2\\ \end{eqnarray}$$ Note that $$\begin{eqnarray}|x| &=& x; \quad x>0\\ &=& -x; \quad x<0\end{eqnarray}$$
First consider $I_1$: $$\begin{eqnarray} I_1 &=& \frac{1}{2\sigma} \int_{-\infty}^{0} x e^{-\frac{|x|}{\sigma}} dx\\ &=& \frac{1}{2\sigma} \int_{-\infty}^{0} x e^{\frac{x}{\sigma}} dx\\ &=& \frac{1}{2\sigma}\left[\left\{x\int e^{\frac{x}{\sigma}}dx\right\}_{-\infty}^0 - \int_{-\infty}^0 \left\{\frac{d}{dx}x \int e^{\frac{x}{\sigma}}dx\right\}dx\right]; \text{by partial integration}\\ &=&0 \end{eqnarray}$$
Next consider $I_2$: $$\begin{eqnarray} I_2 &=& \frac{1}{2\sigma} \int_{0}^{\infty} x e^{-\frac{|x|}{\sigma}} dx\\ &=& \frac{1}{2\sigma} \int_{0}^{\infty} x e^{-\frac{x}{\sigma}} dx \end{eqnarray}$$
Taking $\frac{x}{\sigma} = u$, this integral becomes simply $\frac{\sigma}{2}$.
Hence the actual expectation is $\frac{\sigma}{2}$.