What Is the MGF of a Uniform Distribution?
At a glance
- 1. Identify the interval
For a continuous uniform variable, write its support as [a,b], where a is less than b.
- 2. Use the density
Substitute the constant density 1/(b-a) into the expectation of exp(tX).
- 3. Evaluate the integral
Integrate exp(tx) from a to b, then use the limit at t=0.
- 4. Differentiate for moments
The first derivative at zero gives the mean; the second derivative gives the second moment.
For a continuous uniform random variable, the moment-generating function depends on the endpoints of its interval. If is uniform on , its MGF has a simple exponential form for nonzero and equals 1 at . The formula also gives the mean and variance by differentiation.
Formula for a continuous uniform distribution
Let , with . Its density is for and zero elsewhere. By definition, the moment-generating function is
Therefore,
The MGF exists for every real value of . This is true because is bounded, so the expectation of is finite for any fixed real .
Deriving the formula
Use the density to express the expectation as an integral:
For , an antiderivative of is . Evaluating at the endpoints gives
At , the integrand in the expectation is , so . The nonzero- expression also approaches 1 as approaches zero, but writing the value separately avoids an apparent division by zero.
Getting the mean and variance
When the MGF exists around zero, its derivatives at zero give the moments:
For , these yield
The variance follows from . The MGF is useful for more than moments: for independent random variables, the MGF of their sum is the product of their MGFs, whenever the MGFs exist.
Worked example: uniform on [2,5]
Suppose . Here and , so
Expanding the exponentials near zero makes the moments visible:
An MGF expansion has the form . Thus and . The variance is
This agrees with the uniform variance formula: .
Common special cases and conventions
For the standard uniform distribution on , set and :
For a uniform distribution on , where , the formula simplifies to for , with value 1 at zero.
The formula above is for a continuous uniform distribution. If instead is discrete and equally likely to be one of the integers , then
The continuous formula does not apply to that integer-valued case.
Common mistakes
- Substituting into the quotient: The quotient appears to divide by zero there. Use , or take the limit.
- Using the endpoints as the mean: The mean is their midpoint, , not either endpoint.
- Confusing width and variance: The interval width is ; the variance is its square divided by 12.
- Forgetting the density factor: The integral must be divided by . Omitting it gives a result that is not an MGF, since it will not equal 1 at zero.
References
- A First Course in Probability — Sheldon Ross
- Statistical Inference — George Casella and Roger L. Berger
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.