Associated Topics || Dr. Math Home || Search Dr. Math

### Calculating a Probability Density Function from a Moment Generating Function

```Date: 04/04/2009 at 11:25:13
From: Gabriel
Subject: Moment Generating function

The moment generating function of a random variable Y is

M_Y(t) = (1/(1 - t))^2

Compute P(-2 < Y < 3), or explain why you cannot compute it.

If I'm not mistaken, the random variable (X) is gamma with parameters
(2,1).

But I do not know how to carry on from there.... or is it un-
computable?  If so, how do I explain that?

Can anyone help? Thanks.

```

```
Date: 04/05/2009 at 00:44:31
From: Doctor Jordan
Subject: Re: Moment Generating function

Hi Gabriel,

Let's try to compute P(-2 < Y < 3).  We may get a probability, or we
may run into a problem.  (In a few places, I will use exp(x) instead
of e^x, but they mean the same thing.)

P(-2 < Y < 3) is equal to the integral of f(x) from -2 to 3, where f
(x) is the probability density function of the random variable Y.

Since M_Y(t) is defined in (-1,1), which is an open neighborhood
around the origin, the distribution Y is uniquely determined (general
fact).  What this means is that there cannot be two different
distributions with this moment generating function; and hence if I
can find one distribution with this moment generating function, I
know that this is the distribution of Y.

Now looking up this moment generating function in a table, I see that
it is, as you suggested, the moment generating function for the gamma
distribution:

http://planetmath.org/encyclopedia/GammaRandomVariable.html

Thus the probability density function of Y is

f(x) = x*exp(-x) for x >=0 and f(x) = 0 for x < 0.

Generally, knowing the moment generating function, you could also
compute the probability density function as

f(x) = 1/(2pi) * integral from -infinity to infinity of
M_Y(it) * exp(-itx) dt,

but here we were able to just use a table.

Since we have found the probability density function for Y, we can
now find P(-2 < Y < 3):

P(-2 < Y < 3)

= integral of f(x) from -2 to 3

= integral of f(x) from 0 to 3 (since f(x) = 0 for x < 0)

Using integration by parts,

= -x*exp(-x) - exp(-x) evaluated from 0 to 3

= -4*exp(-3) + 1

= 0.80085...

Thus, P(-2 < Y < 3) = 0.80085...

I recommend carefully checking all of this yourself.  I have double
checked it, but there were lots of places to make mistakes.  Also, it
is essential to get your hands dirty with calculations in order to
understand this material.  In particular, make sure you see that M_Y
(t) is indeed the moment generating function for the gamma
distribution, and that I got the right probability density function.

- Doctor Jordan, The Math Forum
http://mathforum.org/dr.math/

```

```
Date: 04/05/2009 at 04:27:48
From: Gabriel
Subject: Moment Generating function

It was very useful!! But what I don't understand is from this part:

Since M_Y(t) is defined in (-1,1), which is an open neighborhood
around the origin, the distribution Y is uniquely determined
(general fact).  What this means is that there cannot be two
different distributions with this moment generating function;
and hence if I can find one distribution with this moment
generating function, I know that this is the distribution of Y.

How do you know M_Y(t) is defined in (-1,1)? and what is an open
neighbourhood around the origin?

And another thing: I tried working out the product ...

f(x) = 1/(2pi) * integral from -infinity to infinity of
M_Y(it) * exp(-itx) dt,

... and I couldn't get x*exp(-x).  I got stuck at 1/(2pi) exp(-ix)
[{1 - ti)/i)] from -infinity to infinity..

On the PlanetMath website, there was a formula for f_x(x); but it
requires Gamma(alpha, lamda) = x, and I do not know that.

```

```
Date: 04/05/2009 at 10:08:05
From: Doctor Jordan
Subject: Re: Moment Generating function

Hi Gabriel,

For M_Y(t) to be defined in (-1,1) means that for any t between -1
and 1, M_Y(t) exists.  M_Y(t) = (1/(1 - t))^2, so it is not defined
for t = 1.

To be defined in an open neighborhood of the origin is equivalent to
being defined in an open interval around the origin, i.e., being
defined on some interval of the form (-a,a).  Here a = 1, but we
could have chosen (-0.5,0.5) or (- 0.01,0.01), etc.  All that matters
is there is some interval.

I stated the integral just as a general remark.  We can solve this
question without having to calculate this integral.

Concerning Gamma(alpha,lambda), look carefully at note 4 of
PlanetMath's page:

The moment generating function of a gamma random variable is given
by

M_x(t) = [lambda/(lambda - t)]^alpha

Spend at least half an hour agonizing over this before writing back!
The way to remember and learn things is to really struggle over them
and then get the answer.  Even if you get nowhere, having struggled
will make you remember it better.

- Doctor Jordan, The Math Forum
http://mathforum.org/dr.math/

```

```
Date: 04/06/2009 at 00:51:58
From: Gabriel
Subject: Moment Generating function

Thanks, sir!!

Very sorry to keep bothering you, but I have to ask another question.

The PlanetMath website says that, for a gamma random variable, the
probability density function is

f_x(x) = [something]/[gamma function].

After subbing in the values for gamma(2,1), I got

f_x(x) = x*exp(-x)/[gamma function]

Then I tried to compute the gamma function using the formula

integral from zero to infinity of x^(t -1) * e^ x

But try as I could, I could not get this result of yours:

Thus the probability density function of Y is

f(x) = x*exp(-x) for x >=0 and f(x) = 0 for x < 0.

```

```
Date: 04/06/2009 at 08:32:38
From: Doctor Jordan
Subject: Re: Moment Generating function

Hi Gabriel,

What do you find that Gamma(2) is equal to?

- Doctor Jordan, The Math Forum
http://mathforum.org/dr.math/

```

```
Date: 04/06/2009 at 10:18:37
From: Gabriel
Subject: Thank you (Moment Generating function)

Oh, I get it now!!  It's Gamma(2) = (2 - 1)! = 1

Thank you, Doctor Jordan!  I am really really grateful for all your
patience and detailed explanations, especially with a slow learner
like me...

Thanks again! :D
```
Associated Topics:
College Probability

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search