\documentclass[a4paper,12pt]{article}
\begin{document}

QUESTION
  Find the mgf for a random variable which is uniform on the
  interval $a<x<b$. Use the mgf to find the mean and variance of
  the distribution.


ANSWER
 $f(x)=\frac{1}{b-a}\ a<x<b$\\
  \begin{eqnarray*}
   M(t)&=&\int_a^b\frac{e^{xt}}{b-a}\,dx\\
   &=&\frac{1}{t}[\frac{e^{xt}}{b-a}]_a^b\\
   &=&\frac{e^{bt}-e^{at}}{t(b-a)}\\
   &=&\frac{1}{t(b-a)}[(1+bt+\frac{(bt^2)}{2!}+\frac{(bt)^3}{3!}+\ldots
   )-(1+at+\frac{(at)^2}{2!}+{(at)^3}{3!}\\
   &=&\frac{1}{t(b-a)}[(b-a)t+\frac{t^2}{2!}(b^2-a^2)+\frac{t^3}{3!}(b^3-a^3)+\ldots]\\
   &=&1+\frac{t(b+a)}{2}+\frac{t^2}{3!}(b^2+ab+a^2)+\ldots
  \end{eqnarray*}
  $\mu$= the coefficient of t =$\frac{b+a}{2}\ \ E(X^2)=2!\times$
  the coefficient of t62=$\frac{b^2+ab+a^2}{3}\\
  \sigma^2=\frac{b^2+ab+a^2}{3}-\frac{(b+a)^2}{4}=\frac{(b-a)^2)}{12}$
  Note that differentiation doesn't work well here because of
  difficulties at t=0.

\end{document}
