# Thread: Moment-generating function of a continuous variable

1. ## Moment-generating function of a continuous variable

I am having a tough time with these. For instance, take the following distribution: f(x) = 1, 0<x<1, and f(x) = 0 elsewhere. Now I was under the impression that I had to integrate (e^(tx) f(x) dx) over all values of x, which yields e^t / t. But the back of the book says that the moment generating function is (2e^t / (3 - e^t)). I have no clue how they got it. Is it simply a matter of integrating x from negative to positive infinity, instead of from 0 to 1? Or is there more to it than that?

2. ## Re: Moment-generating function of a continuous variable

Hey phys251.

The MGF(t) = E[e^(tX)]Integral (over all X) e^(tx)*f(x)dx for any continuous random variable.

This means that MGF(t) = Integral [0,1] e^(tx)*1*dx = (e^t)/t - 1/t = (e^t - 1)/t. Wikipedia confirms this:

http://en.wikipedia.org/wiki/Uniform...ating_function

3. ## Re: Moment-generating function of a continuous variable

Then why the heck does the back of the book say it's (2e^t)/(3 - e^t)??

4. ## Re: Moment-generating function of a continuous variable

I don't know but I as well as Wikipedia got a different answer: if your book is wrong then its wrong.

Try doing the calculation yourself and see what you get, and I recommend you plug the integral into Wolfram Alpha to get another confirmation.

www,wolframalpha.com