The uniform distribution

In the discrete case, if the outcomes of a random experiment are equally likely, then calculating the probability of the events will be very easy. This “equally likely” idea may also be applied to continuous random variables.

For a continuous random variable $X$, we say $X$ is uniformly distributed over the interval $(\alpha, \beta)$ if the density function of $X$ is

$$ f(X) = \begin{cases} \frac{1}{\beta - \alpha}, & \alpha \leq x \leq \beta \\ 0, & \text{otherwise} \end{cases} $$

In other words, the density function of $X$ is a constant over a given interval and zero otherwise. This holds because

$$ 1 = \int_{-\infty}^\infty f(x)dx = \int_\alpha^\beta Cdx = Cx \bigg|_\alpha^\beta = C(\beta - \alpha) $$

The plot for this function is a horizontal line at $\frac{1}{\beta - \alpha}$ between the interval $(\alpha, \beta)$, and 0 otherwise. From $f(x)$, we can figure out the cumulative distribution function to be

$$ F(a) = \begin{cases} 0, & a < \alpha \\ \frac{a - \alpha}{\beta - \alpha}, & \alpha \leq a \leq \beta \\ 1, & a > \beta \end{cases} $$

Plotting $F(a)$ against a would result in a line connecting $(\alpha, 0)$ and $(\beta, 1)$, and staying at 1 onward.

Bus example

<aside> ❓ Buses arrive at a bus stop at a 15 minutes interval starting at 7:00 a.m. Suppose that a passenger arrives at this stop at a time that is uniformly distributed between 7 and 7:30. Find the probability that he needs to wait less than 5 minutes until the next bus arrives.

</aside>

We know that buses are going to arrive at 7:00, 7:15 and 7:30 in this time interval. There are then two scenarios that the passenger waits less than 5 minutes: arriving between 7:10 and 7:15, or between 7:25 and 7:30. Define events $E_1 = \{10 \leq X \leq 15\}$ and $E_2 = \{25 \leq X \leq 30\}$.

$$ \begin{gathered} E = \{\text{wait less than 5 minutes}\} = E_1 \cup E_2 \\ P(E) = F(15) - F(10) + F(30) - F(25) \end{gathered} $$

Since $X \sim Unif(0, 30)$, we have

$$ F(a) = \begin{cases} 0, & a < 0 \\ \frac{a}{30}, & 0 \leq a \leq 30 \\ 1, & a > 30\end{cases} $$

So $P(E) = \frac{1}{2} - \frac{1}{3} + 1 - \frac{5}{6} = \frac{1}{3}$.

Properties

We can get the expectation of $X \sim Unif(\alpha, \beta)$ directly from the definition.

$$ \begin{aligned} E[X] &= \int_{-\infty}^\infty xf(x)dx \\ &= \int_\alpha^\beta x \frac{1}{\beta - \alpha}dx \\ &= \frac{1}{\beta - \alpha} \frac{x^2}{2} \bigg|_\alpha^\beta \\ &= \frac{(\beta - \alpha)(\beta + \alpha)}{2(\beta - \alpha)} \\ &= \frac{\beta + \alpha}{2} \end{aligned} $$

Then we calculate $E[X^2]$ to find $Var(X)$.