Why the Binomial MGF Is Useful
A binomial random variable counts successes across a fixed number of trials. Its probability mass function is familiar, but the moment generating function (MGF) provides a compact route to moments: once the MGF is known, derivatives at zero give the mean and higher raw moments. The key is to keep the model parameters distinct. The number of trials is an integer \(n\); the success probability on each trial is \(p\).
This tutorial derives the MGF from the binomial probability mass function and uses its first two derivatives to recover the mean and variance. The central exam skill is not just memorizing a formula: it is recognizing which quantity is \(n\), which is \(p\), and what the derivative calculations actually produce.
The binomial model requires a fixed number of trials, two outcomes for each trial (success or failure), independence, and a common success probability. If the probability changes from trial to trial, or the trials are dependent, this binomial formula generally does not apply. Write \(q=1-p\) when it is useful to distinguish the failure probability from the success probability.
Deriving the Binomial MGF
The MGF of \(X\) is \(M_X(t)=E[e^{tX}]\), for values of \(t\) where the expectation is finite. For a binomial variable, \(X\) can take only the values \(0,1,\ldots,n\), so the expectation is a finite sum and is finite for every real \(t\).
Multiply \(e^{tk}\) by the probability that \(X=k\), and sum over every possible count \(k\).
The terms \(e^{tk}p^k\) combine as \((pe^t)^k\), while the failure-probability term is \(q^{n-k}\).
The finite sum is the expansion of \((q+pe^t)^n\).
The formula also has a useful consistency check: \(M_X(0)=1\), because substituting \(t=0\) gives \((1-p+p)^n=1\). This is required of any MGF, since \(E[e^{0X}]=E[1]=1\). If a proposed expression does not equal one at zero, it cannot be the MGF.
Recovering the Mean and Variance
For an MGF that is differentiable around zero, \(M_X'(0)=E[X]\) and \(M_X''(0)=E[X^2]\). The second derivative gives the second raw moment, not the variance itself. The variance is \(E[X^2]-(E[X])^2\).
Differentiate \(M_X(t)=(q+pe^t)^n\) using the chain rule. The first derivative is
Setting \(t=0\), so that \(e^0=1\) and \(q+p=1\), gives \(M_X'(0)=np\). Differentiate once more using the product rule:
Thus the second raw moment is \(np+n(n-1)p^2\). Subtract the square of the mean to obtain the variance. This algebra also explains why the variance involves \(p(1-p)\): the \(n^2p^2\) contribution in the squared mean cancels most of the \(p^2\) contribution in the second moment.
Worked Examples
Worked Example: Counting Incorrect Labels
A hypothetical inspection checks 8 independently selected labels. Assume each label has probability \(0.25\) of being incorrect, with the same probability for every label. Let \(X\) be the number of incorrect labels. Find the MGF, mean, second raw moment, and variance.
Model and method. The fixed number of trials is \(n=8\), and the success probability—here, an incorrect label—is \(p=0.25\). The trials are assumed independent, so \(X\sim\operatorname{Bin}(8,0.25)\). Set \(q=1-p=0.75\) and use the binomial MGF and its derivatives.
The MGF is $$ M_X(t)=(0.75+0.25e^t)^8. $$
The mean is \(np=8(0.25)=2\). The second raw moment is $$ E[X^2]=np+n(n-1)p^2 =8(0.25)+8(7)(0.25)^2 =2+56(0.0625) =2+3.5 =5.5. $$
Therefore, $$ \operatorname{Var}(X)=E[X^2]-(E[X])^2=5.5-2^2=1.5. $$ The direct formula gives the same check: \(npq=8(0.25)(0.75)=1.5\).
Common mistake avoided: \(8\) is the number of trials, not the success probability. Using \(p=8\) would violate \(0\leq p\leq1\) and would not describe a binomial model. The two calculations of the variance agree, as required.
Worked Example: Detection Events in Repeated Tests
A hypothetical monitoring system runs 10 independent tests. Each test detects the event of interest with probability \(0.4\). Let \(X\) count detections. Find the MGF, \(E[X]\), \(E[X^2]\), and \(\operatorname{Var}(X)\).
Model and method. There are \(n=10\) tests, each with success probability \(p=0.4\) and failure probability \(q=0.6\). Under the stated independence and common-probability assumptions, \(X\sim\operatorname{Bin}(10,0.4)\).
The MGF is $$ M_X(t)=(0.6+0.4e^t)^{10}. $$
The mean is $$ E[X]=np=10(0.4)=4. $$ The second raw moment is $$ \begin{aligned} E[X^2] &=np+n(n-1)p^2\\ &=10(0.4)+10(9)(0.4)^2\\ &=4+90(0.16)\\ &=4+14.4\\ &=18.4. \end{aligned} $$
Then $$ \operatorname{Var}(X)=18.4-4^2=18.4-16=2.4. $$ As a separate check, \(npq=10(0.4)(0.6)=2.4\).
Common mistake avoided: The second derivative at zero is \(18.4\), not \(2.4\). It gives \(E[X^2]\); obtaining the variance requires subtracting \((E[X])^2=16\). The direct variance check confirms the result.
Worked Example: Reading Parameters From an MGF
A system reports the MGF $$ M_X(t)=(0.7+0.3e^t)^{12}. $$ Assume it is the MGF of a binomial count. Identify the parameters, then find the mean, variance, and second raw moment.
Model and method. Compare the expression with the binomial form \((1-p+pe^t)^n\). The exponent is the trial count, so \(n=12\). The coefficient of \(e^t\) is \(p\), so \(p=0.3\); the remaining coefficient \(0.7\) is \(1-p\). Thus \(X\sim\operatorname{Bin}(12,0.3)\).
The mean is $$ E[X]=np=12(0.3)=3.6. $$ The variance is $$ \operatorname{Var}(X)=np(1-p)=12(0.3)(0.7)=3.6(0.7)=2.52. $$
Finally, \(E[X^2]=\operatorname{Var}(X)+(E[X])^2\), so $$ E[X^2]=2.52+(3.6)^2=2.52+12.96=15.48. $$ The derivative formula gives the same result: $$ np+n(n-1)p^2=3.6+12(11)(0.09)=3.6+11.88=15.48. $$
Common mistake avoided: The exponent \(12\) is not the success probability. In the standard form, the exponent identifies \(n\), while the coefficient of \(e^t\) identifies \(p\). Both ways of computing the second raw moment agree.
Common Exam Traps and Model Checks
A binomial MGF is compact, which makes it easy to copy the form while misreading its parameters or its derivatives. Check the model and each calculation in context:
- Swapping \(n\) and \(p\). \(n\) counts trials and must be a nonnegative integer. \(p\) is a probability between zero and one. The binomial MGF raises the one-trial expression \(1-p+pe^t\) to the power \(n\).
- Using the wrong success definition. Success can mean any outcome of interest, such as an event being detected. Define it before assigning \(p\). If success is redefined as failure, the success probability changes to \(1-p\).
- Calling \(M_X''(0)\) the variance. It is \(E[X^2]\). Always subtract \((M_X'(0))^2\) to obtain the variance.
- Ignoring the model assumptions. A fixed number of independent trials with the same success probability is required. A count from dependent trials or trials with unequal probabilities need not have this binomial MGF.
- Forgetting a basic MGF check. Substitution of \(t=0\) must yield \(M_X(0)=1\). Also, the mean and variance should be nonnegative and consistent with \(np\) and \(np(1-p)\).
The binomial MGF is useful because it packages the distribution into one expression from which moments follow by differentiation. For this model, those results are also easy to verify against the direct formulas \(E[X]=np\) and \(\operatorname{Var}(X)=np(1-p)\). The ability to move between the probability mass function, MGF, and moments is aligned with the SOA VEE Mathematical Statistics syllabus.
Check Your Understanding
For each problem, state or use the binomial parameters carefully. Answers are provided at the end of each question.
- A hypothetical review samples 14 independent records, each having probability \(0.1\) of requiring correction. Let \(X\) be the number requiring correction. Give the MGF, mean, and variance. (Answer: \(M_X(t)=(0.9+0.1e^t)^{14}\), \(E[X]=1.4\), \(\operatorname{Var}(X)=1.26\).)
- Let \(X\sim\operatorname{Bin}(6,0.5)\). Find \(E[X]\), \(E[X^2]\), and \(\operatorname{Var}(X)\). (Answer: \(E[X]=3\), \(E[X^2]=10.5\), \(\operatorname{Var}(X)=1.5\).)
- A binomial count has MGF \(M_X(t)=(0.65+0.35e^t)^8\). Identify \(n\) and \(p\), then find the mean and variance. (Answer: \(n=8\), \(p=0.35\), \(E[X]=2.8\), \(\operatorname{Var}(X)=1.82\).)
- A hypothetical screening process performs 20 independent screenings, each positive with probability \(0.05\). Find the MGF, mean, and variance of the number of positive results. (Answer: \(M_X(t)=(0.95+0.05e^t)^{20}\), \(E[X]=1\), \(\operatorname{Var}(X)=0.95\).)
- Suppose \(X\sim\operatorname{Bin}(30,0.1)\). Find its MGF, mean, variance, and probability of zero successes, rounding the probability to four decimal places. (Answer: \(M_X(t)=(0.9+0.1e^t)^{30}\), \(E[X]=3\), \(\operatorname{Var}(X)=2.7\), \(P(X=0)=0.9^{30}\approx0.0424\).)