uniform moment generating function at t=0 I have calculated the moment generating function for the uniform distribution as
$$M_X(t)=\frac{e^{tb}-e^{ta}}{t(b-a)}$$
However I know $M_X(0)=1$ but I can't get my head around how this is possible as if $t=0$, the denominator $= 0$ and therefore the function is undefined, where am I going wrong?
 A: Technically speaking, 
$$
M_X(t)=\begin{cases}\displaystyle \frac{e^{tb}-e^{ta}}{t(b-a)} & \text{if $t\neq 0$}\\ 1 & \text{if $t=0$}\end{cases}.
$$
If you look through the calculations that you used to come up with the MGF, you'll find that there's one point where you've divided by $t$... meaning that you would've needed to handle the case $t=0$ separately.
We don't tend to sweat this very much, however, because $M_X(t)\rightarrow1$ as $t\rightarrow0$ -- that is, your version of $M_X(t)$ has a removable discontinuity at $t=0$.
A: The numerator $e^{tb}-e^{ta}$ is also $0$ when $t=0$, so you should take a different approach, such as looking at the limit as $t \to 0$.
For small $t$, $\dfrac{e^{tb}-e^{ta}}{t(b-a)} \approx  \dfrac{1+tb+t^2b^2/2 - 1-ta-t^2a^2/2}{t(b-a)} = 1 + \frac{b+a}{2}t$, 
so it is reasonable for it to take the value $1$ when $t=0$
or using L'Hôpital's rule, $\lim \limits_{t \to 0}\dfrac{e^{tb}-e^{ta}}{t(b-a)} =  \lim \limits_{t \to 0}\dfrac{be^{tb}-ae^{ta}}{b-a} = \dfrac{b-a}{b-a}=1$.
A: Recall that the moment generating function $M_X(t)$ is given by
$$M_X(t)=E(e^{Xt}).$$
Put $t=0$. Then $e^{Xt}=e^0=1$. And of course $E(1)=1$, for any probability distribution.
Remark: A standard calculation shows that 
$$M_X(t)=\frac{e^{tb}-e^{ta}}{t(b-a)}$$
if $t\ne 0$. 
It is not hard to verify, say using L'Hospital's Rule, that
$$\lim_{t\to 0}\frac{e^{tb}-e^{ta}}{t(b-a)}=1.$$
Thus the function $\frac{e^{tb}-e^{ta}}{t(b-a)}$ has a removable singularity at $t=0$. The full moment generating function $M_X(t)$ is the only function which is $\frac{e^{tb}-e^{ta}}{t(b-a)}$ when $t\ne 0$ and which is continuous at $0$. 
