Definition
X∼Unif[a,b] has constant density over an interval.
PDF
f(x)={b−a10a≤x≤botherwise
CDF
F(x)=⎩⎨⎧0b−ax−a1x<aa≤x≤bx>b
Parameters
- a: lower bound
- b: upper bound (b>a)
Expectation and Variance
E[X]=2a+b
The mean is the midpoint.
Proof:
E[X]=∫abx⋅b−a1dx=b−a1[2x2]ab=2(b−a)b2−a2=2(b−a)(b−a)(b+a)=2a+b
Var(X)=12(b−a)2
Proof:
E[X2]=∫abx2⋅b−a1dx=3(b−a)b3−a3=3a2+ab+b2
Var(X)=E[X2]−E[X]2=3a2+ab+b2−4a2+2ab+b2=12b2−2ab+a2=12(b−a)2
Visualisation
The PDF is a flat rectangle of height b−a1 and width b−a. Area = 1.
The CDF is a straight line from (a,0) to (b,1).

Examples
Example 1: Random Time
A bus arrives uniformly at random between 8:00 and 8:30. X∼Unif[0,30] (minutes past 8:00).
E[X]=15 minutes
P(X≤10)=3010=31
Example 2: Random Point
Choose a point uniformly on [0,1]. X∼Unif[0,1].
P(X≤0.4)=0.4
P(0.2≤X≤0.7)=0.5
Uniform random variables are the foundation of simulation. From U∼Unif[0,1], we can generate many other distributions.
Inverse transform method: If F is a CDF with inverse F−1, then X=F−1(U) has CDF F.
Example: Generating Exponential
For exponential with rate λ:
F(x)=1−e−λx
F−1(u)=−λ1ln(1−u)
So X=−λ1ln(1−U) or equivalently X=−λ1lnU (since U and 1−U have the same distribution) generates an exponential.
Properties
Probability of Interval
For X∼Unif[a,b]:
P(c≤X≤d)=b−ad−c
Probability is proportional to interval length.
Memoryless?
No. For uniform, knowing X>c tells us X>c is impossible if c<a, and restricts X to [c,b] if a≤c<b.
If X∼Unif[a,b] and Y=cX+d (c>0), then Y∼Unif[ca+d,cb+d].
Summary Table
| Property | Value |
|---|
| PDF | f(x)=b−a1 on [a,b] |
| CDF | F(x)=b−ax−a on [a,b] |
| Mean | 2a+b |
| Variance | 12(b−a)2 |
| SD | 12b−a |