Distributions · Definition
Uniform distribution
Before you start you need to know
It is the «no preference» model: it picks a point at random on a segment and underlies the simulation of other random variables.
Definition
A continuous uniform variable takes values in an interval with the same density at every point, so intervals of equal length have equal probability.
If a bus comes every 10 minutes and you arrive without checking the clock, your waiting time can be modeled as uniform on \([0,10]\). Outside the interval the density is 0 and inside it equals \(1/(b-a)\), the value that makes the total area of the rectangle 1. We write \(X\sim U(a,b)\).
Because the density is constant, the probability of a subinterval is proportional to its length: \(P(c<X<d)=(d-c)/(b-a)\) when \(a\le c<d\le b\). The distribution function grows linearly, \(F(x)=(x-a)/(b-a)\) for \(a\le x\le b\), and is 0 before \(a\) and 1 after \(b\).
The expectation is the midpoint, \(E[X]=(a+b)/2\), by symmetry, and the variance is \(\operatorname{Var}(X)=(b-a)^2/12\). Note that the variance depends only on the length of the interval, not its position: shifting the interval moves the mean but not the spread.
A common mistake is to treat the density as a probability: \(f(x)=1/(b-a)\) can exceed 1 (for \(U(0,\tfrac12)\) it equals 2) and \(P(X=c)=0\) for every \(c\). Also, conditioning on a subinterval leaves the variable uniform on it. The \(U(0,1)\) is the building block of random number generators.
Think about it
Can the density of a uniform variable exceed 1?
Yes: for \(U(0,\tfrac12)\) the density is 2. What cannot exceed 1 is the area under the curve.
If \(X\sim U(0,8)\), what is the probability that \(X\) lies between 2 and 5?
\((5-2)/8=3/8\).
Exercises 10
- If \(X\) is uniform on \([0,4]\), find \(P(X<1)\).
- If \(X\) is uniform on \([2,6]\), find \(E[X]\).
- If \(X\) is uniform on \([1,5]\), what is its density at \(x=3\)?
- If \(X\) is uniform on \([0,10]\), find \(P(3<X<7)\).
- If \(X\) is uniform on \([-1,3]\), find \(P(X>0)\).
- If \(X\) is uniform on \([0,6]\), find \(\operatorname{Var}(X)\).
- A uniform variable on \([a,b]\) has mean 5 and variance 3. What is the interval?
- If \(X\) is uniform on \([2,8]\), find \(F(5)=P(X\le 5)\).
- If \(X\) is uniform on \([0,1]\), find \(P(X<0.3\mid X<0.6)\).
- If \(X\) is uniform on \([0,2]\), what is \(P(X=1)\)?
References
- Joseph K. Blitzstein, Jessica Hwang, Introduction to Probability, 2nd edition, CRC Press, 2019. §5.2
- Sheldon Ross, A First Course in Probability, 10th edition, Pearson, 2019. §5.3
- Ronald E. Walpole, Raymond H. Myers, Sharon L. Myers, Keying Ye, Probabilidad y estadística para ingeniería y ciencias, 9.ª edición, Pearson, 2012. §6.1