Why the Continuous Uniform MGF Has a Special Case at Zero
A continuous uniform model assigns equal density to every point in a finite interval. Its MGF can be derived directly from the density, producing a compact formula that is useful for evaluating exponential expectations and extracting moments. One detail requires care: the formula for nonzero \(t\) has \(t\) in its denominator, so its value at zero must be established separately.
This tutorial considers \(X\sim\operatorname{Uniform}(a,b)\), where \(a<b\). The interval endpoints may be positive, negative, or on opposite sides of zero. Because the interval is finite, the MGF exists for every real value of \(t\).
Deriving the MGF from the Density
For a continuous random variable, the expectation of a function \(g(X)\) is the integral of \(g(x)f_X(x)\) over the support, provided the integral exists. Here \(g(x)=e^{tx}\). Since \(X\) is bounded, \(e^{tX}\) is bounded for each fixed real \(t\), so the expectation is finite.
When \(t\ne 0\), an antiderivative of \(e^{tx}\) is \(e^{tx}/t\). Evaluating the integral at the endpoints gives
At \(t=0\), it is simplest to return to the expectation: \(e^{0X}=1\), so \(M_X(0)=E[1]=1\). The nonzero-\(t\) expression also approaches 1 as \(t\) approaches zero. Both the direct expectation and the limit are useful checks.
The second equality follows from l’Hôpital’s rule: both numerator and denominator in the original ratio approach zero. Thus the MGF is continuous at zero, even though its displayed nonzero-\(t\) expression cannot be evaluated there by direct substitution.
Worked Example: Deriving the MGF and Moments on a Positive Interval
Suppose a hypothetical service duration \(X\), measured in hours, is modeled as uniform on \([2,10]\). Find its MGF, mean, and variance. Use the limiting value at \(t=0\) to check the MGF.
Method. Identify \(a=2\), \(b=10\), and \(b-a=8\), then substitute into the uniform MGF. The parameter \(t\) is measured per hour.
To find the moments, expand the exponentials near zero, or use the general expansion derived below. The coefficient of \(t\) is \(E[X]\), and twice the coefficient of \(t^2\) is \(E[X^2]\):
Therefore \(E[X]=6\) hours and \(E[X^2]=2(22)=44\) hours squared. The variance is
As a check, the direct uniform formulas give mean \((2+10)/2=6\) and variance \((10-2)^2/12=64/12=16/3\). These variance values do not agree—so the expansion calculation needs checking. In fact, the \(t^2\) coefficient is \((a^2+ab+b^2)/6=(4+20+100)/6=124/6=62/3\), not \(22\). Thus \(E[X^2]=124/3\), and
The check catches an arithmetic error before it becomes a final answer. The MGF at zero is also consistent: the limit of \((e^{10t}-e^{2t})/(8t)\) is \((10-2)/8=1\). A common mistake is to substitute \(t=0\) into the quotient and treat the resulting \(0/0\) as the MGF value; the correct value is the limit, which is 1.
Getting the Mean and Variance from the MGF
The MGF derivatives at zero give the raw moments: \(M_X'(0)=E[X]\) and \(M_X''(0)=E[X^2]\). These identities follow by differentiating \(e^{tX}\) with respect to \(t\), then evaluating at zero. For a bounded \(X\), the relevant expectations are finite. Equivalently, expand the exponential inside the defining integral.
For the uniform variable, the expansion makes the moments especially transparent. Using \(e^{tx}=1+tx+t^2x^2/2+\cdots\) in the integral gives
Evaluating the two integrals yields \(E[X]=(a+b)/2\) and \(E[X^2]=(a^2+ab+b^2)/3\). The variance is the second raw moment minus the square of the mean:
This derivation also explains why the interval’s location affects the mean but not the variance: shifting both endpoints by the same amount shifts the center, while the spread depends only on the interval length \(b-a\).
Worked Example: Evaluating the MGF at a Positive Argument
A hypothetical processing time \(T\), in hours, is modeled as uniform on \([0,2]\). Find \(M_T(1)\), \(E[T]\), and \(\operatorname{Var}(T)\). Here the MGF argument \(t=1\) is per hour.
Method. Substitute \(a=0\), \(b=2\), and \(t=1\) into the nonzero-\(t\) formula:
Thus \(M_T(1)=3.1945\) to four decimal places. The moments are
As a basic check, \(M_T(0)=1\), while \(M_T(1)>1\), as expected because \(e^T\geq 1\) on this interval. The common mistake here is to use the interval width alone in the exponent; the endpoint terms are \(e^{bt}\) and \(e^{at}\), so both endpoints must be substituted.
Negative Arguments and Interval Location
The MGF parameter \(t\) need not be positive. A negative argument weights smaller values of \(X\) more heavily through \(e^{tX}\); it does not change the distribution of \(X\). The same formula applies for every nonzero real \(t\), and the quotient remains positive because numerator and denominator have matching signs.
Worked Example: A Negative MGF Argument on a Shifted Interval
A hypothetical completion time \(T\), in hours, is modeled as uniform on \([4,12]\). Find \(M_T(-0.1)\), \(E[T]\), and \(\operatorname{Var}(T)\). The argument \(-0.1\) is per hour.
Method. Use the MGF formula with \(a=4\), \(b=12\), and \(t=-0.1\):
Therefore \(M_T(-0.1)=0.4614\) to four decimal places. The mean and variance are
The positive value of the MGF is a useful sign check: both the numerator and denominator in the unsimplified quotient are negative. A common error is to reverse the numerator but not the denominator, producing a negative result, which cannot be an expectation of the positive quantity \(e^{-0.1T}\).
Common Traps and Practical Checks
The formula is simple, but several details are worth checking whenever it is used:
- Do not substitute zero into the quotient. The quotient gives \(0/0\) at \(t=0\). State \(M_X(0)=1\) from the definition, or compute the limit.
- Keep the interval width in the denominator. It is \((b-a)t\), not just \(t\), because the density is \(1/(b-a)\).
- Use the endpoints in the correct places. The numerator is \(e^{bt}-e^{at}\), in upper-endpoint then lower-endpoint order.
- Check the value at zero and the sign. The MGF must equal 1 at zero and be positive for every real \(t\).
- Track units. If \(X\) is measured in hours, \(tX\) must be dimensionless, so \(t\) is measured per hour.
These derivations and checks are aligned with the SOA VEE Mathematical Statistics syllabus. In particular, the result is specific to a continuous uniform distribution on a finite interval; it should not be applied to an unbounded uniform model or to a different density without re-deriving the expectation.
Check Your Understanding
For each problem, use the finite-interval uniform model and show enough work to identify the endpoints and the relevant MGF or moment calculation.
- A hypothetical measurement \(X\) is uniform on \([1,7]\). Write its MGF, state its value at zero, and find its mean and variance. (Answer: \(M_X(t)=(e^{7t}-e^t)/(6t)\) for \(t\ne0\), \(M_X(0)=1\), \(E[X]=4\), \(\operatorname{Var}(X)=3\).)
- A hypothetical delay \(Y\), in hours, is uniform on \([0,5]\). Find \(M_Y(0.2)\) to four decimal places and state the parameter’s units. (Answer: \(M_Y(0.2)=e-1=1.7183\); \(t\) is per hour.)
- A hypothetical score \(Z\) is uniform on \([-2,4]\). Find \(M_Z(-0.5)\) to four decimal places, along with its mean and variance. (Answer: \(M_Z(-0.5)=(e^{-2}-e^1)/(-3)=0.8610\), \(E[Z]=1\), \(\operatorname{Var}(Z)=3\).)
- A hypothetical duration \(W\) is uniform on an interval of width 6 and has mean 10. Determine its endpoints, MGF, and variance. (Answer: the endpoints are 7 and 13; \(M_W(t)=(e^{13t}-e^{7t})/(6t)\) for \(t\ne0\), \(M_W(0)=1\), and \(\operatorname{Var}(W)=3\).)
- A hypothetical cost index \(Q\) is uniform on \([0,4]\). A candidate substitutes \(t=0\) into \((e^{4t}-1)/(4t)\) and reports \(0/0\). Give the correct value and justify it with a limit. (Answer: \(M_Q(0)=1\), since \(\lim_{t\to0}(e^{4t}-1)/(4t)=4/4=1\).)