Uniform distribution with constant pdf on [a,b], showing cdf, mean and area interpretation

What is a Uniform Distribution?

The uniform distribution is a continuous distribution where intervals of the same width have the same probability, provided those intervals lie within the support of the distribution.

The simplest version is the standard uniform distribution, whose support is the interval $[0,1]$.

If

$$U\sim\mathcal{U}[0,1],$$

then its pdf has constant height $1$ between $0$ and $1$.

This means, for example, that

$$\mathbb{P}(0.5\leq U\leq0.7)=0.2.$$

The interval has width $0.2$, and the pdf has height $1$, so the area under the pdf is simply $0.2$.

This is the important idea behind the uniform distribution: within its support, probabilities for intervals depend only on their widths.

You can also use the interactive probability calculator below to explore the uniform pdf and find probabilities for different intervals.


The Uniform Distribution on $[a,b]$

More generally, suppose that

$$X\sim\mathcal{U}[a,b],$$

where $b>a$.

The support of $X$ is the interval $[a,b]$, and the pdf is constant across this whole interval.

Since the total area under any pdf must equal $1$, the height of the uniform pdf must be

$$\frac{1}{b-a}.$$

So,

$$f_X(x)=\frac{1}{b-a}$$

for $a\leq x\leq b$, and the pdf is zero outside this interval.

The uniform distribution is sometimes called the “box” distribution, because its pdf has the shape of a box.


Finding Uniform Probabilities

Suppose we want to find the probability that $X$ lies between two values $c$ and $d$, where

$$a\leq c\leq d\leq b.$$

Since probability is given by the area under the pdf,

$$\mathbb{P}(c\leq X\leq d)=(d-c)\frac{1}{b-a}.$$

So,

$$\mathbb{P}(c\leq X\leq d)=\frac{d-c}{b-a}.$$

The probability is therefore just the width of the interval we want, divided by the total width of the distribution.

For the standard uniform distribution, $a=0$ and $b=1$, so this becomes

$$\mathbb{P}(c\leq U\leq d)=d-c.$$


The cdf

The cdf gives the probability that $X$ is less than or equal to a particular value.

For $a\leq x\leq b$,

$$F_X(x)=\mathbb{P}(X\leq x).$$

The relevant part of the pdf runs from $a$ to $x$, so its width is $x-a$. The total width of the distribution is $b-a$.

Therefore,

$$F_X(x)=\frac{x-a}{b-a}.$$

For the standard uniform distribution,

$$F_U(x)=x$$

for $0\leq x\leq1$.


Mean and Variance

The uniform distribution is symmetric around the midpoint of the interval $[a,b]$.

Its expected value is therefore

$$\mathbb{E}(X)=\frac{a+b}{2}.$$

Its variance is

$$\operatorname{Var}(X)=\frac{(b-a)^2}{12}.$$

So wider uniform distributions have greater variance, while the mean always lies exactly halfway between the two endpoints.


Explore the Uniform pdf and Calculate Probabilities

In the interactive graph below, the parameters $a$ and $b$ determine the uniform distribution.

You can also choose two values, $c$ and $d$, to calculate

$$\mathbb{P}(c\leq X\leq d).$$

The shaded region shows this probability as an area under the pdf.

Try changing:

  • $a$ and $b$, the endpoints of the uniform distribution;

  • $c$ and $d$, the endpoints of the interval whose probability you want to find.

Notice how changing $a$ and $b$ changes both the width and the height of the pdf, while the total area under it remains $1$.




Continuous and Discrete Uniform Distributions

The distribution on this page is the continuous uniform distribution.

There is also a discrete uniform distribution, where a random variable has several possible values and each has the same probability.

For example, the outcome of a fair six-sided die has a discrete uniform distribution on

$${1,2,3,4,5,6}.$$

This is different from the continuous uniform distribution, where every individual value has probability zero and probabilities are assigned to intervals.


Background:


Uniform Distribution Summary

Notation: $X\sim\mathcal{U}[a,b]$
Type: Continuous
pdf: $f_X(x)=\frac{1}{b-a}$ for $a\leq x\leq b$
cdf: $F_X(x)=\frac{x-a}{b-a}$ for $a\leq x\leq b$
Support: $x\in[a,b]$
Mean: $\mathbb{E}(X)=\frac{a+b}{2}$
Variance: $\operatorname{Var}(X)=\frac{(b-a)^2}{12}$
Found this useful?

Understanding Econometrics is completely free to use, and always will be.

If you found the site useful and would like to help me keep adding new material, please consider buying me a coffee!

Buy me a coffee ☕