# Finding the Moment Generating function of a Binomial Distribution

Suppose $$X$$ has a $$\rm{Binomial}(n,p)$$ distribution. Then its moment generating function is

\begin{align} M(t) &= \sum_{x=0}^x e^{xt}{n \choose x}p^x(1-p)^{n-x} \\ &=\sum_{x=0}^{n} {n \choose x}(pe^t)^x(1-p)^{n-x} \\ &=(pe^t+1-p)^n \end{align}

Can someone please explain how the sum is obtained from lines (2) to (3)?

• This is the Binomial formula. Nov 13, 2012 at 19:53
• It makes sense to me that the Binomial Theorem would be applied to this, I'm just having a hard time working out how they get to the final result using it :\ Nov 13, 2012 at 21:02
• It all makes sense now, it "is" a syntactically simplified way to write the Binomial Theorem. Thanks for the clarification Nov 13, 2012 at 21:07
• Call $l=pe^t$ and $j=1-p$, then the second line is $\sum_{x=0}^n {n \choose x} l^x j^{n-x} = (l+j)^n$ by the binomial formula. Nov 13, 2012 at 21:07
• You are missing an $e^{tx}$ in the first line.
– robjohn
Aug 26, 2014 at 23:32

The moment generating function for the binomial distribution $B_{n,p}$, whose discrete density is $\binom{n}{k}p^k(1-p)^{n-k}$, is defined as \begin{align} M_{B_{n,p}}(t) &=\mathrm{E}(e^{tk})\\ &=\sum_{k=0}^n\binom{n}{k}p^k(1-p)^{n-k}e^{tk}\\ &=\sum_{k=0}^n\binom{n}{k}\left(pe^t\right)^k(1-p)^{n-k}\\ &=\left(pe^t+(1-p)\right)^n \end{align} The last step is simply an application of the binomial theorem.
Because Bernoulli is a special case of Binomial distribution, PMF of binomial distribution $$\binom{n}{k}p^k(1-p)^{n-k}$$ can be rewritten as $$\binom{1}{0}p^1(1-p)^{1-0}$$
Thus, we can get the following for each instance of $$X$$ for $$X \sim Bin(n,p)$$ and $$X = \sum^n_{j=1}X_j$$ $$\begin{array} \mathbb{E}[e^{tX_j}] & = \sum^n_{k=0}e^{tk}\binom{1}{0}p^1(1-p)^{1-0} \\ & = (pe^t +1 -p)^1 \ \ \ \ \ \ \ \text{by Binomial Theorem}\\ \end{array}$$
$$\phi(t) = \mathbb{E}[e^{tX}] \Rightarrow \mathbb{E}[e^{t\cdot(\Sigma x)}] \Rightarrow \mathbb{E}[e^{tx_1}\cdot e^{tx_2}\cdot...\cdot e^{tx_n}] \Rightarrow \mathbb{E}[e^{tx_1}]\cdot \mathbb{E}[e^{tx_2}]\cdot...\cdot \mathbb{E}[e^{tx_n}]$$
Since all individual events are independent, $$\Rightarrow [pe^t + (1-p)].[pe^t + (1-p)].[pe^t + (1-p)]...[pe^t + (1-p)]$$ n times, since all n random variables are Bernoulli random variables $$\Rightarrow[pe^t + (1-p)]^n=[pe^t + q]^n$$, where $$q=1-p$$.