I thought that $M^r(0) = E[X^r]$, but for a uniform distribution the MGF is $\dfrac{e^{bt}-e^{at}}{(b-a)t}$, so there already is a singularity at $t=0$. So it would seem $M'(0) \neq E[X]$
Why is that?
I thought that $M^r(0) = E[X^r]$, but for a uniform distribution the MGF is $\dfrac{e^{bt}-e^{at}}{(b-a)t}$, so there already is a singularity at $t=0$. So it would seem $M'(0) \neq E[X]$
Why is that?
Hint: There is no problem at $0$, it just looks as if there might be. The singularity at $t=0$ is removable, and once we have removed it the mgf has a nice power series. Expand the exponentials in the numerator of the mgf in power series, using the ordinary series expansion of $e^x$.
The front terms are each $1$, and cancel. Then you can divide by $t$, and have the power series expansion of the mgf. From this you can read off the moments.
Remark: Once we have obtained the mgf, we hardly ever use repeated differentiation to find the moments. Most often, it is series expansion, adapting our knowledge of standard series.
Added: Using $e^{ct}=1+ct+\frac{c^2 t^2}{2}+\frac{c^3t^3}{6}+\cdots$, we find that the mgf is $\frac{1}{b-a}\left(\frac{\left(1+bt+\frac{b^2t^2}{2}+\frac{b^3t^3}{6}+\cdots\right)- \left(1+at+\frac{a^2t^2}{2}+\frac{a^3t^3}{6}+\cdots\right)}{t}\right).$ Simplify, cancelling the $t$. We get $\frac{1}{b-a}\left(b-a +\frac{b^2-a^2}{2}t+\frac{b^3-a^3}{6}t^2+\cdots \right).$ The coefficient of $t$ is $\dfrac{1}{b-a}\dfrac{b^2-a^2}{2}$, which simplifies to $\dfrac{a+b}{2}$.
Alternately, differentiate the series term by term, then set $t=0$.