Why Can’t I Compute the Expected Value from a Uniform MGF?
At a glance
- 1. Find the MGF
Integrate e to the power tX over the uniform distribution’s support.
- 2. Define It at Zero
The formula has a removable 0/0 at t = 0; the MGF itself equals 1 there.
- 3. Differentiate at Zero
The expected value is the derivative of the MGF evaluated at zero.
- 4. Use the Limit
Expand the exponential or take a limit before substituting t = 0.
If you try to substitute into the usual MGF formula for a continuous uniform distribution, you get a fraction with both numerator and denominator equal to zero. That does not mean the MGF fails or that you cannot use it to find the mean. The formula is written in a form that is undefined at zero, even though the MGF itself is well defined there.
For , the expected value is the derivative of the MGF at zero:
The MGF of a continuous uniform variable
The moment-generating function is defined by . For a uniform distribution on , the density is throughout that interval, so
At , use the definition instead: . This is also the limit of the displayed formula as approaches zero. Since a uniform variable on a finite interval is bounded, its MGF exists for every real .
The mean comes from differentiating the MGF and then evaluating at zero—not from evaluating the MGF itself at zero. In general, when the MGF exists in a neighborhood of zero.
Why direct substitution seems to fail
The numerator becomes at , while the denominator also becomes zero. Thus, the formula for has the indeterminate form at that one point. You cannot substitute zero into that quotient and expect a value.
Instead, expand the exponentials near zero:
Dividing by gives
The coefficient of is the derivative at zero, so . The same expansion shows why the apparent singularity disappears: as approaches zero, the quotient approaches , agreeing with .
Worked example:
Here,
Substituting into this expression produces . Expand the numerator instead:
Subtract and divide by :
Therefore, . This agrees with the midpoint of the interval, . You can also check it directly from the uniform density: the mean is .
If you mean a discrete uniform distribution
For a variable equally likely to be any integer from through , inclusive, the MGF is a finite sum:
Differentiate the sum and set . Each term contributes , so the result is the average of the integers from to :
The same principle applies: differentiate the MGF first, then evaluate at zero. The continuous and discrete formulas differ, but neither distribution prevents you from using the MGF.
Common mistakes
- Setting in the quotient too early. The quotient formula is for ; use a limit or series to handle zero.
- Confusing with the mean. The MGF at zero is always . Its first derivative at zero gives the mean.
- Differentiating a numerically unstable expression near zero. The closed-form derivative can involve cancellation between nearly equal quantities. For calculations close to zero, a series expansion or the integral definition is often more reliable.
- Assuming the MGF does not exist. A continuous uniform variable on a finite interval has a finite MGF for every real ; the issue is only the displayed formula’s removable singularity at zero.
References
- A First Course in Probability — Sheldon Ross
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.