Why Moments Are Useful
A distribution can be described in several ways. Probabilities and quantiles answer questions about events and cutoffs; moments summarize aspects of the distribution's location, spread, and shape. For a uniform distribution on a finite interval, the density is constant, so these summaries can be derived directly with elementary integrals. The calculations also give a useful example of the distinction between a moment about zero and a moment about the mean.
Let \(X\sim\operatorname{Unif}(a,b)\), where \(a<b\) are finite real numbers. Its density is \(f(x)=1/(b-a)\) for \(a<x<b\), and zero elsewhere. Values of a density at the endpoints do not affect the integrals below. Since \(X\) is bounded, every nonnegative integer moment considered here exists and is finite.
Raw Moments by Direct Integration
For any nonnegative integer \(k\), the expectation integral uses the density on the interval \((a,b)\). Integrating the power \(x^k\) gives a formula for all raw moments at once.
This formula includes \(k=0\), for which it gives \(E[1]=1\), as it must. For \(k=1\), factoring \(b^2-a^2=(b-a)(a+b)\) gives the mean. For \(k=2\), it gives the raw second moment.
Worked Example: Raw Moments on the Unit Interval
Let \(X\sim\operatorname{Unif}(0,1)\). Calculate its first three raw moments.
For \(k=1\), direct integration gives \[ E[X]=\int_0^1 x\,dx=\left[\frac{x^2}{2}\right]_0^1=\frac12. \] For \(k=2\), \[ E[X^2]=\int_0^1 x^2\,dx=\left[\frac{x^3}{3}\right]_0^1=\frac13. \] For \(k=3\), \[ E[X^3]=\int_0^1 x^3\,dx=\left[\frac{x^4}{4}\right]_0^1=\frac14. \] These are moments about zero. In particular, \(E[X^2]=1/3\) is not the variance; the variance is calculated by centering at the mean.
Mean and Variance
The mean is the first raw moment, \(\mu=(a+b)/2\), the midpoint of the interval. To obtain the variance from raw moments, first expand its definition:
The last equality uses \(E[X]=\mu\). Substituting the raw second moment and the mean yields
There is also a direct centered-integral derivation. It is useful for obtaining the higher central moments, so we develop it more generally. Set \(m=(a+b)/2\) and \(d=b-a>0\). In the integral for a central moment, use \(y=x-m\). Then \(x=a\) corresponds to \(y=-d/2\), \(x=b\) corresponds to \(y=d/2\), and the density remains \(1/d\). Thus
Worked Example: Mean and Variance from Raw Moments
Let \(X\sim\operatorname{Unif}(2,8)\). Calculate the mean and variance, showing how the variance follows from the raw moments.
The interval width is \(8-2=6\), and the mean is \[ E[X]=\frac{2+8}{2}=5. \] The second raw moment is \[ E[X^2]=\frac{8^3-2^3}{3(8-2)} =\frac{512-8}{18} =\frac{504}{18}=28. \] Therefore, \[ \operatorname{Var}(X)=E[X^2]-(E[X])^2=28-5^2=28-25=3. \] The direct width formula gives the same result: \((8-2)^2/12=36/12=3\).
Higher Central Moments
The centered integration formula immediately explains a symmetry property. For odd \(k\), the function \(y^k\) is odd, and the integration limits are symmetric about zero. Its integral is therefore zero. For even \(k\), integrate the power over the positive and negative halves, whose contributions are equal.
Proof. The centered integral is \(d^{-1}\int_{-d/2}^{d/2}y^k\,dy\). If \(k\) is odd, an antiderivative is \(y^{k+1}/(k+1)\), and \(k+1\) is even. The values at \(d/2\) and \(-d/2\) are equal, so their difference is zero.
If \(k\) is even, the integrand is even, and hence \[ \frac{1}{d}\int_{-d/2}^{d/2}y^k\,dy =\frac{2}{d}\int_0^{d/2}y^k\,dy =\frac{2}{d}\cdot\frac{(d/2)^{k+1}}{k+1} =\frac{d^k}{2^k(k+1)}. \] Both cases follow from the density integral, so no additional symmetry assumption is needed beyond the uniform density on the interval. \(\square\)
For \(k=1\), the result confirms that the first central moment is zero. For \(k=2\), it recovers the variance \(d^2/12\). The next even central moments are
The third central moment is zero. When standardized moments are desired, the standardized third central moment is \(E[(X-\mu)^3]/\operatorname{Var}(X)^{3/2}=0\). The standardized fourth central moment is \[ \frac{E[(X-\mu)^4]}{\operatorname{Var}(X)^2} =\frac{d^4/80}{(d^2/12)^2} =\frac{d^4/80}{d^4/144} =\frac{9}{5}. \] This ratio is sometimes called the kurtosis; the excess kurtosis, defined as kurtosis minus \(3\), is \(-6/5\). These ratios do not depend on the interval endpoints because the powers of its width cancel.
Worked Example: Fourth Central Moment on a Shifted Interval
Let \(X\sim\operatorname{Unif}(-1,3)\). Find its mean, variance, third central moment, and fourth central moment.
The width is \(d=3-(-1)=4\), so the mean is \[ \mu=\frac{-1+3}{2}=1. \] The variance is \[ \operatorname{Var}(X)=\frac{4^2}{12}=\frac{16}{12}=\frac43. \] Because the interval is centered at \(1\), the third central moment vanishes by the odd-moment result: \[ E[(X-1)^3]=0. \] The fourth central moment is \[ E[(X-1)^4]=\frac{4^4}{80}=\frac{256}{80}=\frac{16}{5}. \] As a check, the standardized fourth moment is \[ \frac{16/5}{(4/3)^2} =\frac{16}{5}\cdot\frac{9}{16} =\frac95, \] which agrees with the value for any nondegenerate finite uniform interval.
Common Mistakes and Checks
Moments are compact summaries, but their formulas are easy to misapply. A reliable calculation starts by identifying both the power and the center about which it is taken.
- Using the raw second moment as the variance. The false step is to write \(\operatorname{Var}(X)=E[X^2]\). The definition instead gives \(\operatorname{Var}(X)=E[X^2]-(E[X])^2\). For \(X\sim\operatorname{Unif}(2,8)\), these values are \(28\) and \(3\), respectively.
- Centering at zero when a central moment is requested. \(E[X^4]\) and \(E[(X-\mu)^4]\) are different quantities in general. A central moment requires subtracting the mean inside the power before taking the expectation.
- Assuming every odd raw moment is zero. It is odd central moments that vanish here, because the interval is symmetric about its mean. If the interval is shifted away from zero, an odd raw moment need not vanish.
- Forgetting the interval width in the density. The density is \(1/(b-a)\), not \(1\) unless the interval has width \(1\). Omitting this factor produces an integral that is incorrectly scaled.
A quick check is to confirm that the mean lies halfway between the endpoints, the variance is positive and scales with the square of the interval width, and every odd central moment is zero. The second-moment formula also gives a useful consistency check: substituting the mean and raw second moment must reproduce \((b-a)^2/12\).
Check Your Understanding
Use direct integration or the derived formulas, and show enough work to identify which moment is being calculated.
- For \(X\sim\operatorname{Unif}(1,5)\), calculate \(E[X^2]\) and \(\operatorname{Var}(X)\). Why are these not the same quantity?
- For a uniform variable on \((a,b)\), explain from the centered integral why its third central moment is zero.
- Find the fourth central moment of a uniform variable on an interval of width \(10\).
- If a uniform variable has mean \(4\) and variance \(3\), what is its interval width? State why the width must be positive.
- For \(X\sim\operatorname{Unif}(0,1)\), calculate the third raw moment and compare it with the third central moment.