The Uniform Distribution is another important distribution. If the random variable $X$ follows a uniform distribution then we write $X \text{~} \mathrm{U}(a,b)$ where $a$ and $b$ are the parameters of the distribution and:
Hence $a \le X \le b$
The only restriction on the values of these parameters is that $b>a$..
The important characteristic of the Uniform Distribution is that is has a constant probability. That is, all values of X in the range from $a$ to $b$ are equally likely.
The formula for the probability density is:
\begin{equation} f(x) = \dfrac{1}{b-a}\\ \end{equation}
The formula for the cumulative probability is:
\[\mathrm{P}(X \leq x)=\begin{cases} 0 & \text{for }x < a, \\ \frac{x-a}{b-a} & \text {for }a \leq x \leq b,\\ 0 &\text{for } x > b. \end{cases}\]
\begin{align} \mathrm{P}(c \leq X \leq d) &= \bigg(\dfrac{d-a}{b-a}\bigg) - \bigg(\dfrac{c-a}{b-a}\bigg) \text{ for }c < d.\\ &= \bigg(\dfrac{d-c}{b-a}\bigg)\\ \end{align}
The expectation and variance of a Uniform random variable are:
\begin{align} \mathrm{E}[X] &= \dfrac{a+b}{2}\\ \mathrm{Var}(X) &= \dfrac{(b-a)^2}{12}.\\ \end{align}
Below is a plot of the probability density function (pdf) for a $\mathrm{U} (3,16)$ Distribution. The entire shaded area (blue and grey) is equal to $1$. The blue areas represent $\mathrm{P}(5 \leq x \leq 7)$ and $\mathrm{P}(10 \leq x \leq 12)$ and we can see that the areas are the same and so the intervals have the same probabilities.
A local authority is responsible for a stretch of road $4$km long in Gerrards Cross. Elderly residents of this road have been complaining of the distance to the nearest post box for a long time and The Postal Service have finally agreed to install a post box on this stretch of road but have no yet specified exactly where. The local authority assumes that all locations along this stretch of road are equally likely to have been chose by The Postal Service.
Let $Y$ be the distance along the road (from the East end of the road) where the new post box will be installed.
(A) What distribution does $Y$ follow? And what is the expectation and variance?
'''(B) The pavement on either side of the stretch of road becomes very narrow between $1$ and $1.01$ kilometres from the East of the road. The Local Authority is concerned about the possibility of the new post box being installed in this section of the road as it would make the pavement even narrower and people will not be able to get past with wheelchairs or prams. What is the probability of the post box being installed in this section of road according to the beliefs of the Local Authority?
(A) Since we are considering this problem from the point of view of the Local Authority we have no prior knowledge of where the post box will be installed and so the Uniform Distribution is appropriate (all locations are equally likely from the Local Authority's perspective). Here the minimum and maximum values are given by $a = 0$ and $b = 4$ so we have:
\begin{align} Y \text{~} \mathrm{U}(0,4),\\ \end{align} The expected value of $Y$ is: \begin{align} \mathrm{E}[Y] &= \dfrac{0+4}{2}\\ &= 2.\\ \end{align} The variance is: \begin{align} \mathrm{Var}(Y)&=\dfrac{(4-0)^2}{12}\\ &=\dfrac{16}{12}\\ &=\dfrac{4}{3}.\\ \end{align}
(B)
We wish to calculate $\mathrm{P}(1\leq Y \leq 1.5)$. We can do so using the formula in the second blue box above. \begin{align} \mathrm{P}(1\leq Y \leq 1.5) &= \mathrm{P}(X \leq 1.5) - \mathrm{P}(X \leq 1)\\ &=\dfrac{1.5-0}{4-0} - \dfrac{1-0}{4-0}\\ &=\dfrac{1.5}{4}-\dfrac{1}{4}\\ &=\dfrac{0.5}{4}\\ &=\dfrac{1}{8}\\ &= 0.125.\\ \end{align}
So there is a $0.125$ chance the post box will be installed along the stretch of road with narrow pavements according to the beliefs of the Local Authority.
Click on the following links to practise Numbas tests on the distributions on this page:
Test yourself: Numbas test on the exponential distribution and uniform distribution