St · Statistics & Probability

How to Find Probabilities for a Uniform Distribution

Published By the 9to5Science editorial team

At a glance

  1. 1. Identify the interval

    For a continuous uniform variable, identify its lower and upper bounds, a and b.

  2. 2. Find the overlap

    Measure the length of the part of the requested event that lies between a and b.

  3. 3. Divide by total length

    Divide the overlap length by b minus a to get the probability.

  4. 4. Check endpoints

    For a continuous variable, including or excluding an endpoint does not change the probability.

A uniform distribution assigns equal probability to intervals of equal length within its range. For a continuous uniform random variable XX on [a,b][a,b], the probability of landing in an interval is the portion of the total range covered by that interval.

This article gives the calculation for the continuous uniform distribution, the usual interpretation when a problem says that a quantity is “uniformly distributed.” If the possible outcomes are separate values, such as the integers on a die, use the discrete version described below.

Continuous uniform distribution

Write X∼Uniform⁡(a,b)X \sim \operatorname{Uniform}(a,b), where a<ba<b. Its probability density is constant between aa and bb:

fX(x)={1b−a,a≤x≤b,0,otherwise.f_X(x)=\begin{cases} \frac{1}{b-a}, & a\le x\le b,\\ 0, & \text{otherwise.} \end{cases}

The density is the same everywhere on the interval, so the probability of an event is the area under the density over that event. For an interval [c,d][c,d], first find how much of it overlaps [a,b][a,b]. The result is

P(c≤X≤d)=max⁡(0, min⁡(d,b)−max⁡(c,a))b−a.P(c\le X\le d)=\frac{\max\bigl(0,\,\min(d,b)-\max(c,a)\bigr)}{b-a}.

When [c,d][c,d] is fully inside [a,b][a,b], this simplifies to

P(c≤X≤d)=d−cb−a.P(c\le X\le d)=\frac{d-c}{b-a}.

The numerator is the length of the desired interval; the denominator is the length of the full range. If the event falls entirely outside the range, its probability is zero. If it covers the entire range, its probability is one.

Worked example

Suppose a bus arrives at a uniformly distributed time between 0 and 20 minutes after its scheduled time. Let XX be the delay in minutes, so X∼Uniform⁡(0,20)X\sim\operatorname{Uniform}(0,20). What is the probability that the bus arrives between 7 and 12 minutes late?

The full range has length 20−0=2020-0=20 minutes. The requested interval has length 12−7=512-7=5 minutes, and it lies completely inside the range. Therefore,

P(7≤X≤12)=12−720−0=520=0.25.P(7\le X\le 12)=\frac{12-7}{20-0}=\frac{5}{20}=0.25.

The probability is 0.250.25, or 25%. For another event, such as arriving more than 15 minutes late, the favorable length is 20−15=520-15=5 minutes, giving 5/20=0.255/20=0.25 as well.

If instead you asked for the probability that the bus arrives between 18 and 25 minutes late, only the part from 18 to 20 is possible. The overlap has length 2, so the probability is 2/20=0.102/20=0.10.

Use the cumulative distribution function

The cumulative distribution function gives the probability that XX is at most a specified value xx:

FX(x)=P(X≤x)={0,x<a,x−ab−a,a≤x≤b,1,x>b.F_X(x)=P(X\le x)=\begin{cases} 0, & x<a,\\ \frac{x-a}{b-a}, & a\le x\le b,\\ 1, & x>b. \end{cases}

You can use it to calculate interval probabilities by subtracting cumulative probabilities. For example, when a≤c≤d≤ba\le c\le d\le b,

P(c≤X≤d)=FX(d)−FX(c)=d−ab−a−c−ab−a=d−cb−a.P(c\le X\le d)=F_X(d)-F_X(c)=\frac{d-a}{b-a}-\frac{c-a}{b-a}=\frac{d-c}{b-a}.

This approach is especially useful for events that involve “less than,” “more than,” or several intervals. For example, P(X>c)=1−FX(c)P(X>c)=1-F_X(c) when cc is within the range.

What if the outcomes are discrete?

For a discrete uniform distribution, count equally likely outcomes instead of measuring interval lengths. If XX can be any integer from mm through nn, inclusive, there are n−m+1n-m+1 possible values. The probability of an event is

P(X is in the event)=number of allowed values in the eventn−m+1.P(X\text{ is in the event})=\frac{\text{number of allowed values in the event}}{n-m+1}.

For a fair six-sided die, the probability of rolling a 2, 3, or 4 is 3/6=1/23/6=1/2. Do not use the continuous length formula for a die: the outcomes are separate integers, not points along a continuous interval.

Common mistakes

  • Using the density as a probability. For X∼Uniform⁡(a,b)X\sim\operatorname{Uniform}(a,b), the density is 1/(b−a)1/(b-a), but a density value is not the probability of a particular outcome. Probabilities come from area: density multiplied by interval length.
  • Forgetting to restrict the event to the range. If the requested interval extends beyond [a,b][a,b], count only its overlap with [a,b][a,b].
  • Including endpoints in a continuous calculation. For a continuous variable, P(X=c)=0P(X=c)=0 for any single value cc. Thus P(c<X<d)P(c<X<d), P(c≤X≤d)P(c\le X\le d), and versions that include just one endpoint are equal.
  • Mixing up continuous and discrete cases. A continuous uniform distribution uses interval lengths; a discrete one uses counts of possible outcomes.

Check that your final probability lies between 0 and 1. For a continuous uniform variable, it should also equal the favorable length divided by the total length when the event is an interval inside the distribution’s range.

References

  1. A First Course in Probability — Sheldon Ross
  2. Introduction to Probability — Joseph K. Blitzstein and Jessica Hwang

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.