From an MGF to a Mean and Variance
A moment generating function can encode useful numerical summaries of a distribution. Once an MGF is known, its first two derivatives at zero give the first two raw moments, from which the mean and variance follow. The main computational challenge is usually differentiating and simplifying correctly before substituting zero.
This method applies when the MGF exists in an open interval containing zero, so that the required derivatives and moments are available. In each example below, the distribution and its parameters are stated, and its MGF is supplied for calculation. The task is to use that MGF, not to derive it.
The notation \(E[X^2]\) is important: the second derivative at zero gives the second raw moment, not the variance. The variance is the expected squared deviation from the mean, so it requires one further calculation.
Why the Variance Formula Works
The derivative results for the MGF give \(M_X'(0)=E[X]\) and \(M_X''(0)=E[X^2]\). Apply the definition of variance and expand the square:
In the third line, \(E[X]\) is a constant, so it can be taken outside the expectation. This establishes why the square of the mean must be subtracted after evaluating the second derivative.
A Reliable Calculation Process
A disciplined order of operations reduces algebra errors and makes units easier to check. In particular, differentiate first and evaluate at zero only after obtaining expressions for the derivatives.
Confirm that the supplied function is an MGF defined for values of \(t\) in an open interval containing zero. A formula that is not valid around zero cannot be used for this derivative method.
Find \(M_X'(t)\) and \(M_X''(t)\). Use the product rule or chain rule as needed, and simplify before substituting \(t=0\).
Set \(t=0\) in the simplified derivatives to obtain \(E[X]\) and \(E[X^2]\).
Subtract \((E[X])^2\) from \(E[X^2]\). Check that the variance is nonnegative and that its units are the square of the units of \(X\).
Worked Calculations
Worked Example: A Shifted Exponential Severity
Problem. In a hypothetical model, a claim severity \(X\), measured in thousands of dollars, has a shifted exponential distribution: \(X=3+Z\), where \(Z\) is exponential with rate \(0.5\) per thousand dollars. The supplied MGF is \(M_X(t)=e^{3t}/(1-2t)\), for \(t<0.5\). Calculate the mean and variance of \(X\), showing how the derivatives simplify.
Method. Differentiate the supplied MGF and evaluate the derivatives at zero. The stated domain contains an open interval around zero, so the derivative formulas apply.
Write the MGF as a product. By the product rule,
At zero, \(e^0=1\) and \(1-2(0)=1\), giving
thousand dollars. To find the second derivative without losing terms, set \(L(t)=\log M_X(t)\). Then \(M_X'(t)=M_X(t)L'(t)\), and differentiating once more gives \(M_X''(t)=M_X(t)\bigl((L'(t))^2+L''(t)\bigr)\). Here
Since \(M_X(0)=1\), \(L'(0)=5\), and \(L''(0)=4\),
Therefore,
in squared thousands of dollars. The result is consistent with the model: adding a constant shift changes the mean but does not add variability. Common mistake avoided: \(29\) is the second raw moment, not the variance; subtracting \(25\) is essential. As a check, the variance is positive and its units are squared.
Worked Example: Simplifying a Power-Function Derivative
Problem. A hypothetical processing time \(T\), measured in hours, follows a gamma distribution with shape parameter \(\alpha=2\) and scale parameter \(\theta=3\) hours. Its supplied MGF is \(M_T(t)=(1-3t)^{-2}\), for \(t<1/3\). Find \(E[T]\) and \(\operatorname{Var}(T)\).
Method. Apply the chain rule to the MGF twice, retaining the factor from differentiating the inner function \(1-3t\).
At zero, both powers of \(1-3t\) equal one. Thus
Convert the second raw moment to variance:
The mean and variance are both positive, and the variance has squared-hour units. Common mistake avoided: differentiating \((1-3t)^{-2}\) without multiplying by the derivative \(-3\) of the inner expression would give incorrect moments.
Worked Example: A Normal Measurement and Cancellation
Problem. A hypothetical measurement \(Y\), in units, follows \(N(100,400)\), where the second parameter is the variance. Its supplied MGF is \(M_Y(t)=\exp(100t+200t^2)\), defined for all real \(t\). Use the MGF to calculate the mean and variance, and explain what happens when the variance is calculated.
Method. Differentiate the exponential by the chain rule. If \(g(t)=100t+200t^2\), then \(M_Y'(t)=g'(t)e^{g(t)}\), and differentiating again gives \(M_Y''(t)=\bigl(g''(t)+(g'(t))^2\bigr)e^{g(t)}\).
so the two derivatives are
Substitute zero, for which the exponential factor is \(1\):
Therefore,
The result matches the variance parameter in \(N(100,400)\), providing an independent check on the calculation. Common mistake avoided: the \(400\) appearing in \(M_Y''(0)\) is not the whole second moment; the second moment is \(10{,}400\), and the variance emerges only after the \(100^2\) term is subtracted.
Common Errors and Practical Checks
The formulas are short, but several errors recur in calculations. Use the following checks before accepting a result:
- Confusing a raw moment with a central moment. \(M_X''(0)=E[X^2]\), while \(\operatorname{Var}(X)=E[X^2]-(E[X])^2\). They are generally not equal.
- Substituting zero too early. The value \(M_X(0)=1\) does not tell you either derivative. Differentiate first, then evaluate at zero.
- Dropping a chain-rule factor. For example, differentiating a power of \(1-ct\) requires the factor \(-c\) from the inner function. Keep it through both derivatives.
- Squaring the wrong quantity. The variance formula subtracts \(\bigl(M_X'(0)\bigr)^2\), not \(M_X''(0)^2\) and not \(M_X'(0)\).
- Ignoring units. If \(X\) is measured in hours, \(E[X]\) is in hours and \(\operatorname{Var}(X)\) is in hours squared. A negative calculated variance signals an algebra or arithmetic error.
- Using a formula outside its conditions. The MGF must exist on an open interval containing zero for the derivative method to apply. A function only defined at zero, or only on one side without a neighborhood around zero, does not meet this condition.
A final arithmetic check is to compare the size of the raw second moment with the squared mean. Since variance cannot be negative, a valid calculation must satisfy \(E[X^2]\geq (E[X])^2\). This does not replace differentiating carefully, but it can expose an inconsistent answer.
Check Your Understanding
For each hypothetical model, use the supplied MGF and stated parameters to find the requested mean and variance. The answer is given at the end of each problem for checking.
- A shifted exponential claim amount \(C\), measured in thousands of dollars, has shift \(2\) and exponential rate \(0.25\) per thousand dollars. Its MGF is \(M_C(t)=e^{2t}/(1-4t)\), for \(t<0.25\). Find \(M_C'(0)\), \(M_C''(0)\), and \(\operatorname{Var}(C)\). (Answer: \(E[C]=6\) thousand dollars, \(E[C^2]=52\) squared thousands of dollars, and \(\operatorname{Var}(C)=16\) squared thousands of dollars.)
- A gamma-distributed service time \(W\), in minutes, has shape \(3\), scale \(2\) minutes, and supplied MGF \(M_W(t)=(1-2t)^{-3}\), for \(t<1/2\). Calculate the first two raw moments and the variance. (Answer: \(E[W]=6\) minutes, \(E[W^2]=48\) minutes squared, and \(\operatorname{Var}(W)=12\) minutes squared.)
- A hypothetical instrument reading \(R\) follows \(N(7,16)\), with variance \(16\), and has MGF \(M_R(t)=e^{7t+8t^2}\). Differentiate twice and obtain its mean and variance. (Answer: \(E[R]=7\), \(E[R^2]=65\), and \(\operatorname{Var}(R)=16\).)
- A shifted gamma variable \(Q\), measured in units, has shift \(-1\), shape \(2\), scale \(1/3\), and supplied MGF \(M_Q(t)=e^{-t}(1-t/3)^{-2}\), for \(t<3\). Find its mean and variance, taking care to distinguish the shift's effect on each. (Answer: \(E[Q]=-1/3\) units and \(\operatorname{Var}(Q)=2/9\) squared units.)
- For a random variable \(H\), an MGF calculation gives \(M_H'(0)=8\) and \(M_H''(0)=100\), with \(H\) measured in days. Determine the mean, second raw moment, and variance, and state which of the two derivative values is not itself the variance. (Answer: \(E[H]=8\) days, \(E[H^2]=100\) days squared, and \(\operatorname{Var}(H)=36\) days squared; \(M_H''(0)\) is not itself the variance.)