Tutorials › VEE Mathematical Statistics › Constructing the Uniform Cumulative Distribution Function

VEE Mathematical Statistics · Uniform and Exponential Models · Tutorial 174 of 880

Constructing the Uniform Cumulative Distribution Function

Learn to build and evaluate the piecewise CDF of a uniform variable, with careful attention to its support and endpoints.

Beginner 9 min read

What You'll Learn

  • State the definition of a cumulative distribution function and the uniform model on an interval.
  • Derive the CDF from the constant density on the support.
  • Write the correct CDF branch below, within, and above the support.
  • Evaluate the CDF at interior points and at both support endpoints.
  • Detect common errors involving the lower endpoint, the upper endpoint, and the direction of accumulation.

From a Uniform Density to a Cumulative Function

A density describes how probability is distributed across the possible values of a continuous variable. A cumulative distribution function answers a different question: how much probability has accumulated by a specified value? For a uniform variable, the density is constant over its support, so the CDF increases at a constant rate there. Outside the support, it stays at its boundary value.

The support endpoints matter. Below the lower endpoint, the variable cannot have taken a value at or below the cutoff, so the CDF is zero. Above the upper endpoint, every possible value is at or below the cutoff, so the CDF is one. Between those endpoints, the CDF is the accumulated area under the constant density.

Definition: The cumulative distribution function (CDF) of a random variable \(X\) is \(F_X(x)=P(X\leq x)\), defined for every real number \(x\). For a continuous uniform variable on \([a,b]\), assume \(a<b\), and write \(X\sim\operatorname{Uniform}(a,b)\). Its density is \(1/(b-a)\) for \(a\leq x\leq b\), and zero elsewhere.

The notation \(F_X(x)\) is read as “the CDF of \(X\), evaluated at \(x\).” It is a function of the cutoff \(x\), not a probability density. Its value is a probability between zero and one. To construct it, consider separately a cutoff below the support, one inside the support, and one above the support.

Deriving the Piecewise CDF

For \(x<a\), all possible values of \(X\) are greater than \(x\). Therefore \(P(X\leq x)=0\). For \(a\leq x\leq b\), the CDF is the area under the density from \(a\) through \(x\). For \(x>b\), all possible values of \(X\) are at or below \(x\), so the CDF is one.

$$ F_X(x)= \begin{cases} 0, & x<a,\\[4pt] \dfrac{x-a}{b-a}, & a\leq x\leq b,\\[8pt] 1, & x>b. \end{cases} $$

The middle expression follows by integrating the density over the part of the support from \(a\) to \(x\):

$$ F_X(x)=P(X\leq x) =\int_a^x \frac{1}{b-a}\,dt =\frac{x-a}{b-a}, \qquad a\leq x\leq b. $$

Here \(t\) is only the integration variable; the cutoff remains \(x\). The integral is the area of a rectangle whose width is \(x-a\) and whose height is \(1/(b-a)\). This explains why the CDF rises linearly across the support. The resulting expression is a probability: at \(x=a\) it is zero, and at \(x=b\) it is one.

Key result: For \(X\sim\operatorname{Uniform}(a,b)\), use \(0\) below \(a\), \((x-a)/(b-a)\) from \(a\) through \(b\), and \(1\) above \(b\). The support endpoints belong to the middle branch: \(F_X(a)=0\) and \(F_X(b)=1\).

The endpoint values also agree with the CDF definition. Since \(X\) is continuous, a single point has probability zero: \(P(X=a)=P(X=b)=0\). Thus \(P(X\leq a)=0\), while \(P(X\leq b)=1\). The CDF has no jump at either endpoint. Its value at \(a\) matches the branch below the support, and its value at \(b\) matches the branch above it.

How to Choose the Correct Branch

The branch depends on the location of the cutoff compared with the two support endpoints. Do not substitute into the middle expression until confirming that the cutoff lies in the support. A reliable evaluation has three steps: compare the cutoff with \(a\) and \(b\), select the corresponding branch, and then calculate and check that the result is between zero and one.

1
Locate the cutoff.
Compare \(x\) with the lower endpoint \(a\) and upper endpoint \(b\). Remember that \(a\leq x\leq b\) uses the middle branch.
2
Use the matching expression.
Choose zero if \(x<a\), \((x-a)/(b-a)\) if \(a\leq x\leq b\), and one if \(x>b\).
3
Check the result.
A CDF value must lie between zero and one. Within the support it must increase from zero at \(a\) to one at \(b\).

