Solved – Generate Moments of Continuous Uniform Distribution with Moment Generating Functions

moment-generating-functionmoments

I am having trouble generating moments from the moment generating function of the uniform.

By the definition of M.G.F, we can calculate:
$$
M(t) = \begin{cases}
\frac{e^{tb} – e^{ta}}{tb-ta} : t \ne 0 \\
1 : t=0
\end{cases}
$$

However, generating moments involves taking the nth derivative and then setting t=0. If I take the derivative of the $t \ne 0$ case, the derivative is not defined when $t=0$; if I take the derivative of the $t=0$ case, the derivative is 0. The mgf is not generating moments for uniform distribution.

Best Answer

As you say, the derivatives of $M(t)$ are not defined at $t=0$.

For $t\ne 0$, the first derivative for example is $$M'(t)=\frac{1}{t^2(b-a)}\left[e^{tb}(tb-1)-e^{ta}(ta-1)\right]$$

But note that $M'(t)\to \frac{a+b}{2}$ as $t\to 0$, so $M'(t)$ has a removable discontinuity at $t=0$.

So just like $M(t)$ itself, we define

$$M'(t)=\begin{cases} \frac{1}{t^2(b-a)}\left[e^{tb}(tb-1)-e^{ta}(ta-1)\right]&,\text{ if }t\ne 0 \\\frac{a+b}{2}&,\text{ if }t=0 \end{cases}$$

Hence the first moment is given by $$E[X]=M'(0)=\lim_{t\to 0}M'(t)$$

If you do this from definition, you will end up with the same result:

$$M'(0)=\lim_{t\to 0}\frac1t \left[M(t)-M(0)\right]=\frac{a+b}{2}$$

We define the $r$th order derivative $M^{(r)}(t)$ similarly so that it is continuous at $0$.

And the $r$th order moment of $X$ for $r\in \mathbb N$ is given by

$$E[X^r]=M^{(r)}(0)=\lim_{t\to 0}M^{(r)}(t)$$