Moment generating function of Laplace distribution step by step There are two similar posts but none of them helped me to get through the full derivation of the very simple MGF that should be according to Wikipedia:
$$
\frac {\exp(\mu t)}{1-b^{2}t^{2}}
$$
Here's my attempt:
Definition of MGF
$$
M_X(t) = \mathbb{E}\left[\exp(t X)\right]
$$
by LOTUS
$$
= \int \exp(t x) \cdot p(x) dx
$$
Plugging-in PDF
$$
= \int \exp(t x) \cdot \frac{1}{2b}\exp \left(- \frac{\mid x - \mu \mid }{b} \right) dx
$$
$$
= \frac{1}{2b} \int \exp(t x) \cdot \exp \left(- \frac{\mid x - \mu \mid }{b} \right) dx
$$
$$
= \frac{1}{2b} \int \exp \left(t x - \frac{\mid x - \mu \mid }{b} \right) dx
$$
getting rid of abs. value
$$
= \frac{1}{2b} \int_{-\infty}^{\mu} \exp \left(t x - \frac{ x - \mu  }{b} \right) dx
+ \frac{1}{2b} \int_{\mu}^{\infty} \exp \left(t x - \frac{- x + \mu  }{b} \right) dx
$$
the left integral first
$$
= \frac{1}{2b} \int_{-\infty}^{\mu} \exp \left(\frac{bt x - x - \mu  }{b} \right) dx
$$
$$
= \frac{1}{2b} \int_{-\infty}^{\mu} \exp \left(\frac{bt x - x  }{b} \right) \exp \left(\frac{- \mu  }{b} \right) dx
$$
$$
= \frac{1}{2b} \cdot \exp \left(\frac{- \mu  }{b} \right) \int_{-\infty}^{\mu} \exp \left(\frac{bt x - x  }{b} \right)  dx
$$
$$
= \frac{1}{2b} \cdot \exp \left(\frac{- \mu  }{b} \right) \int_{-\infty}^{\mu} \exp \left(\frac{ (bt  - 1)  }{b}  x \right)  dx
$$
Now since $\int e^{ax}\,dx={\frac {1}{a}}e^{ax}+C$
$$
= \frac{1}{2b} \cdot \exp \left(\frac{- \mu  }{b} \right) \cdot \left|  \frac{b}{ (bt  - 1)  } \cdot \exp \left(\frac{ (bt  - 1)  }{b}  x \right)  \right|_{-\infty}^{\mu}
$$
Let's evaluate the integral first
$$
\left|  \frac{b}{ (bt  - 1)  } \cdot \exp \left(\frac{ (bt  - 1)  }{b}  x \right) \right|_{-\infty}^{\mu}
$$
$$
= \frac{b}{ (bt  - 1)  } \cdot \exp \left(\frac{ (bt  - 1)  }{b}  (\mu) \right) 
-
\frac{b}{ (bt  - 1)  } \cdot \exp \left(\frac{ (bt  - 1)  }{b}  (-\infty)\right)
$$
Since $\lim_{x \rightarrow 0} e^{-x} = 0$, the second term is 0
$$
= \frac{b}{ (bt  - 1)  } \cdot \exp \left(\frac{ (bt  - 1)  }{b}  (\mu) \right) 
- 0
$$

Double check from WorlframAlpha:
$$
= \frac{b}{bt-1} \exp \left( \mu \left( t - \frac{1}{b} \right) \right)
$$
for $\frac{1}{b} < t$

