# Finding moment generating functions for a dice roll

I'm learning about generating functions and moment generating functions and I'm incredibly confused about how to actually implement the taylor-series based definition. I think perhaps practicing an easy question can help me get started:

The question asks to find the ordinary and the moment generating functions for the distribution of a dice roll.

I'm not sure how to even begin, can someone explain how to actually implement the definition of moment generating function in a relatively simple example?

Let $X$ be the outcome of a fair dice roll. Thus, we have $\mathbb{P}(X = i) = 1/6, ~ i = 1,\ldots,6$.

The probability-generating function of $X$ is defined as

\begin{align} P_X(z) := \mathbb{E}[z^X] = \sum_{x = 1}^6 \mathbb{P}(X = x) z^x = 1/6 \sum_{x = 1}^6 z^x = \frac{1}{6} \frac{z(z^6-1)}{z-1}, \end{align}

with $|z| \le 1$.

The moment-generating function of $X$ is defined as

\begin{align} M_X(t) := \mathbb{E}[e^{tX}] = \sum_{x = 1}^6 \mathbb{P}(X = x) e^{tx} = 1/6 \sum_{x = 1}^6 e^{tx} = \frac{1}{6} \frac{e^t(e^{6t} - 1)}{e^t - 1}, \end{align}

with $t \in \mathbb{R}$.

The relation between the two generating functions is $P_X(e^t) = \mathbb{E}[e^{tX}] = M_X(t)$. Using the probability-generating function, one can compute the probability mass function and so-called $k$th factorial moments, see the wiki. The moment-generating function allows us to compute the moments of a random variable, see the wiki.

Answering the question in the comment

Computing the sums (in my opinion) is all about knowing a few tricks. I will show you how to do it for the two simplifications of the sum above. We assume that $|a| < 1$.

\begin{align} I &= \sum_{i = 1}^n a^i = a \sum_{i = 0}^{n-1} a^i = a(1 + a + a^2 + \ldots + a^{n-1}) \\ &= a(1 + a + a^2 + \ldots + a^{n-1} + a^n - a^n ) \\ &= a(1 + I - a^n) = aI + a(1 - a^n) \\ \Rightarrow I(1-a) &= a(1-a^n) \\ \Rightarrow I &= \frac{a(1-a^n)}{(1-a)} = \frac{a(a^n-1)}{a-1} \end{align}

• Thank you for this detailed answer this is tremendously helpful. I still have a question as to the last step on the probability-generating function. How did you go from summation notation to your closed form answer? May 14, 2014 at 16:08