Introduction
A uniform law on a finite interval describes a continuous random variable whose density is constant throughout that interval and zero outside it. This simple model makes a useful first check of how a density determines a distribution: the density must have total integral one, and its integral from the left gives the cumulative distribution function (CDF). Endpoints deserve careful attention because the density is positive right up to the boundary, yet the probability of landing on any one exact point is zero.
Let the interval endpoints be real numbers \(a\) and \(b\), with \(a<b\). Its length is \(b-a\). Dividing one unit of total probability evenly across this length gives a constant density of \(1/(b-a)\) on the interval. The resulting CDF is zero before the interval, rises linearly across it, and equals one afterward.
Definition and Density Check
A density must be nonnegative and integrate to one. Nonnegativity follows immediately because \(b-a>0\). To check the total integral, the density is zero outside \([a,b]\), so
This also explains why the height depends on the interval length. A longer interval requires a smaller constant height to keep the total area equal to one; a shorter interval requires a larger height.
Worked Example: Checking a Uniform Density on \([-1,3]\)
Suppose \(X\sim\operatorname{Unif}[-1,3]\). Find the density height and verify that the proposed density has total integral one.
The interval length is \(b-a=3-(-1)=4\). Thus the density is
The density is nonnegative. Its total integral is
The constant height \(1/4\) is not itself a probability. It is probability per unit of \(x\); probabilities come from integrating the density over sets.
Deriving the CDF
The CDF is defined at every real number \(x\) by \(F(x)=P(X\le x)\). For a random variable with density \(f\), this probability is the integral of \(f\) from \(-\infty\) to \(x\). For a uniform variable, there are three cases, depending on where \(x\) lies relative to the support.
Proof. If \(x<a\), the event \(X\le x\) lies entirely to the left of the support, where the density is zero. Hence \(F(x)=0\). If \(a\le x\le b\), the density is zero below \(a\) and equal to \(1/(b-a)\) from \(a\) through \(x\), so
If \(x>b\), the entire support lies at or below \(x\), so the integral includes all of the density and equals one. At \(x=a\), the middle expression gives \((a-a)/(b-a)=0\); at \(x=b\), it gives \((b-a)/(b-a)=1\). Thus the stated endpoint values agree with the formula and with the probabilities. \(\square\)
The middle expression rises linearly from zero to one. At \(a\), it joins the zero part of the CDF; at \(b\), it joins the constant-one part. The CDF is therefore continuous at both endpoints. Its value at \(a\) is not \(1/(b-a)\): that number is the density height, not the cumulative probability at the endpoint.
Worked Example: Writing the CDF on \([2,8]\)
Let \(X\sim\operatorname{Unif}[2,8]\). Write its CDF and evaluate it at \(x=1\), \(x=5\), \(x=8\), and \(x=9\).
The interval length is \(8-2=6\), so the density on the support is \(1/6\). Applying the three-case CDF formula gives
Since \(1<2\), \(F(1)=0\). Since \(5\) is within the support,
At the right endpoint, \(F(8)=(8-2)/6=1\). Since \(9>8\), \(F(9)=1\). The values at the endpoints are obtained from the middle formula as well: \(F(2)=(2-2)/6=0\) and \(F(8)=1\).
Boundary Events and Exact Points
For a continuous random variable, the probability of any one exact value is zero. For \(X\sim\operatorname{Unif}[a,b]\), this fact can be checked directly from the density: the integral over the singleton \(\{c\}\) is zero for every real \(c\), because a single point has length zero. It can also be checked from the CDF. For any \(c\), \(P(X=c)=F(c)-\lim_{x\uparrow c}F(x)\); the uniform CDF has no jump, so this difference is zero.
The density formula assigns a value \(1/(b-a)\) at \(a\) and \(b\) under the convention used here. This does not create point masses. A density specifies probabilities through integrals, and changing its value at one or two points would leave every such integral unchanged. The displayed endpoint convention makes the support definition neat; it does not mean that the endpoints receive positive probability.
Worked Example: Probabilities at Both Endpoints
Suppose \(X\sim\operatorname{Unif}[4,10]\). Evaluate \(P(X=4)\), \(P(X\le4)\), \(P(X<10)\), \(P(X=10)\), \(P(X\le10)\), and \(P(4\le X\le10)\).
The CDF is zero at and below the left endpoint, rises from zero to one over the support, and equals one at and beyond the right endpoint. In particular, \(F(4)=0\) and \(F(10)=1\). By the definition of the CDF, \(P(X\le4)=F(4)=0\), and \(P(X\le10)=F(10)=1\).
The exact endpoint events have probability zero. Thus \(P(X=4)=0\) and \(P(X=10)=0\). Since \(P(X=10)=0\), removing that endpoint from the event \(X\le10\) leaves its probability unchanged, so \(P(X<10)=1\). The event \(4\le X\le10\) contains the entire support, and therefore has probability one. These values are consistent: neither endpoint contributes positive probability.
Worked Example: A Boundary Calculation from a CDF
Let \(Y\sim\operatorname{Unif}[-3,5]\). Determine \(P(Y<-3)\), \(P(Y\le-3)\), \(P(Y<5)\), \(P(Y\le5)\), and \(P(Y>5)\), showing how the endpoint values settle each case.
Here \(b-a=5-(-3)=8\). The CDF is zero below \(-3\), equals \((y+3)/8\) on \([-3,5]\), and equals one above \(5\). Therefore \(P(Y<-3)=0\), since values below the support have zero probability; and \(P(Y\le-3)=F(-3)=(-3+3)/8=0\).
At the right endpoint, \(F(5)=(5+3)/8=1\), so \(P(Y\le5)=1\). The probability of the exact endpoint is zero, hence \(P(Y<5)=P(Y\le5)-P(Y=5)=1-0=1\). Finally, \(P(Y>5)=0\), because \(Y\) has no support above 5. The strict and inclusive versions agree at each boundary because the singleton endpoint has probability zero.
Common Mistakes and Why the Boundary Details Matter
The CDF provides a compact description of the distribution and gives a precise way to handle inequalities. In particular, it is defined using \(X\le x\), not \(X<x\). For a uniform variable these two probabilities happen to agree at every \(x\), because there are no point masses, but that agreement is a consequence of continuity rather than the definition of a CDF.
- Using the density height as an endpoint probability. The value \(f(a)=1/(b-a)\) is a density value. It is not \(P(X=a)\), which is zero.
- Omitting the outside cases in the CDF. The linear expression \((x-a)/(b-a)\) applies only for \(a\le x\le b\). Used below \(a\), it can be negative; used above \(b\), it can exceed one. The CDF must instead be zero below the support and one above it.
- Reversing the endpoint values. The CDF accumulates probability from left to right, so it is zero at \(a\) and one at \(b\), not the reverse.
- Confusing support with positive point probability. The endpoints belong to the support, but each exact endpoint has probability zero. Support describes where the distribution is concentrated, not which individual points receive positive mass.
These checks are useful whenever a continuous model is written piecewise. Verify that the density integrates to one, check the CDF below, at, within, and above the support, and distinguish probabilities of exact values from density heights. Those steps catch most endpoint and parameterization errors before any more involved calculation is attempted.
Check Your Understanding
Use the definition and CDF of a uniform law to answer these questions.
- For \(X\sim\operatorname{Unif}[1,7]\), what is the density height, and what integral verifies that the density is normalized?
- Write the CDF of \(X\sim\operatorname{Unif}[-2,4]\), including the cases outside the support and the values at both endpoints.
- If \(Z\sim\operatorname{Unif}[0,9]\), evaluate \(P(Z\le0)\), \(P(Z=0)\), \(P(Z<9)\), and \(P(Z\le9)\).
- Explain why a positive density value at an endpoint does not imply positive probability at that exact point.
- For a uniform variable on \([a,b]\), why must the formula \((x-a)/(b-a)\) be restricted to the support when it is used as part of the CDF?