Now the right-hand side integral:
$$
\frac{1}{2b} \int_{\mu}^{\infty} \exp \left(t x - \frac{- x + \mu  }{b} \right) dx
$$
$$
\frac{1}{2b} \int_{\mu}^{\infty} \exp \left(\frac{b t x + x - \mu  }{b} \right) dx
$$
$$
= \frac{1}{2b} \int_{\mu}^{\infty} \exp \left(\frac{b t x + x   }{b} \right) \exp \left(\frac{-\mu  }{b} \right)dx
$$
$$
= \frac{1}{2b} \cdot \exp \left(\frac{ -\mu  }{b} \right) \int_{\mu}^{\infty} \exp \left(\frac{b t x + x   }{b} \right) dx
$$
$$
= \frac{1}{2b} \cdot \exp \left(\frac{ -\mu  }{b} \right) \int_{\mu}^{\infty} \exp \left( \frac{b t + 1 }{b} x\right) dx
$$
Now evaluate the integral
$$
\int_{\mu}^{\infty} \exp \left( \frac{b t + 1 }{b} x\right) dx
$$
According to wolfram alpha
$$
= - \frac{b}{bt + 1}\exp\left(\mu \frac{1}{b + t}\right)
$$
for $\frac{1}{b} + t < 0$
Now sum-up these two integrals:
$$
= \frac{1}{2b} \cdot \exp \left(\frac{- \mu  }{b} \right) \cdot \frac{b}{ (bt  - 1)  } \cdot \exp \left(\frac{ (bt  - 1)  }{b}  (\mu) \right)  + \\
\frac{1}{2b} \cdot \exp \left(\frac{ -\mu  }{b} \right) \cdot \left( - \frac{b}{bt + 1}\exp\left(\mu \frac{1}{b + t}\right) \right)
$$
And simplify
$$
= \frac{1}{2b} \cdot \exp \left(\frac{- \mu  }{b} \right) \cdot \frac{b}{ (bt  - 1)  } \cdot \exp \left(\frac{ (bt  - 1)  }{b}  (\mu) \right)  - \\
\frac{1}{2b} \cdot \exp \left(\frac{ -\mu  }{b} \right) \cdot  \frac{b}{bt + 1} \cdot \exp\left(\mu \frac{1}{b + t}\right) 
$$
$$
= \frac{1}{2b} \cdot  \frac{b}{ (bt  - 1)  } \cdot \exp \left(\frac{- \mu  }{b} \right) \cdot \exp \left(\frac{ (bt  - 1)  }{b}  (\mu) \right)  - \\
\frac{1}{2b} \cdot   \frac{b}{bt + 1} \cdot \exp \left(\frac{ -\mu  }{b} \right) \cdot \exp\left(\mu \frac{1}{b + t}\right) 
$$
$$
= \frac{1}{b} \cdot  \frac{1}{ (bt  - 1)  } \cdot \exp \left(\frac{- \mu  }{b} \right) \cdot \exp \left(\frac{ (bt  - 1)  }{b}  (\mu) \right)  - \\
\frac{1}{b} \cdot   \frac{1}{bt + 1} \cdot \exp \left(\frac{ -\mu  }{b} \right) \cdot \exp\left(\mu \frac{1}{b + t}\right) 
$$
$$
= \frac{1}{b} \cdot  \frac{1}{ (bt  - 1)  } \cdot \exp \left(\frac{- \mu  }{b} +\frac{ (bt  - 1)  }{b}  (\mu) \right)  - \\
\frac{1}{b} \cdot   \frac{1}{bt + 1} \cdot \exp \left(\frac{ -\mu  }{b} + \mu \frac{1}{b + t}\right) 
$$
$$
= \frac{1}{b} \cdot  \frac{1}{ (bt  - 1)  } \cdot \exp \left( \mu \left(t - \frac{2}{b} \right) \right)  - \\
\frac{1}{b} \cdot   \frac{1}{bt + 1} \cdot \exp \left(\frac{ -\mu  }{b} + \mu \frac{1}{b + t}\right) 
$$
But I cannot move away from this ugly formula to the simple beauty. Is there just a stupid mistake above or am I doing something substantially wrong?
 A: Alright, here's the full correct solution if anyone is interested.
Definition of MGF
$$
M_X(t) = \mathbb{E}\left[\exp(t X)\right]
$$
by LOTUS
$$
= \int \exp(t x) \cdot p(x) dx
$$
Plugging-in PDF
$$
= \int \exp(t x) \cdot \frac{1}{2b}\exp \left(- \frac{\mid x - \mu \mid }{b} \right) dx
$$
$$
= \frac{1}{2b} \int \exp(t x) \cdot \exp \left(- \frac{\mid x - \mu \mid }{b} \right) dx
$$
$$
= \frac{1}{2b} \int \exp \left(t x - \frac{\mid x - \mu \mid }{b} \right) dx
$$
For integrating absolute value, we split the integral at $\mu$, such that it change the absolute values to

*

*for $x < \mu$: $\mid x - \mu \mid = -(x - \mu)$

