# Real life uses of Moment generating functions

In most basic probability theory courses your told moment generating functions (m.g.f) are useful for calculating the moments of a random variable. In particular the expectation and variance. Now in most courses the examples they provide for expectation and variance can be solved analytically using the definitions.

Are there any real life examples of distributions where finding the expectation and variance is hard to do analytically and so the use of m.g.f's was needed? I'm asking because I feel like I don't get to see exactly why they are important in the basic courses.

You are right that mgf's can seem somewhat unmotivated in introductory courses. So, some examples of use. First, in discrete probability problems often we use the probability generating function, but that is only a different packaging of the mgf, see What is the difference between moment generating function and probability generating function?. The pgf can be used to solve some probability problems which could be hard to solve otherwise, for a recent example on this site, see PMF of the number of trials required for two successive heads or sum of $$N$$ gamma distributions with $$N$$ being a poisson distribution. Some not-so-obvious applications which still could be used in an introductory course, is given in Expectation of reciprocal of a variable, Expected value of $$1/x$$ when $$x$$ follows a Beta distribution and For independent RVs $$X_1,X_2,X_3$$, does $$X_1+X_2\stackrel{d}{=}X_1+X_3$$ imply $$X_2\stackrel{d}{=}X_3$$? .

Another kind of use is constructing approximations of probability distributions, one example is the saddlepoint approximation, which take as starting point the natural logarithms of the mgf, called the cumulant generating function. See How does saddlepoint approximation work? and for some examples, see Bound for weighted sum of Poisson random variables and Generic sum of Gamma random variables

Mgf's can also be used to prove limit theorems, for instance the poisson limit of binomial distributions Intuitively understand why the Poisson distribution is the limiting case of the binomial distribution can be proved via mgf's.

Some examples (exercise sets with solutions) of actuarial use of mgf's can be found here: https://faculty.math.illinois.edu/~hildebr/370/370mgfproblemssol.pdf Search the internet with "moment generating function actuarial" will give lots of similar examples. The actuaries seem to be using mgf's to solve some problems (that arises for instances in premium calculations) that is difficult to solve otherwise. One example in section 3.5 page 21 and books about actuarial risk theory. One source of (estimated) mgf's for such applications could be empirical mgf's (strangely, I cannot find even one post here about empirical moment generating functions).

• The actuarial use-cases in the linked PDF questions assume that mysteriously, one is given the MGF of a distribution out of what seems like thin air, and is therefore not particularly illuminating. Googling “actuarial MGF” similarly circularly just leads to other academic questions that are predicated in somehow already knowing the MGF of a mysterious distribution. How might one derive such a thing if unknown? Your other examples, however, are more illustrative. – ijoseph Oct 25 '18 at 1:38
• Thanks for this comment! Please the edited answer. – kjetil b halvorsen Oct 25 '18 at 11:02

Are there any real life examples of distributions where finding the expectation and variance is hard to do analytically and so the use of m.g.f's was needed?

There are many problems where it is hard to find the mean and variance using their standard formulae as a sum/integral over the mass/density. One example where this is difficult, but not impossible, is the coupon collector's distribution, which has probability mass function:

$$\mathbb{P}(T=t) = \frac{m!}{m^t} \cdot S(t-1, m-1) \quad \quad \quad \text{for all integers } t \geqslant m,$$

where the function $$S$$ denotes the Stirling numbers of the second kind. If you try to use the standard method here you will end up with a recursive formula involving the Stirling numbers, and this is cumbersome to work with. A simpler method to get the mean and variance is to derive the cumulant generating function (logarithm of the moment generating function) which no longer contains the Stirling numbers. It is then relatively simple to obtain the cumulants of the distribution. I recommend you give this exercise a try via both methods to see what I mean.