Why the Interval Determines the Mean and Variance
For a continuous uniform model, all locations within the specified interval have the same density. That simple shape makes it possible to derive the mean and variance directly from their definitions. The results also have a useful interpretation: the mean identifies the interval’s midpoint, while the variance depends only on its width.
This tutorial assumes a nondegenerate interval with fixed endpoints \(a<b\). A uniform model is not appropriate merely because observations lie between two limits; it also assumes the density is constant throughout that interval. The calculations below concern a continuous random variable, so the probability of any single exact value is zero.
The density is constant because the total area under it must equal one: the interval has length \(b-a\), so a rectangle of height \(1/(b-a)\) has area \((b-a)/(b-a)=1\). For any function \(g\) whose expectation exists, the density gives \(E[g(X)]=\int_a^b g(x)f_X(x)\,dx\). In particular, use \(g(x)=x\) to find the mean and \(g(x)=x^2\) to find the second raw moment.
Deriving the Mean
Under the stated uniform model, the mean is the integral of \(x\) weighted by the density. The constant density can be factored out of the integral.
The cancellation is valid because \(b>a\), so \(b-a\neq0\). The result is the midpoint of the endpoints. This makes sense geometrically: the density assigns equal weight to positions equally far to either side of the midpoint. The mean is not generally either endpoint, and it is not determined by the interval’s width alone.
Deriving the Variance
A direct route to variance is to find the second raw moment \(E[X^2]\) and subtract the square of the mean. This identity follows by expanding the definition:
In the third line, \(E[X]\) is a constant, so \(E[X\,E[X]]=E[X]E[X]\). Now integrate \(x^2\) under the uniform density:
Substitute this moment and the mean \((a+b)/2\) into the variance identity. Showing the algebra is useful because it reveals why the endpoint difference, rather than their sum, controls the answer.
The mean depends on the location of the interval: shifting both endpoints by the same amount shifts the mean by that amount. The variance depends on the interval’s width and not its location. Thus, shifting an interval without changing its width leaves its variance unchanged; doubling the width multiplies the variance by four. Variance is measured in squared units, which is why it should not be reported in the original units.
Applying the Formulas Carefully
The derived formulas are efficient, but their brevity can hide two decisions: identify which endpoint is \(a\) and which is \(b\), and keep track of the measurement units. The following examples show the calculations explicitly. Each uses a continuous uniform model with stated parameters; none involves an interest rate or a mortality assumption.
Worked Example: Moments on an Interval That Includes Negative Values
A measurement \(X\), recorded in signed index units, is modeled as \(X\sim\operatorname{Unif}(-2,4)\). Find its mean, second raw moment, and variance. State which result depends on the interval’s location and which depends on its width.
Method. Apply the integrated uniform formulas with \(a=-2\) and \(b=4\). This is a continuous uniform model with those two parameters; no interest rate or mortality assumption applies.
Mean. The endpoint sum is \(-2+4=2\), so
Second raw moment. Substitute both endpoints into the formula for \(E[X^2]\):
Variance. The width is \(4-(-2)=6\), so
Check using the second-moment identity: \(E[X^2]-(E[X])^2=4-1^2=3\), agreeing with the width calculation. The mean reflects the location of this interval; the variance reflects its width. Common mistake avoided: a negative lower endpoint must be subtracted when finding the width, so \(4-(-2)=6\), not \(4-2\).
Worked Example: Claim Amounts Reported in Thousands of Dollars
For a hypothetical model, a claim amount \(X\), measured in thousands of dollars, is uniformly distributed from \(1.5\) to \(7.5\) thousand dollars. Find the mean claim amount in dollars and the variance in dollars squared. The model is \(X\sim\operatorname{Unif}(1.5,7.5)\) in thousands; no interest rate or mortality assumption is used.
Method. First calculate the moments in thousands of dollars, then convert the mean by multiplying by \(1{,}000\) and the variance by \(1{,}000^2\). Squared units require a squared conversion factor.
The midpoint and width, in thousands, are
Thus the mean is \(4.5\) thousand dollars, or \(4.5(1{,}000)=\$4{,}500\). The variance in squared thousands of dollars is
Since one thousand dollars is \(\$1{,}000\), one squared thousand dollars is \((\$1{,}000)^2=\$1{,}000{,}000\). Therefore the variance in dollars squared is \(3(1{,}000{,}000)=\$3{,}000{,}000\) dollars squared. As a check, the standard deviation is \(6/\sqrt{12}=\sqrt{3}\) thousand dollars, whose square is \(3\) squared thousands. Common mistake avoided: converting the variance by \(1{,}000\), rather than by \(1{,}000^2\), would mix units.
Worked Example: Separating a Shift in Location From a Change in Width
A hypothetical processing-time model is \(T\sim\operatorname{Unif}(8,20)\), with time measured in minutes. A revised model shifts both endpoints upward by 3 minutes, so \(T_{\text{new}}\sim\operatorname{Unif}(11,23)\). Find both means and variances, then compare them. Both are continuous uniform models with the stated minute-valued endpoints; no interest rate or mortality assumption applies.
Method. Calculate each midpoint and width separately. This makes it possible to distinguish the effect of changing location from the effect of changing spread.
For the original model, the midpoint is \((8+20)/2=28/2=14\) minutes, and its width is \(20-8=12\) minutes. Hence
For the revised model, the midpoint is \((11+23)/2=34/2=17\) minutes, and its width is \(23-11=12\) minutes. Hence
The mean increases by \(17-14=3\) minutes, matching the shift in both endpoints. The variance is unchanged because the width remains 12 minutes. Common mistake avoided: treating a shifted interval as more variable just because its endpoints are larger. Variance uses the width, not the endpoint values separately.
Common Errors and When the Formulas Apply
The formulas are specific to a continuous uniform distribution on a finite interval with \(a<b\). They do not follow from knowing only that a variable has a lower and upper bound. If the density is not constant, its moments must be calculated from its actual density. Also, these formulas describe the model’s population mean and variance; they do not guarantee that a particular finite sample will have exactly those values.
A frequent algebra error is to confuse the second raw moment \(E[X^2]\) with the variance. The second raw moment measures squared distance from zero; the variance measures squared distance from the mean. The correction is to subtract the squared mean:
not simply \(\operatorname{Var}(X)=E[X^2]\). Another common error is to use the endpoint sum in the variance formula. The sum \(a+b\) determines the midpoint and thus the mean; the difference \(b-a\) determines the width and thus the variance. Finally, if the variable is expressed in thousands, convert its variance using the square of the unit conversion, and state the resulting squared units.
Check Your Understanding
For each problem, identify the interval parameters before calculating. Answers are given for checking after you have tried the work.
- A continuous measurement has distribution \(X\sim\operatorname{Unif}(2,8)\). Find \(E[X]\), \(E[X^2]\), and \(\operatorname{Var}(X)\). (Answer: \(E[X]=5\), \(E[X^2]=28\), and \(\operatorname{Var}(X)=3\).)
- A hypothetical duration \(D\), in minutes, is uniformly distributed on \([1,13]\). Find its mean and variance, including units. (Answer: \(E[D]=7\) minutes and \(\operatorname{Var}(D)=12\) minutes squared.)
- A hypothetical payment amount is uniformly distributed from \(2\) to \(8\) thousand dollars. Find its mean in dollars and variance in dollars squared. (Answer: mean \(=\$5{,}000\); variance \(=\$3{,}000{,}000\) dollars squared.)
- A continuous uniform variable has mean \(10\) and interval width \(6\). Find its endpoints and variance. (Answer: endpoints \(7\) and \(13\); variance \(=3\).)
- Compare \(X\sim\operatorname{Unif}(4,10)\) and \(Y\sim\operatorname{Unif}(7,13)\). Find each mean and variance and describe which quantity changes. (Answer: \(E[X]=7\), \(E[Y]=10\), and both variances equal \(3\); the mean changes by \(3\), while the variance is unchanged.)