Worked Example: Evaluating the CDF Across the Support

A hypothetical model assigns the time \(X\), in weeks, until a routine review is completed a uniform distribution on \([4,16]\). Thus \(X\sim\operatorname{Uniform}(4,16)\). Find \(F_X(x)\) at \(x=-1,4,10,16,\) and \(19\). Give each probability to four decimal places.

Method. The lower endpoint is \(a=4\), the upper endpoint is \(b=16\), and the support width is \(b-a=16-4=12\). First classify each cutoff.

At \(x=-1\), we have \(-1<4\), so this cutoff is below the support. Hence \(F_X(-1)=0\), or \(0.0000\).

At \(x=4\), the cutoff is the lower endpoint, so use the middle branch: \(F_X(4)=(4-4)/12=0/12=0\), or \(0.0000\).

At \(x=10\), we have \(4\leq10\leq16\), so \(F_X(10)=(10-4)/12=6/12=0.5\), or \(0.5000\).

At \(x=16\), the cutoff is the upper endpoint, so \(F_X(16)=(16-4)/12=12/12=1\), or \(1.0000\).

At \(x=19\), we have \(19>16\), so this cutoff is above the support. Hence \(F_X(19)=1\), or \(1.0000\).

Check. The CDF starts at zero at the lower endpoint, has the value \(0.5000\) at the midpoint \(10\), and reaches one at the upper endpoint. The values below and above the support are also the required boundary values. The common mistake avoided here is substituting every cutoff into the linear expression, even when it lies outside the support.

Why the Linear Branch Has This Form

The location shift \(x-a\) is essential. The density is constant, but the accumulated area begins at the left edge \(a\), not at zero. The total width is \(b-a\), so the ratio \((x-a)/(b-a)\) measures the fraction of the support width that lies at or below the cutoff. This ratio begins at zero when \(x=a\) and reaches one when \(x=b\).

For example, if the support is \([12,42]\), a cutoff of \(27\) is not measured from zero. The amount of support accumulated is \(27-12=15\), out of a total width of \(42-12=30\). Therefore the CDF at that cutoff is \(15/30=0.5000\). Using \(27/30\) would incorrectly ignore the lower endpoint.

Worked Example: Handling a Nonzero Lower Endpoint

For a hypothetical processing-time variable \(T\), measured in hours, assume \(T\sim\operatorname{Uniform}(12,42)\). Evaluate \(F_T(6)\), \(F_T(21)\), \(F_T(42)\), and \(F_T(57)\), to four decimal places. Also identify the incorrect result produced by using \(x/(b-a)\) at \(x=21\).

Method. Here \(a=12\), \(b=42\), and \(b-a=30\). We locate each cutoff before calculating.

Since \(6<12\), it is below the support, and \(F_T(6)=0.0000\).

Since \(12\leq21\leq42\), use the middle branch: \(F_T(21)=(21-12)/(42-12)=9/30=0.3000\).

At the upper endpoint, \(F_T(42)=(42-12)/30=30/30=1.0000\). Since \(57>42\), it is above the support, and \(F_T(57)=1.0000\).

The incorrect calculation \(21/(42-12)=21/30=0.7000\) fails to subtract the lower endpoint. It would assign \(0.7000\) to a cutoff located only \(9\) hours into a support of width \(30\) hours. The correct CDF value is \(0.3000\).

Check. At the lower endpoint \(12\), the middle expression gives \((12-12)/30=0\); at the upper endpoint \(42\), it gives \((42-12)/30=1\). These checks confirm that the support has been shifted and scaled correctly.

Endpoints, Continuity, and Common Errors

The definition \(F_X(x)=P(X\leq x)\) uses “less than or equal to,” but for a continuous uniform variable this does not create a positive point probability at an endpoint. In particular, the value at \(a\) is zero, not a jump above zero, and the value at \(b\) is one. The middle branch includes both endpoints because its formula gives exactly the same values as the outside branches there.

These endpoint checks are useful even when a problem asks for only one CDF value. If the proposed middle branch gives a negative number at the lower endpoint or a value greater than one at the upper endpoint, the formula has been written incorrectly. For any \(x\) inside the support, \((x-a)/(b-a)\) must be between zero and one because \(0\leq x-a\leq b-a\).

