Tutorials › VEE Mathematical Statistics › MGF Problem-Solving and Error Checks

VEE Mathematical Statistics · Moment Generating Functions · Tutorial 244 of 880

MGF Problem-Solving and Error Checks

Learn to solve MGF questions systematically, verify the assumptions and parameterization, and catch errors before identifying moments or a sum distribution.

Intermediate 12 min read

What You'll Learn

  • Check whether an MGF is finite on an open interval containing zero
  • Derive and verify an MGF from a distribution’s definition
  • Obtain means and variances from MGF derivatives
  • Apply the product rule only when the random variables are independent
  • Match a sum’s MGF to a known distribution without confusing parameter conventions
  • Use domain and moment checks to catch incorrect answers

A Reliable Workflow for MGF Problems

Moment generating function questions often combine several skills: writing the correct formula for a distribution, checking where that formula is valid, differentiating to find moments, and deciding whether a sum has a familiar distribution. A plausible-looking expression can still be wrong if its parameter convention is mismatched or if independence was assumed without justification.

A dependable solution keeps these decisions separate. First state the model and its parameterization. Then write the MGF with its domain, check that the domain includes an open interval around zero, and only then use derivatives or the product rule. Finally compare the resulting expression with a known MGF and verify the conclusion using moments when practical.

Definition: The moment generating function of a random variable \(X\) is \(M_X(t)=E[e^{tX}]\), for those real values of \(t\) for which this expectation is finite. The MGF is said to exist near zero if it is finite on some open interval containing \(0\). If it exists near zero, its derivatives at zero give the moments: \(M_X^{(k)}(0)=E[X^k]\), when the derivative is taken under the usual MGF existence condition. In particular, \(E[X]=M_X'(0)\), and \(\operatorname{Var}(X)=M_X''(0)-[M_X'(0)]^2\).

The open-interval condition matters. A formula that is finite only for \(t\geq 0\), for example, is not automatically an MGF that exists near zero. For common distributions such as bounded variables, normal variables, and exponential variables, the MGF formulas used below do exist on an open interval containing zero. Always record the domain along with the formula.

Derivatives, Domains, and a Short Justification

The moment formulas follow from differentiating the expectation. Formally, the first derivative of \(e^{tX}\) with respect to \(t\) is \(Xe^{tX}\), and the second is \(X^2e^{tX}\). When the MGF is finite on an open interval around zero, the standard differentiation-under-the-expectation result gives

$$ M_X'(0)=E[Xe^{0X}]=E[X], \qquad M_X''(0)=E[X^2e^{0X}]=E[X^2]. $$