*for $x \geq \mu$: $\mid x - \mu \mid = x - \mu$
$$
= \frac{1}{2b} \int_{-\infty}^{\mu} \exp \left(t x - \frac{-(x - \mu) }{b} \right) dx +
\frac{1}{2b} \int_{\mu}^{\infty} \exp \left(t x - \frac{x - \mu}{b} \right) dx
$$
$$
= \frac{1}{2b} \left( \int_{-\infty}^{\mu} \exp \left(\frac{b t x + x - \mu }{b} \right) dx +
\int_{\mu}^{\infty} \exp \left(\frac{btx - x + \mu}{b} \right) dx \right)
$$
$$
= \frac{1}{2b} \left(  \int_{-\infty}^{\mu} \exp \left(\frac{b t x + x - \mu }{b} \right) dx +
\int_{\mu}^{\infty} \exp \left(\frac{btx - x + \mu}{b} \right) dx \right)
$$
Let's solve the left-hand side integral first
$$
\int_{-\infty}^{\mu} \exp \left(\frac{b t x + x - \mu }{b} \right) dx
$$
$$
= \exp \left( \frac{-\mu}{b} \right) \int_{-\infty}^{\mu} \exp \left(\frac{b t x + x}{b} \right) dx
$$
$$
= \exp \left( \frac{-\mu}{b} \right) \int_{-\infty}^{\mu} \exp \left(\frac{x (b t + 1)}{b} \right) dx
$$
Now since $\int e^{ax}\,dx={\frac {1}{a}}e^{ax}+C$
$$
= \exp \left( \frac{-\mu}{b} \right) \frac{b}{bt + 1} \left| \exp \left(\frac{x (b t + 1)}{b} \right) \right|_{-\infty}^{\mu}
$$
When evaluating for $-\infty$, we need to have this limit converge:
$$
\lim_{x \rightarrow - \infty} \exp \left(x \frac{(b t + 1)}{b} \right)
$$
The constants have to be positive, so
$$
\frac{(b t + 1)}{b} > 0 \\
t > -\frac{1}{b}
$$
So let's evaluate and move on
$$
= \exp \left( \frac{-\mu}{b} \right) \frac{b}{bt + 1} \left( \exp \left(\frac{\mu (b t + 1)}{b} \right) - 0 \right)
$$
$$
= \exp \left( \frac{-\mu + \mu (b t + 1)}{b} \right) \frac{b}{bt + 1} 
$$
$$
= \exp \left( \frac{-\mu + \mu b t + \mu}{b} \right) \frac{b}{bt + 1} 
$$
$$
= \exp \left( \frac{\mu b t}{b} \right) \frac{b}{bt + 1} 
$$
$$
= \exp \left( \mu  t \right) \frac{b}{bt + 1} 
$$
Now the right-hand side integral:
$$
\int_{\mu}^{\infty} \exp \left(\frac{btx - x + \mu}{b} \right) dx
$$
$$
= \exp \left( \frac{\mu}{b} \right) \int_{\mu}^{\infty} \exp \left(\frac{btx - x}{b} \right) dx
$$
$$
= \exp \left( \frac{\mu}{b} \right) \int_{\mu}^{\infty} \exp \left(\frac{x(bt - 1)}{b} \right) dx
$$
And again since $\int e^{ax}\,dx={\frac {1}{a}}e^{ax}+C$
$$
= \exp \left( \frac{\mu}{b} \right) \frac{b}{bt - 1} \left| \exp \left(\frac{x(bt - 1)}{b} \right) \right|_{\mu}^{\infty}
$$
Again, for the integral to converge, we need to make sure that this goes to zero
$$
\lim_{x \rightarrow \infty} \exp \left(x \frac{(b t - 1)}{b} \right)
$$
So the constant have to be negative such that
$$
\frac{(b t - 1)}{b} < 0 \\
t < \frac{1}{b}
$$
Let's evalate and move on
$$
= \exp \left( \frac{\mu}{b} \right) \frac{b}{bt - 1} \left( 0 -\exp \left(\frac{\mu(bt - 1)}{b} \right)  \right)
$$
$$
= - \exp \left( \frac{\mu}{b} \right) \frac{b}{bt - 1} \exp \left(\frac{\mu(bt - 1)}{b} \right)
$$
$$
= - \exp \left( \frac{\mu}{b} \right) \frac{b}{bt - 1} \exp \left(\frac{\mu bt - \mu)}{b} \right)
$$
$$
= - \exp \left( \frac{\mu + \mu bt - \mu}{b} \right) \frac{b}{bt - 1}
$$
$$
= - \exp \left( \mu t  \right) \frac{b}{bt - 1}
$$
Now plug these two results in the original equation
$$
\frac{1}{2b} \left(  \int_{-\infty}^{\mu} \exp \left(\frac{b t x + x - \mu }{b} \right) dx +
\int_{\mu}^{\infty} \exp \left(\frac{btx - x + \mu}{b} \right) dx \right)
$$
$$
= \frac{1}{2b} \left(  \exp \left( \mu  t \right) \frac{b}{bt + 1} 
- \exp \left( \mu t  \right) \frac{b}{bt - 1} \right)
$$
$$
= \frac{1}{2b} \exp \left( \mu t  \right) \left(   \frac{b}{bt + 1} 
-  \frac{b}{bt - 1} \right)
$$
$$
= \exp \left( \mu t  \right) \left(   \frac{b}{2b(bt + 1)} 
-  \frac{b}{2b(bt - 1)} \right)
$$
$$
= \exp \left( \mu t  \right) \left(   \frac{1}{2(bt + 1)} 
-  \frac{1}{2(bt - 1)} \right)
$$
$$
= \frac{1}{2 }\exp \left( \mu t  \right) \left(   \frac{1}{bt + 1} 
-  \frac{1}{bt - 1} \right)
$$
$$
= \frac{1}{2 }\exp \left( \mu t  \right) \left(   \frac{(bt - 1) - (bt + 1)}{b^2 t^2 - 1}  \right)
$$
$$
= \frac{1}{2 }\exp \left( \mu t  \right) \left(   \frac{bt - 1 - bt - 1)}{b^2 t^2 - 1}  \right)
$$
$$
= \frac{1}{2 }\exp \left( \mu t  \right) \left(   \frac{- 2}{b^2 t^2 - 1}  \right)
$$
$$
= \exp \left( \mu t  \right) \left(   \frac{- 1}{b^2 t^2 - 1}  \right)
$$
$$
= \exp \left( \mu t  \right) \left(   \frac{1}{- b^2 t^2 + 1}  \right)
$$
$$
=     \frac{\exp ( \mu t  )}{1 - b^2 t^2} \qquad \square
$$
for $t < \frac{1}{b}$ and  $t > -\frac{1}{b}$, which we can rewrite as $t < \frac{1}{b}$ and  $- t < \frac{1}{b}$ and thus simplify to $|t| < \frac{1}{b}$.
A: There are a number of efficiencies that can be realized if we first consider the shifted exponential family $$f_Y(y) = \frac{1}{b} e^{-(y - \mu)/b}, \quad y \ge \mu$$ with location $\mu$ and scale $b > 0$.  The MGF is easy to calculate:  $$M_Y(t) = \int_{y=\mu}^\infty \frac{1}{b} e^{ty} e^{-y/b} e^{\mu/b} \, dy = \frac{e^{\mu/b}}{b} \int_{y=\mu}^\infty e^{-(1/b-t)y} \, dy = \frac{e^{\mu/b} e^{-(1/b - t)\mu}}{b(1/b-t)} = \frac{e^{\mu t}}{1 - bt} , \quad t < 1/b.$$  The MGF of $-Y$ is then $$M_{-Y}(t) = M_Y(-t) = \frac{e^{-\mu t}}{1 + bt}, \quad t > -1/b.$$
Now define the mixture density $$f_X(x) = \frac{1}{2} (f_{Y_1}(x) + f_{-Y_2}(x))$$ where $Y_1$ is shifted with location $\mu$, and $Y_2$ is shifted with location $-\mu$, and both share scale $b$.  Then it is easy to see $X$ is Laplace with location $\mu$ and scale $b$.  The MGF of $X$ is then $$M_X(t) = \frac{1}{2} \left( M_{Y_1}(t) + M_{-Y_2}(t) \right) = \frac{1}{2} \left( \frac{e^{\mu t}}{1 - bt} + \frac{e^{-(-\mu)t}}{1 + bt} \right) = \frac{e^{\mu t}}{1 - (bt)^2}, \quad |t| < 1/b.$$
In fact, this computation easily generalizes to the case where $Y_1$ and $Y_2$ do not have the same scale parameter, in which the distribution has nonzero skew.
