# 4.3: Uniform Distribution

- Page ID
- 3269

### Definition \(\PageIndex{1}\)

A random variable \(X\) has a * uniform distribution* on interval \([a, b]\), write \(X\sim\text{uniform}[a,b]\), if has pdf given by

$$f(x) =\left\{\begin{array}{l l}

\frac{1}{b-a}, & \text{for}\ a\leq x\leq b \\

0, & \text{otherwise}

\end{array}\right.\notag$$

The uniform distribution is also sometimes referred to as the * box distribution*, since the graph of its pdf looks like a box. See Figure 1 below.

Figure 1: Graph of the pdf for a uniform distribution on interval \([a,b]\)

### Exercise \(\PageIndex{1}\)

Verify that the uniform pdf is a valid pdf, i.e., show that it satisfies the first three conditions of Definition 4.1.1.

**Answer**-
- In looking either at the formula in Definition 4.3.1 or the graph in Figure 1, we can see that the uniform pdf is always non-negative, i.e., \(f(x)\geq0\), for all \(x\in\mathbb{R}\).
- Given that the uniform pdf is a piecewise constant function, it is also piecewise continuous.
- Finally, we need to verify that the area under the uniform pdf is equal to 1. This is quickly seen from the graph in Figure 1, since we calculate the area of rectangle with width \((b-a)\) and height \(1/(b-a)\). Thus, the area is

$$(b-a)\times\frac{1}{(b-a)} = 1.\notag$$

A typical application of the uniform distribution is to model randomly generated numbers. In other words, it provides the probability distribution for a random variable representing a randomly chosen number between numbers \(a\) and \(b\).

The uniform distribution assigns equal probabilities to intervals of equal lengths, since it is a constant function, on the interval it is non-zero \([a, b]\). This is the continuous analog to equally likely outcomes in the discrete setting.

We close the section by finding the expected value of the uniform distribution.

### Example \(\PageIndex{1}\)

If \(X\) has a uniform distribution on the interval \([a,b]\), then we apply Definition 4.2.1 and compute the expected value of \(X\):

$$\text{E}[X] = \int\limits^b_a\! x\cdot\frac{1}{b-a}\, dx = \frac{b^2 - a^2}{2}\cdot\frac{1}{b-a} = \frac{(b-a)(b+a)}{2}\cdot\frac{1}{b-a} = \frac{b+ a}{2}.\notag$$

Thus, the expected value of the uniform\([a,b]\) distribution is given by the average of the parameters \(a\) and \(b\), or the midpoint of the interval \([a,b]\). This is readily apparent when looking at a graph of the pdf in Figure 1 and remembering the interpretation of expected value as the center of mass. Since the pdf is constant over \([a,b]\), the center of mass is simply given by the midpoint.