[Math] Moment generating function for the uniform distribution

probability theory

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?

Best Answer

The density is $\frac{1}{b-a}$ on $[a,b]$ and zero elsewhere. So integrate from $a$ to $b$. Or else integrate from $-\infty$ to $\infty$, but use the correct density function. From $-\infty$ to $a$, for example, you are integrating $(0)e^{tx}$. The same is true from $b$ to $\infty$. The only non-zero contribution comes from $$\int_a^b\frac{1}{b-a}e^{tx}\,dx.$$

Related Question