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:

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