Moment generating function for the uniform distribution Attempting to calculate the moment generating function for the uniform distrobution I run into ah non-convergent integral.
Building of the definition of the Moment Generating Function
$
M(t) = E[ e^{tx}] = \left\{ \begin{array}{l l}
\sum\limits_x e^{tx} p(x) &\text{if $X$ is discrete with mass function $p( x)$}\\
\int\limits_{-\infty}^\infty e^{tx} f( x) dx &\text{if $X$ is continuous with density $f( x)$}
\end{array}\right.
$
and the definition of the Uniform Distribution
$
f( x) = \left\{ \begin{array}{l l}
\frac{ 1}{ b - a} & a < x < b\\
0 & otherwise
\end{array} \right.
$
I end up with a non-converging integral
$\begin{array}{l l}
M( t) &= \int\limits_{-\infty}^\infty e^{tx} f(x) dx\\
&= \int\limits_{-\infty}^\infty e^{tx} \frac{ 1}{ b - a} dx\\
&= \left. e^{tx} \frac{ 1}{ t(b - a)} \right|_{-\infty}^{\infty}\\
&= \infty
\end{array}$
I should find $M(t) = \frac{ e^{tb} - e^{ta}}{ t(b - a)}$, what am I missing here?

The limits of integration are not correct. You should integrate from $a$ to $b$ not from $-\infty$ to $+\infty$.
