Find the MGF of a random variable given its pdf

**Note**: This forms part of an assignment I'm on the hook for, so I'm really looking for pointers on where I'm going wrong as opposed to just a 'here's your answer' reply

The Problem: we have a random variable with a known probability density function:

f(x) = c*x^2, for (0 <= x <= 1), f(x) is 0 otherwise.

I can find c, and subsequently determine the Expected Value (E(X)) of the r.v. using moments approach (ie: integrating for (x*f(x)) to find E(X) in this case). *BUT* to verify my result, I'm trying to determine the Moment Generating Function (MGF) for the given distribution & then solve for the 1st moment. I'm expecting to get the same result for E(X) as obtained above but instead I'm getting a mess.

I'm doing this by hand at the moment so it could be I've just borked my arithmetic.

Questions:

1) I'm assuming I can, in this particular case, determine the MGF and that it'll derive the moments I need for me. Is that sane?

2) The MGF I get (through an iterative process of integrating by parts on the back of a piece of paper): (Mx(t)= 6*(e^t - 1)/t^3 - 6*e^t/t^2 + 3*e^t/t )

I'm sure my result for (2) is incorrect, or I'm completely missing something, since obviously the first moment isn't solvable (dM/dt for t=0 blows up), thus I can't verify the mean is the same value as I calculated originally above.

Expert help gratefully appreciated

Re: Find the MGF of a random variable given its pdf

your mgf is incorrect.. try calculating it again..

after you find the value of c, integrate $\displaystyle \int_0^1 e^{tx} f(x)\; dx$ to find your mgf..

Re: Find the MGF of a random variable given its pdf

Thanks for the quick reply harish21.

Yep so that's the integral I've solved to produce my original answer in (2). Here's a breakdown of my approach. Can you identify specifically where I've gone wrong with my simple calculus?:

My value for c is 3, achieved purely through integrating f(x) over the interval 0 to 1, knowing that integral's value is 1.

the MGF integral is thus : http://latex.codecogs.com/gif.latex?...3x%5E%7B2%7Ddx

(edit: borked my latex in the original post to show incorrect parts)

So I break this down by parts, 1st iteration using:

http://latex.codecogs.com/gif.latex?...x%7D%7D%7Bt%7D

I can see at this point things are already going south since I'm left with 't' as the denominator:

http://latex.codecogs.com/gif.latex?...e%5E%7Btx%7Ddx

(edit: borked my latex in the original post to show incorrect parts)

Breakdown by parts, 2nd iteration using:

http://latex.codecogs.com/gif.latex?...x%7D%7D%7Bt%7D

& solving the integral over the interval x = (0,1), gives my MGF:

http://latex.codecogs.com/gif.latex?...t%7D%7D%7Bt%7D

Re: Find the MGF of a random variable given its pdf

sorry for making you work again.. actually the mgf you had mentioned first was corrrect indeed.. the non-latex notation confused me..

so you have your mgf.. now to find the expected value.. find out the first derivative of your mgf at t=0.. that should give you your expected value.

Re: Find the MGF of a random variable given its pdf

no dramas, it's all helping to test my rusty understanding of this.

"*find out the first derivative of your mgf at t=0*"

...& that's where I come undone :) - if I try to derive the 1st moment of my mgf (ie: http://latex.codecogs.com/gif.latex?...7C_%7Bt%3D0%7D) I'm sunk on account of the t in the denominator of the derivative forcing a divide-by-zero exception.

Here's my attempt at the 1st derivative, again just simple calc. exploiting the product rule. Looks sane to you?

http://latex.codecogs.com/gif.latex?...t%7D%7D%7Bt%7D

If I now try to take the value of that function at t=0, thus to obtain to the 1st moment, I can't.

Assuming the approach is valid, I'm overlooking or misunderstanding something as I can't see a way around my prob. ie: why I can get E(x) using the http://latex.codecogs.com/gif.latex?...20x.f%28x%29dx approach (per my original post), but cannot verify it using the MGF above.

Advice gratefully received!

Re: Find the MGF of a random variable given its pdf

so the mgf is $\displaystyle \dfrac{18-18e^t+18te^t-18t^2e^t+3e^tt^3}{t^4}$ which is of the form 0/0 at t=0

take $\displaystyle \lim_{t \to 0} \dfrac{18-18e^t+18te^t-18t^2e^t+3e^tt^3}{t^4} $

using L'Hopital's rule correctly should give you 3/4