# Probability- moment generating functions.

1. A random variable Y is called gamma($$\theta$$, n) for $$\theta$$>0 and natural n if it takes positive values and takes the following PDF:

f(y)=$$\frac{1}{\theta (n-1)!}$$($$\frac{y}{\theta}$$)$$^{n-1}$$ exp$$\frac{-y}{\theta}$$

Show how to find the moment generating function, expectation and variance of Y.

3. I have not got very far I am stil stuck on finding the moment generating function.

I know it is given by the following:

$$\int_{0}^{\infty} \exp(ty)f(y) dy$$

but I have no idea how to evaluate it and get the correct answer (can somebody please show me?)

The answer you should get is: G$$_{y}$$(t)=1/(1-t$$\theta$$)$$^{n}$$

I think I will know how to find the expectation and variance once I have the moment generating function.

Substitute $$u=\frac{(1-\theta t) y}{\theta}$$ .

(The restriction on t is that $$1-\theta t>0$$ .)

I do not see how that helps, could someone please elaborate?

Write down the integral you are trying to evaluate.

Don't just write "f(y)." Write down what f(y) is.

You now have two factors with e to a power. Combine them into one factor of e to a power, using properties of exponents.

Now make a u-substitution, the one I suggested, as in calc 1 or calc 2.

Write this out and show us how far you can get.

Ok this is as far as I keep getting:

$$\int_{0}^{\infty} e^{\frac{-y}{\theta}}e^{tx} {\frac{y^{n-1}}{(t\theta-1)^{n-1}}{\frac{1}{\theta(n-1)!} dy$$

=$$\int_{0}^{\infty} e^{\frac{y(t\theta-1)}{\theta}}{\frac{y^{n-1}}{\theta^{n-1}}{\frac{1}{\theta(n-1)!}dy$$

let u=$${\frac{y(t\theta-1)}{\theta}$$

Then du=$${\frac{(t\theta-1)}{\theta}$$dy

=$$\int_{0}^{\infty} {\frac{1}{(t\theta-1)(n-1)!}}{\frac{u^{n-1}}{(t\theta-1)^{n-1}}e^u du$$

= $$\frac{1}{(t\theta-1)^n}$$ $$\int_{0}^{\infty} e^u \frac{u^{n-1}}{(n-1)!}$$

Is this right so far? Is there some reason why $$\int_{0}^{\infty} e^u \frac{u^{n-1}}{(n-1)!}$$ should be one?

C.E, that's mostly pretty good!

Here is an important technical detail. The m.g.f. is defined for t near 0, so $$\theta t -1$$ is negative. This means that for the substitution you used, y=infinity would become u=-infinity. Thus, your integral with du should become from 0 to -infinity.

Now you can find $$\int u^{n-1} e^u\,du$$ using integration by parts. Or use a table of integrals. The first time you use IBP you obtain a formula involving $$\int u^{n-2} e^u\,du$$. Then do IBP again and you get $$\int u^{n-3} e^u\,du$$. Pretty soon you'll see what happens with the factorial.

Do the IBP with definite integrals, $$\int_a^b u\,dv=uv\bigr|_a^b-\int_a^b v\,du$$ so that you can take care of those "uv" terms at each step.

How do you know that the MGF is for t near to 0 (it does not say in the question)? I assume from the limits you told me it is for 0<t<1?

MGF is always for t near 0, because that's where you need it to find the mean and moments. M'(0), M''(0), etc.

$$\theta t -1<0$$ i.e. $$1-\theta t>0$$ will give you $$t<1/ \theta$$, and this last inequality includes t=0.

You need to use that condition to get your integral du from 0 to -infinity, and the -infinity will be used to get convergence of the improper integral.