# How to compute moments from an MGF explicitly?

Suppose the mgf $M_x(t)$ is defined, for a suitable neighbourhood of zero $(-\delta, \delta)$, as $$M_X(t) = \frac{9 e^{-t}}{(3 + 2t)^2}.$$ Find an expression for $\mathbb{E}_X[X^r]$ for $r=1,2,\ldots, .$

I have to multiply two Taylor expansions; however, I do not know how to differentiate this product $r$ times with respect to $t$.

• Please show what you tried and explain where your difficulty lies. Commented Oct 12, 2014 at 3:12

The entire point to using the mgf to compute moments is that you usually don't have to compute derivatives. Moreover, the exercise of expanding an mgf usually is purely mechanical, requiring no guessing or insight. The following calculations are intended to exemplify a basic approach that works in many cases:

• Break the mgf into factors that can easily be expanded in power series (for instance, they match the mgfs of well-known distributions whose power series can be looked up);

• Multiply the corresponding power series.

• Pick out the coefficient of the $r^\text{th}$ power and multiply it by $r! = r(r-1)\cdots(2)(1)$: that's the $r^\text{th}$ moment.

The form of this particular mgf invites us to look at it as the product of two pieces: $9e^{-t}$ times $(3+2t)^{-2}$. Both of these are simple and have familiar MacLaurin expansions (that is, Taylor series around $0$):

\eqalign{ 9 e^{-t} &= 9\left(1 + \frac{-t}{1} + \frac{(-t)^2}{2} + \cdots + \frac{(-t)^n}{n!} + \cdots\right);\\ (3 + 2t)^{-2} &= 3^{-2}\left(1 + \frac{2}{3}t\right)^{-2} \\ &= 3^{-2}\left( 1 - 2\left(\frac{2}{3}t\right) + 3\left(\frac{2}{3}t\right)^2 + \cdots + \binom{-2}{k}\left(\frac{2}{3}t\right)^k + \cdots\right).}

This is a consequence of Newton's Binomial Theorem; the binomial coefficients are computed as

$$\binom{-2}{k} = \frac{(-2)(-3)\cdots(-2-k+1)}{k!} = (-1)^k (k+1).$$

However, I will retain the $\binom{-2}{k}$ notation to make it clear at the end where each term came from.

The first series converges everywhere while the second has a radius of convergence of $1$ (which is also asserted by the Binomial Theorem). Thus, for all $|t|\lt 1$ the subsequent manipulations will involve absolutely convergent power series (which therefore represent actual functions and not just formal power series).

Upon observing that $9\times 3^{-2}=1$ has no effect on the product, we may write the mgf in a more compact notation as

$$M_X(t) = \left(\sum_{n=0}^\infty \frac{(-t)^n}{n!}\right) \left(\sum_{k=0}^\infty \binom{-2}{k} \left(\frac{2}{3}t\right)^k\right).$$

Expanding this product and collecting the terms in increasing powers of $t$ gives a neater expression, which is easily and automatically computed by calling the power $r$ (say), letting $k$ advance from $0$ through $r$, setting $n=r-k$, and multiplying a typical term of one sum by a typical term of the other:

$$M_X(t) = \sum_{r=0}^\infty \left(\sum_{k=0}^r \frac{(-1)^{r-k}}{(r-k)!}\binom{-2}{k} \left(\frac{2}{3}\right)^k\right)t^r.$$

Multiplying the coefficient of $t^r$ by $r!$ gives the associated moment:

$$\mathbb{E}(X^r) = (-1)^r r!\sum_{k=0}^r \frac{(-1)^{k}}{(r-k)!}\binom{-2}{k} \left(\frac{2}{3}\right)^k = (-1)^r r!\sum_{k=0}^r \frac{k+1}{(r-k)!} \left(\frac{2}{3}\right)^k.$$

I have factored out the terms depending only on $r$ and expanded the binomial coefficients $\binom{-2}{k}$, but that's as far as one can reasonably go: a "closed" formula would be expressed in terms of generalized hypergeometric functions, which (although useful for analysis) is, for the purpose of computing these moments, just a fancy way of disguising this summation.

This is a typical calculus exercise where you need to figure out the $r$-th derivarive of a function, in this case $M_X(t)$. So you can follow the usual steps:

1) Derive up to some order (let say up to the third derivative) and figure out the pattern for the derivatives.

2) Conjecture a general form for the $r$-th derivative, let say $f(r)$, that is satisfied for indeed for $r=1,2,3$.

3) Derive the previous expression (so you will have the $r+1$-th derivative under your conjecture) and check if it coincides with the previous formula taking $r+1$ instead of $r$ (this is, $f(r+1)$). If yes, then you have the expression for the $r$-th derivative.

After you have the expression for $M_X^{(r)}(t)$ just evaluate it at $t=0$ to get the expressions for the moments $\mathbb{E}_X[X^r]$. You can start to think it with the first two derivatives of $M_X(t)$:

\begin{align} M_X'(t)&=-\frac{36 e^{-t}}{(2 t+3)^3}-\frac{9 e^{-t}}{(2 t+3)^2},\\ M_X''(t)&=\frac{72 e^{-t}}{(2 t+3)^3}+\frac{216 e^{-t}}{(2 t+3)^4}+\frac{9 e^{-t}}{(2 t+3)^2}. \end{align}

EDIT: This was answer was intended to provide the main guidelines for the exercise... but anyway since it seemed to be not clear enough, here are the expressions for the $r$-th derivatives of $M_X$.

First of all, to make the computations easier recall the following expression for the $r$-th derivative of the function $g(t)=e^{-t}h(t)$, which can be proved using steps 1)-3): \begin{align} g^{(r)}(t)=(-1)^re^{-t}\sum_{j=0}^r\binom{r}{j}(-1)^jh^{(j)}(t). \end{align} In our case, $h(t)=9(3+2t)^{-2}$ and the $j$-th derivatives of $h$ follow easily also, resulting \begin{align} h^{(j)}(t)=(-2)^j(j+1)!(2t+3)^{-(2+j)}. \end{align} Combining these two expressions, we have: $$M^{(r)}_X(t)=9(-1)^re^{-t}\sum_{j=0}^r\binom{r}{j}2^j(j+1)!(2t+3)^{-(2+j)}$$ and the good point is that when $t=0$ we have $$\mathbb{E}_X[X^r]=M^{(r)}_X(0)=(-1)^r\sum_{j=0}^r\binom{r}{j}(j+1)!\left(\frac{2}{3}\right)^{j},$$ which is exactly the final output that @guy has mentioned in the comments.

• Have you gone through the calculations and verified this works? The simplest form I've managed to get is $E[X^r] = \sum_{j = 0} ^ r (-1)^j (2/3)^j (j + 1)! \binom{r}{j}$. Note also that it is $(3 + 2t)$, not $(2 + 2t)$ as you have.
– guy
Commented Oct 12, 2014 at 17:39
• You are right @guy about $(3+2t)$, stupid error. I edited the answer to fix it. I have not gone through the calculations, but the derivatives are correct. Commented Oct 12, 2014 at 17:52
• So what reason is there to think that going through steps 1-3 will be fruitful? Unless my expression for $E[X^r]$ can be simplified substantially I don't see how one would hope to recognize it from looking at the first few term $-7/3, 19/3, -181/9, 2011/27$.
– guy
Commented Oct 12, 2014 at 18:58
• Should be $(-1)^r$, not $(-1)^j$ in the expression in my first comment.
– guy
Commented Oct 12, 2014 at 19:48
• OK, I will edit my answer to make it clearer. By the way, I will be glad to know another alternative solution. Commented Oct 12, 2014 at 20:33