Deriving Mean and Variance of Laplace Distribution It has been a long time since I have used calculus, and I am trying to understand how the mean and variance of the Laplace distribution with pdf
$$f(x|\mu,\sigma) = \dfrac{1}{2 \sigma}\,e^{-\Large\frac{|x-\mu |}\sigma}$$ are derived.
I know that E$[X] = \mu$ and Var$[X] = 2\sigma^2$, but I don't understand how that happens. 
Many thanks.
 A: Standardizing the distribution will make the calculations much simpler.  Let $Y = (X - \mu)/\sigma$; then the PDF of $Y$ is $$f_Y(y) = f_X(\mu + \sigma y) \left| \frac{d}{dy}[\mu + \sigma y]\right| = \frac{1}{2}e^{-|y|}.$$  Hence $$\mathrm{E}[X] = \mathrm{E}[\mu + \sigma Y] = \mu + \sigma\mathrm{E}[Y].$$  But note that $$\int_{y=0}^\infty ye^{-y} \, dy = \Gamma(2) < \infty,$$ and $y f_Y(y)$ is an odd function, hence $\mathrm{E}[Y] = 0$ and $\mathrm{E}[X] = \mu$.
Similarly, the variance is best obtained through $Y$: it is a simple matter to compute the second moment of $Y$, since the integrand is an even function:  $$\mathrm{E}[Y^2] = \frac{1}{2} \int_{y=-\infty}^\infty y^2 e^{-|y|} \, dy = \int_{y=0}^\infty y^2 e^{-y} \, dy = \Gamma(3) = 2.$$  Consequently, $$\mathrm{Var}[X] = \mathrm{E}[(X - \mu)^2] = \sigma^2 \mathrm{E}[Y^2] = 2\sigma^2.$$
A: Recall that the support of a Laplace Distributed random variable $X$  is the real line, so we have to evaluate the following integral: 
$$E\left[X \right]=\int_{-\infty}^{\infty}x f_X(x) \mathrm{dx}= \int_{-\infty}^{\infty}x \dfrac{1}{2 \sigma}\,e^{-|x-\mu |/\sigma} \mathrm{dx}$$
I think that it is the absolute value that is confusing you here, yes?
The solution would be to split it into (disjoint) parts where the sign changes, that is get rid of the absolute value and evaluate them separately:
$$ \int_{-\infty}^{\infty}x \dfrac{1}{2 \sigma}\,e^{-|x-\mu |/\sigma} \mathrm{dx}= \int_{-\infty}^{\mu} \frac{x}{2 \sigma}e^\frac{x-\mu}{\sigma}\mathrm{dx}+\int_{\mu}^{\infty} \frac{x}{2 \sigma} e^{-\frac{x-\mu}{\sigma}}\mathrm{dx}$$
You can now proceed by employing integration by parts on each integral. This should give you the mean. 
For the variance you also need to use the same method and evaluate $E[X^2]$. You may then use the variance formula: $var(X)=E[X^2]-\left[ E[X] \right]^2$ to obtain your other result.
Hope this helps.
A: Let $u=x-\mu$, then we have $x=u+\mu$ and $dx=du$. By linearity we have $\operatorname{E}[X]=\operatorname{E}[U+\mu]=\operatorname{E}[U]+\mu$, hence
\begin{align}
\operatorname{E}[X]
&=\frac1{2\sigma}\int_{-\infty}^\infty u\  e^{-\Large\frac{|u|}{\sigma}}\ du+\mu\\
&=\frac1{2\sigma}\color{blue}{\underbrace{\color{black}{\int_{-\infty}^0 u\  e^{\Large\frac{u}{\sigma}}\ du}}_{\color{red}{\text{set}\ u=-u}}}+\frac1{2\sigma}\int_{0}^\infty u\  e^{-\Large\frac{u}{\sigma}}\ du+\mu\\
&=-\frac1{2\sigma}\int_{0}^\infty u\  e^{-\Large\frac{u}{\sigma}}\ du+\frac1{2\sigma}\int_{0}^\infty u\  e^{-\Large\frac{u}{\sigma}}\ du+\mu\\
&=\large\color{blue}{\mu}
\end{align}
and
\begin{align}
\operatorname{E}\left[X^2\right]&=\operatorname{E}\left[(U+\mu)^2\right]\\
&=\operatorname{E}\left[U^2\right]+2\mu\operatorname{E}\left[U\right]+\mu^2\\
&=\operatorname{E}\left[U^2\right]+2\mu\operatorname{E}\left[X-\mu\right]+\mu^2\\
&=\frac1{2\sigma}\int_{-\infty}^\infty u^2  e^{-\Large\frac{|u|}{\sigma}}\ du+\mu^2\\
&=\frac1{2\sigma}\color{blue}{\underbrace{\color{black}{\int_{-\infty}^0 u^2  e^{\Large\frac{u}{\sigma}}\ du}}_{\color{red}{\text{set}\ u=-u}}}+\frac1{2\sigma}\int_{0}^\infty u^2  e^{-\Large\frac{u}{\sigma}}\ du+\mu^2\\
&=\frac1{2\sigma}\int_{0}^\infty u^2  e^{-\Large\frac{u}{\sigma}}\ du+\frac1{2\sigma}\int_{0}^\infty u^2  e^{-\Large\frac{u}{\sigma}}\ du+\mu^2\\
&=\frac1{\sigma}\color{blue}{\underbrace{\color{black}{\int_{0}^\infty u^2  e^{-\Large\frac{u}{\sigma}}\ du}}_{\color{red}{\text{set}\ v=\frac{u}{\sigma}}}}+\mu^2\\
&=\sigma^2\int_{0}^\infty v^2  e^{-v}\ dv+\mu^2\\
&=2\sigma^2+\mu^2,
\end{align}
where
$$
\Gamma(n+1)=\int_{0}^\infty v^{n}  e^{-v}\ dv=n!\qquad,\qquad\text{for $n$ natural number}.
$$
Thus
\begin{align}
\operatorname{Var}[X]&=\operatorname{E}\left[X^2\right]-\left(\operatorname{E}[X]\right)^2=\large\color{blue}{2\sigma^2}.
\end{align}
