Moment Generating Function of Continuous Uniform Distribution

Theorem

Let $X \sim \operatorname U \left[{a \,.\,.\, b}\right]$ for some $a, b \in \R$, $a \ne b$, where $\operatorname U$ is the continuous uniform distribution.

Then the moment generating function of $X$, $M_X$ is given by:

$\displaystyle M_X \left({t}\right) = \begin{cases} \dfrac{ e^{t b} - e^{t a} } {t \left({b - a}\right)} & t \ne 0 \\ 1 & t = 0 \end{cases}$

Proof

From the definition of the continuous uniform distribution, $X$ has probability density function:

$\displaystyle f_X \left({x}\right) = \begin{cases} \dfrac 1 {b - a} & a \le x \le b \\ 0 & \text{otherwise} \end{cases}$

From the definition of a moment generating function:

$\displaystyle M_X \left({t}\right) = \mathbb E \left[{ e^{t X} }\right] = \int_{-\infty}^\infty e^{tx} f_X \left({x}\right) \rd x$

First, consider the case $t \ne 0$.

Then:

 $\ds M_X \left({t}\right)$ $=$ $\ds \int_{-\infty}^a 0 e^{t x} \rd x + \int_a^b \frac{ e^{t x} } {b - a} \rd x + \int_b^\infty 0 e^{t x} \rd x$ $\ds$ $=$ $\ds \left[{ \frac { e^{t x} } {t \left({b - a}\right)} }\right]_a^b$ Primitive of $e^{a x}$, Fundamental Theorem of Calculus $\ds$ $=$ $\ds \frac{ e^{t b} - e^{t a} } {t \left({b - a}\right)}$

In the case $t = 0$, we have $\mathbb E \left[{X^0}\right] = \mathbb E \left[{1}\right] = 1$.

$\blacksquare$