Since variance is the second raw moment minus the square of the mean, \(\operatorname{Var}(X)=M_X''(0)-[M_X'(0)]^2\). This also explains why a second derivative alone is generally not the variance.

For independent random variables \(X\) and \(Y\), the product rule follows from the factorization of expectations:

$$ M_{X+Y}(t)=E[e^{t(X+Y)}] =E[e^{tX}e^{tY}] =E[e^{tX}]E[e^{tY}] =M_X(t)M_Y(t). $$

The factorization requires independence. Without it, the expectation of the product need not equal the product of the expectations. In addition, both MGFs must be defined at the \(t\)-values being used. When these conditions hold near zero, the product is the MGF of the sum.

1
State the model.
Give the distribution and parameters, including whether a gamma or exponential parameter is a rate or a scale.
2
Write the MGF and domain.
Check that the stated domain contains an open interval around zero.
3
Use the appropriate rule.
Differentiate for moments, or multiply MGFs for a sum only after confirming independence.
4
Identify and verify.
Match the expression to a known MGF using its parameterization, then check the result with moments or a domain comparison.

Worked Examples

Worked Example: A Uniform MGF and Its First Two Moments

Let \(X\) be uniformly distributed on the interval \([1,3]\). Find its MGF, state where it exists, and use it to calculate the mean and variance. The method is to integrate the density and then use the Taylor expansion at zero as a check on the derivatives.

The density is \(f_X(x)=1/2\) for \(1\leq x\leq 3\), and zero otherwise. Therefore

$$ M_X(t)=\frac{1}{2}\int_1^3 e^{tx}\,dx =\frac{e^{3t}-e^t}{2t}, \qquad t\ne 0. $$

At \(t=0\), the defining expectation is \(M_X(0)=E[1]=1\). The displayed quotient has limit \(1\) as \(t\) tends to zero, so the complete formula uses that limiting value at zero. Because \(X\) is bounded, \(E[e^{tX}]\) is finite for every real \(t\); in particular, the MGF exists near zero.

To obtain the moments transparently, expand the expectation using the power series for \(e^{tX}\):

$$ M_X(t)=1+E[X]t+\frac{E[X^2]}{2}t^2+\cdots. $$

For a uniform variable on \([1,3]\), direct integration gives

$$ E[X]=\frac{1}{2}\int_1^3 x\,dx =\frac{1}{2}\left[\frac{x^2}{2}\right]_1^3 =\frac{9-1}{4}=2, $$ $$ E[X^2]=\frac{1}{2}\int_1^3 x^2\,dx =\frac{1}{2}\left[\frac{x^3}{3}\right]_1^3 =\frac{27-1}{6}=\frac{13}{3}. $$

Thus \(M_X'(0)=2\), \(M_X''(0)=13/3\), and \(\operatorname{Var}(X)=13/3-2^2=13/3-12/3=1/3\). The result is checked directly: the mean \(2\) is the interval midpoint, and the variance of a uniform variable on an interval of length \(2\) is \(2^2/12=1/3\). A common mistake is to substitute \(t=0\) directly into the quotient and report division by zero; the correct value is the limit, or the original definition \(M_X(0)=1\).

Worked Example: A Gamma Sum With a Rate Parameter

In a hypothetical model, independent waiting times \(X\) and \(Y\) are recorded in hours. Assume \(X\) has a gamma distribution with shape \(2\) and rate \(3\) per hour, and \(Y\) is exponential with rate \(3\) per hour. Find the MGF and distribution of \(S=X+Y\), and calculate its mean and variance. Use the shape-rate convention.

For a gamma variable with shape \(\alpha\) and rate \(\lambda\), the MGF is \((\lambda/(\lambda-t))^\alpha\) for \(t<\lambda\). For an exponential variable with rate \(\lambda\), it is \(\lambda/(\lambda-t)\) on the same domain. Hence

$$ M_X(t)=\left(\frac{3}{3-t}\right)^2,\quad t<3, \qquad M_Y(t)=\frac{3}{3-t},\quad t<3. $$

Both MGFs are finite on an open interval around zero. Since \(X\) and \(Y\) are independent, the product rule applies:

$$ M_S(t)=M_X(t)M_Y(t) =\left(\frac{3}{3-t}\right)^2\left(\frac{3}{3-t}\right) =\left(\frac{3}{3-t}\right)^3,\quad t<3. $$

This is the MGF of a gamma variable with shape \(3\) and rate \(3\). The mean and variance of a shape-\(\alpha\), rate-\(\lambda\) gamma variable are \(\alpha/\lambda\) and \(\alpha/\lambda^2\), respectively. Therefore

$$ E[S]=\frac{3}{3}=1\text{ hour},\qquad \operatorname{Var}(S)=\frac{3}{3^2}=\frac{1}{3}\text{ hour}^2. $$

The component check agrees: \(E[X]=2/3\), \(E[Y]=1/3\), so \(E[S]=1\); their variances are \(2/9\) and \(1/9\), which sum to \(1/3\) under independence. The main trap is treating the rate \(3\) as a scale \(3\). That error would use \((1-3t)^{-2}\) for \(X\), giving mean \(6\), instead of the correct mean \(2/3\). The units also provide a check: a rate is per hour, so the mean waiting time is its reciprocal, not the rate itself.

Worked Example: A Mixed Sum That Is Not Normal

Suppose \(X\) and \(Y\) are independent. Let \(X\sim N(1,4)\), where the second parameter is the variance, and let \(Y\) be exponential with mean \(2\). Find the MGF, mean, and variance of \(S=X+Y\), and decide whether the MGF identifies a normal distribution.

The normal MGF with mean \(\mu\) and variance \(\sigma^2\) is \(\exp(\mu t+\sigma^2t^2/2)\). Thus

$$ M_X(t)=\exp(t+2t^2),\qquad -\infty<t<\infty. $$

An exponential variable with mean \(2\) has rate \(\lambda=1/2\), so its MGF is \(1/(1-2t)\), for \(t<1/2\). This domain includes an open interval around zero. Independence now gives

$$ M_S(t)=\frac{\exp(t+2t^2)}{1-2t},\qquad t<\frac{1}{2}. $$

For a compact moment calculation, take the logarithm:

$$ \log M_S(t)=t+2t^2-\log(1-2t). $$

For any MGF with the needed derivatives, \((\log M_S)'(0)=E[S]\) and \((\log M_S)''(0)=\operatorname{Var}(S)\). Differentiating gives

$$ (\log M_S)'(t)=1+4t+\frac{2}{1-2t}, \qquad (\log M_S)'(0)=1+0+2=3, $$ $$ (\log M_S)''(t)=4+\frac{4}{(1-2t)^2}, \qquad (\log M_S)''(0)=4+4=8. $$

So \(E[S]=3\) and \(\operatorname{Var}(S)=8\), which also follow by adding the independent component means \(1+2\) and variances \(4+4\). The sum is not normal: the logarithm of a normal MGF is a quadratic polynomial in \(t\), whereas this expression includes \(-\log(1-2t)\). The correct conclusion is that the sum has the displayed MGF, not that every sum of independent variables belongs to a familiar named family. A common error is to use the normal-sum rule for all independent sums; that rule applies when both summands are normal, not merely when they are independent.

Error Checks That Prevent Invalid Conclusions

MGF problems reward verification. A short check often exposes an error that algebra alone will not. Keep the distribution’s parameterization and the assumptions visible as you work.

CheckQuestion to askTypical error caught
Value at zeroDoes \(M_X(0)=1\), using a limit if needed?An incorrect constant or an unhandled \(0/0\) expression
DomainIs the MGF finite on an open interval containing zero?Using a formula outside its convergence range
ParameterizationIs the exponential or gamma parameter a rate or a scale?Taking a rate as the mean or scale
IndependenceIs independence stated before multiplying MGFs?Applying the product rule to dependent variables
MomentsDoes the mean and variance agree with component checks where applicable?Confusing \(E[X^2]\) with \(\operatorname{Var}(X)\)
IdentificationDoes the full MGF match the known form, including its parameters and domain?Recognizing only a superficial algebraic resemblance

When a candidate distribution is proposed, compare the entire MGF rather than one feature such as its first two moments. Different distributions can share a mean and variance. If the MGFs agree on an open interval around zero, the uniqueness theorem for MGFs says that they identify the same distribution. If no standard form matches, report the MGF and any moments that were requested without forcing a name onto the distribution.

Key takeaway: State the model, parameter convention, MGF formula, and domain before calculating. Use derivatives only after checking existence near zero, and multiply MGFs for a sum only when independence is established.

Check Your Understanding

For each problem, state the relevant domain or assumption as part of your check.

  1. Let \(B\) be Bernoulli with success probability \(0.3\). Write its MGF and use it to find its mean and variance. (Answer: \(M_B(t)=0.7+0.3e^t\), all real \(t\); mean \(0.3\), variance \(0.21\).)
  2. Let \(T\) be exponential with mean \(5\) days. Give its MGF and domain, then state its variance. (Answer: \(M_T(t)=1/(1-5t)\) for \(t<0.2\); \(\operatorname{Var}(T)=25\) days squared.)
  3. Independent \(G_1\) and \(G_2\) have gamma distributions with shape-rate parameters \((3,2)\) and \((2,2)\). Find the MGF and distribution of their sum, and give its mean and variance. (Answer: \(G_1+G_2\sim\operatorname{Gamma}(5,\text{ rate }2)\); \(M(t)=(2/(2-t))^5\) for \(t<2\); mean \(2.5\), variance \(1.25\).)
  4. Independent variables satisfy \(U\sim N(-2,9)\) and \(V\sim N(4,16)\). Find the distribution and MGF of \(U+V\), using variance as the second normal parameter. (Answer: \(U+V\sim N(2,25)\); \(M(t)=\exp(2t+12.5t^2)\) for all real \(t\).)
  5. Independent counts \(C_1\) and \(C_2\) are Poisson with means \(2\) and \(5\), respectively. Use MGFs to find the distribution, MGF, mean, and variance of \(C_1+C_2\). (Answer: \(C_1+C_2\sim\operatorname{Poisson}(7)\); \(M(t)=\exp(7(e^t-1))\) for all real \(t\); mean and variance are both \(7\).)
Clinical Biostats