# Am I doing something wrong with these moment generating functions?

I'm told to find the moment generating function of the pdf $6x(1-x)$, $0<x<1$, and I found $$\frac{6te^t-12e^t+6t+12}{t^3}$$ Then it asks to find the expected value, and as anyone else would have done I took the derivative of this annoyingly long derivative and it turns out that at $t=0$ the function equals $0$ as well. But my book says its $\frac12$. Am I doing something wrong?

-
It explicitly asked to do it using $M_X(t)$. – TheHopefulActuary Nov 30 '12 at 15:26
The mgf is differentiable at zero (once you add the fact that it equals 1 at $t=0$), and I get 1/2 as its derivative. Perhaps you should describe how you computed the derivative, since there is most likely an error somewhere in there. – Nate Eldredge Nov 30 '12 at 15:30
@Nate Eldredge: Yes, you're absolutely right. Removed my comment accordingly. – Stefan Hansen Nov 30 '12 at 15:31

Your expression for the moment generating function is right. In a burst of masochism, I found the derivative, which turns out to be $$\frac{1}{t^4}\left(6e^t(t^2-4t+6)-12t-36\right).\tag{1}$$ We want to "evaluate" this at $t=0$. There is the unpleasant issue of the $t^4$ in the denominator. What we really want to do is to find the limit of the function $(1)$ as $t\to 0$.

This is a simple matter, just apply L'Hospital's Rule $4$ times. That's actually not how I did it. We can use the first four terms $$1+t+\frac{t^2}{2}+\frac{t^3}{6}+\frac{t^4}{24}$$ of the Taylor series for $e^t$. Multiply by $6$. The numerator becomes $$\left(6+6t+3t^2+t^3+\frac{t^4}{4}\right)(t^2-4t+6)-12t-36.$$

Now do the multiplication. The constant term and the coefficients of $t$, $t^2$, and $t^3$ are all $0$. The coefficient of $t^4$ is $\dfrac{1}{2}$. Now divide by $t^4$, and we are finished. If you like, insert $O(t^5)$ in the appropriate places.

Remark: Taking the derivative was a waste of time. I was just trying to show that we can push things through in that way.

The sensible thing is to start with the mgf, and find the coefficient of $t$ in its Taylor expansion. We can use the expansion of $e^t$, directly on the mgf, without differentiating. The calculation is very short. If we expand $e^t$ to enough places, the numerator of the mgf is $$6t\left(1+t+\frac{t^2}{2}+\frac{t^3}{6}\right)-12\left(1+t+\frac{t^2}{2}+\frac{t^3}{6}+\frac{t^4}{24}\right)+6t+12.$$ Scan the terms. The terms up to the one in $t^2$ are $0$. The coefficient of $t^4$ is $\dfrac{1}{2}$, and therefore the coefficient of $t$ in the mgf is $\dfrac{1}{2}$.

We can read off all the higher moments in the same way.

-
Nicely explained. And I laughed out loud at "in a burst of masochism." :) – Mike Spivey Nov 30 '12 at 18:00