Moment generating function of a gamma distribution
If I have a variable $X$ that has a gamma distribution with parameters $s$ and $\lambda$, what is its momment generating function.
I know that it is $\int_0^\infty e^{tx}\frac{1}{\Gamma(s)}\lambda^sx^{s-1} e^{-x\lambda}dx$ and the final answer should be $(\frac{\lambda}{\lambda-t})^s$, but how can i compute this?
P.S. I know that there are other questions on this site about the MGF of the gamma distibution, but none of those use this specific definition for the density function of a gamma distribution. And I would like to see it with this one. Thanks a lot!
I'd like to give another answer. Instead of the "repeated integration by parts" in the other answer, we can do the following:
We know the definition of the gamma function to be as follows:
$$\Gamma(s) = \int_{0}^\infty x^{s-1}e^{-x}dx$$
Now $\int_0^\infty e^{tx}\frac{1}{\Gamma(s)}\lambda^sx^{s-1} e^{-x\lambda}dx$ = $\frac{\lambda^s}{\Gamma(s)}\int_0^\infty e^{(t-\lambda)x}x^{s-1}dx$. We then integrate by substitution, using $u = (\lambda - t)x$, so also $x=\frac{u}{\lambda-t}$. This gives us $\frac{du}{dx}=\lambda - t$, i.e. $dx = \frac{du}{\lambda-t}$. Now let's put this into the integral, so then we get:
$$\frac{\lambda^s}{\Gamma(s)}\int_0^\infty e^{-u}{\left(\frac{u}{\lambda -t}\right)}^{s-1}\frac{du}{\lambda-t} = \left(\frac{\lambda}{\lambda-t}\right)^s\frac{1}{\Gamma(s)}\int_0^\infty u^{s-1}e^{-u}du$$
Here on the right-hand side we recognize the integral as the gamma function, so we get $\left(\frac{\lambda}{\lambda-t}\right)^s\frac{\Gamma(s)}{\Gamma(s)}$. Those gamma's cancel so then we get what we want:
$$\left(\frac{\lambda}{\lambda-t}\right)^s$$
Your question ultimately becomes to show the following: $$\int_0^\infty e^{tx}\frac{1}{\Gamma(s)}\lambda^sx^{s-1} e^{-x\lambda}\ dx = \left(\frac{\lambda}{\lambda - t}\right)^s$$ $$\int_0^\infty e^{tx}\frac{1}{\Gamma(s)}\lambda^sx^{s-1} e^{-x\lambda}\ dx = \frac{\lambda^s}{\Gamma(s)}\int_0^\infty x^{s-1}e^{-(\lambda-t)x} \ dx$$ From repeated applications of integration by parts, it is known that $$\int_0^\infty x^ae^{-bx} \ dx = \frac{\Gamma(a+1)}{b^{a+1}}$$ Making this substitution we get: $$\frac{\lambda^s}{\Gamma(s)}\int_0^\infty x^{s-1}e^{-(\lambda-t)x} \ dx = \frac{\lambda^s}{\Gamma(s)}\frac{\Gamma(s)}{(\lambda - t)^s} = \left(\frac{\lambda}{\lambda - t}\right)^s$$