Worked Example: Correcting a Reversed Cumulative Formula

A hypothetical sensor error \(Z\) is modeled as \(Z\sim\operatorname{Uniform}(-5,7)\). A candidate writes \(F_Z(z)=(7-z)/12\) for \(-5\leq z\leq7\). Evaluate the candidate’s expression at \(z=-5,1,\) and \(7\), explain the error, and calculate the correct CDF values. Give probabilities to four decimal places.

Method. The support width is \(7-(-5)=12\). Compare the candidate formula with the CDF definition and the required endpoint values.

At \(z=-5\), the candidate expression gives \((7-(-5))/12=12/12=1.0000\). But \(F_Z(-5)=P(Z\leq-5)=0.0000\), because the continuous variable has no point mass at the lower endpoint.

At \(z=1\), the candidate expression gives \((7-1)/12=6/12=0.5000\). The correct expression gives \(F_Z(1)=(1-(-5))/12=6/12=0.5000\). The midpoint happens to have the same value under both expressions, so checking only this interior point would not reveal the error.

At \(z=7\), the candidate expression gives \((7-7)/12=0.0000\), whereas \(F_Z(7)=P(Z\leq7)=1.0000\).

The proposed expression runs in the wrong direction: it decreases from one to zero as the cutoff moves across the support. A CDF cannot decrease. The correct piecewise CDF is zero for \(z<-5\), \((z+5)/12\) for \(-5\leq z\leq7\), and one for \(z>7\).

Check. The corrected middle branch gives \(0\) at \(-5\), \(6/12=0.5000\) at the midpoint \(1\), and \(12/12=1.0000\) at \(7\), as required.

Common Mistakes to Avoid

  • Forgetting the lower endpoint. The middle expression is \((x-a)/(b-a)\), not \(x/(b-a)\), unless \(a=0\).
  • Using the middle expression outside the support. If \(x<a\), the CDF is zero; if \(x>b\), it is one.
  • Reversing the direction. An expression such as \((b-x)/(b-a)\) falls as \(x\) increases, so it cannot be the CDF within the support.
  • Assigning a jump at an endpoint. A continuous uniform variable has zero probability at a single point, so \(F_X(a)=0\) and \(F_X(b)=1\).
  • Leaving the support implicit. State \(a\) and \(b\) before evaluating a cutoff; the same numerical cutoff can be below, inside, or above the support in different models.
Key takeaway: A uniform CDF accumulates probability from the lower endpoint. Its complete form is zero below the support, \((x-a)/(b-a)\) on the support, and one above the support. Check the endpoints and confirm that the result never decreases.

Check Your Understanding

For each problem, identify the relevant branch before evaluating the CDF. Probabilities are reported to four decimal places.

  1. A hypothetical inspection duration \(X\) has distribution \(\operatorname{Uniform}(-2,10)\). Find \(F_X(-3)\), \(F_X(-2)\), and \(F_X(4)\). (Answer: \(0.0000,\ 0.0000,\ 0.5000\))
  2. A hypothetical repair time \(R\), in hours, has distribution \(\operatorname{Uniform}(15,35)\). Find \(F_R(25)\), \(F_R(35)\), and \(F_R(40)\). (Answer: \(0.5000,\ 1.0000,\ 1.0000\))
  3. A hypothetical calibration error \(W\) has distribution \(\operatorname{Uniform}(0.2,0.8)\). Find \(F_W(0.1)\), \(F_W(0.5)\), and \(F_W(0.8)\). (Answer: \(0.0000,\ 0.5000,\ 1.0000\))
  4. A hypothetical daily temperature deviation \(D\) has distribution \(\operatorname{Uniform}(-8,4)\). Find \(F_D(-5)\), \(F_D(1)\), and \(F_D(5)\), showing which cutoffs are outside the support. (Answer: \(0.2500,\ 0.7500,\ 1.0000\); \(5\) is above the support.)
  5. A hypothetical sensor offset \(Q\) has distribution \(\operatorname{Uniform}(100,160)\). A report claims \(F_Q(130)=130/60\). Give the correct value and state the error in the report. (Answer: \(F_Q(130)=(130-100)/(160-100)=0.5000\); the report omitted the lower endpoint.)
Clinical Biostats