🎉 75% of content is free forever — Unlock Premium from $10/mo →
CW
Search courses…
💼 Servicesℹ️ About✉️ ContactView Pricing Plansfrom $10

Uniform Distribution — Equal Probability Across a Range

Foundations of StatisticsProbability Distributions🟢 Free Lesson

Advertisement

Uniform Distribution

Probability Distributions

Equal Probability Everywhere — Maximum Ignorance

The uniform distribution assigns equal probability density across an interval. It is the maximum entropy distribution — the most honest choice when you know nothing except the bounds.

  • Random number generation — all PRNGs start with Uniform(0,1)
  • Bayesian priors — "I have no prior information" → Uniform
  • Rounding errors — modeling quantization noise
  • Simulation — the source distribution for Monte Carlo methods

The uniform is the mother of all distributions — via the inverse transform, it births every other distribution.


Core Concepts

The continuous uniform distribution assigns equal probability density across an interval [a,b][a, b]. It is the simplest continuous distribution and serves as the foundational building block from which all other continuous distributions can be derived via the inverse transform method.

DfUniform Distribution

A continuous random variable XX has a uniform distribution on [a,b][a, b] if its probability density function is constant on [a,b][a, b] and zero elsewhere. Written XUnif(a,b)X \sim \text{Unif}(a, b).

Formally, XX is Unif(a,b)\text{Unif}(a, b) if and only if for any measurable subset A[a,b]A \subseteq [a, b]:

P(XA)=λ(A)baP(X \in A) = \frac{\lambda(A)}{b - a}

where λ(A)\lambda(A) denotes the Lebesgue measure (length) of AA.

PDF of Uniform Distribution

f(x)=1ba,axbf(x) = \frac{1}{b - a}, \quad a \leq x \leq b

Here,

  • aa=Lower bound of the interval
  • bb=Upper bound of the interval
  • 1/(ba)1/(b-a)=Constant density across [a, b]

ThUniform Distribution is the Maximum Entropy Distribution on [a, b]

Among all continuous distributions supported on [a,b][a, b] with finite mean, the uniform distribution maximizes the differential entropy. That is, if gg is any other pdf on [a,b][a, b], then:

abf(x)lnf(x)dxabg(x)lng(x)dx-\int_a^b f(x) \ln f(x) \, dx \geq -\int_a^b g(x) \ln g(x) \, dx

with equality if and only if g=fg = f.

Proof sketch: The differential entropy of the uniform is h(X)=ln(ba)h(X) = \ln(b - a). For any other pdf gg on [a,b][a, b], by Gibbs' inequality (or KL divergence 0\geq 0):

abg(x)lng(x)f(x)dx0\int_a^b g(x) \ln \frac{g(x)}{f(x)} \, dx \geq 0

Expanding: glngdxglnfdx0\int g \ln g \, dx - \int g \ln f \, dx \geq 0. Since lnf=ln(ba)\ln f = -\ln(b-a) is constant:

glngdx+ln(ba)0    glngdxln(ba)\int g \ln g \, dx + \ln(b-a) \geq 0 \implies -\int g \ln g \, dx \leq \ln(b-a)

which equals h(X)h(X).

Why It Matters

The uniform distribution is the foundation for random number generation. All pseudo-random number generators produce Unif(0,1)\text{Unif}(0,1) samples, and the inverse transform method converts these to any desired distribution: if FF is a CDF, then F1(U)F^{-1}(U) \sim that distribution for UUnif(0,1)U \sim \text{Unif}(0,1).


Derivation of Mean and Variance

Uniform Mean and Variance

E[X]=a+b2,Var(X)=(ba)212E[X] = \frac{a+b}{2}, \quad \text{Var}(X) = \frac{(b-a)^2}{12}

Here,

  • a,ba, b=Interval endpoints
  • (a+b)/2(a+b)/2=Midpoint of the interval
  • (ba)2/12(b-a)^2/12=Variance depends on interval width

ThDerivation of E[X] and Var(X)

Mean:

E[X]=abx1badx=1bax22ab=b2a22(ba)=(ba)(b+a)2(ba)=a+b2E[X] = \int_a^b x \cdot \frac{1}{b-a} \, dx = \frac{1}{b-a} \cdot \frac{x^2}{2} \Big|_a^b = \frac{b^2 - a^2}{2(b-a)} = \frac{(b-a)(b+a)}{2(b-a)} = \frac{a+b}{2}

Second moment:

E[X2]=abx21badx=1bax33ab=b3a33(ba)=a2+ab+b23E[X^2] = \int_a^b x^2 \cdot \frac{1}{b-a} \, dx = \frac{1}{b-a} \cdot \frac{x^3}{3} \Big|_a^b = \frac{b^3 - a^3}{3(b-a)} = \frac{a^2 + ab + b^2}{3}

Variance:

Var(X)=E[X2](E[X])2=a2+ab+b23(a+b)24\text{Var}(X) = E[X^2] - (E[X])^2 = \frac{a^2 + ab + b^2}{3} - \frac{(a+b)^2}{4}
=4(a2+ab+b2)3(a2+2ab+b2)12=a22ab+b212=(ba)212= \frac{4(a^2 + ab + b^2) - 3(a^2 + 2ab + b^2)}{12} = \frac{a^2 - 2ab + b^2}{12} = \frac{(b-a)^2}{12}

CDF and Its Properties

CDF of Uniform Distribution

F(x)={0x<axabaaxb1x>bF(x) = \begin{cases} 0 & x < a \\ \frac{x - a}{b - a} & a \leq x \leq b \\ 1 & x > b \end{cases}

Here,

  • xx=Value at which to evaluate CDF
  • a,ba, b=Interval endpoints

Linearity of the CDF

The CDF F(x)=(xa)/(ba)F(x) = (x-a)/(b-a) is linear in xx. This means: if XUnif(a,b)X \sim \text{Unif}(a,b), then P(Xc)=(ca)/(ba)P(X \leq c) = (c - a)/(b - a) for any c[a,b]c \in [a, b]. For example, the probability that XX falls in the left quarter of [a,b][a, b] is exactly 0.250.25.


Higher Moments and Moment Generating Function

MGF of Uniform Distribution

MX(t)=E[etX]=etbetat(ba),t0M_X(t) = E[e^{tX}] = \frac{e^{tb} - e^{ta}}{t(b - a)}, \quad t \neq 0

Here,

  • tt=Transform variable
  • a,ba, b=Interval endpoints

ThDerivation of the MGF

MX(t)=abetx1badx=1baetxtab=etbetat(ba)M_X(t) = \int_a^b e^{tx} \cdot \frac{1}{b-a} \, dx = \frac{1}{b-a} \cdot \frac{e^{tx}}{t} \Big|_a^b = \frac{e^{tb} - e^{ta}}{t(b-a)}

From this, all moments follow by differentiation: E[Xn]=MX(n)(0)E[X^n] = M_X^{(n)}(0). For instance:

MX(0)=a+b2,MX(0)=a2+ab+b23M_X'(0) = \frac{a+b}{2}, \quad M_X''(0) = \frac{a^2 + ab + b^2}{3}

nth Raw Moment (Closed Form)

E[Xn]=bn+1an+1(n+1)(ba)E[X^n] = \frac{b^{n+1} - a^{n+1}}{(n+1)(b - a)}

Here,

  • nn=Moment order

The Inverse Transform Method

ThInverse Transform Sampling Theorem

Let UUnif(0,1)U \sim \text{Unif}(0, 1) and let FF be any CDF with inverse F1F^{-1} (the quantile function). Then X=F1(U)X = F^{-1}(U) has CDF FF.

Proof: P(Xx)=P(F1(U)x)=P(UF(x))=F(x)P(X \leq x) = P(F^{-1}(U) \leq x) = P(U \leq F(x)) = F(x), since UU is uniform on [0,1][0,1] and F(x)[0,1]F(x) \in [0,1].

Worked Example: Generating Exponential Samples

To generate XExp(λ)X \sim \text{Exp}(\lambda): its CDF is F(x)=1eλxF(x) = 1 - e^{-\lambda x}. Set u=1eλxu = 1 - e^{-\lambda x} and solve:

eλx=1u    x=ln(1u)λe^{-\lambda x} = 1 - u \implies x = -\frac{\ln(1-u)}{\lambda}

Since 1UUnif(0,1)1 - U \sim \text{Unif}(0,1), we can simplify to X=ln(U)/λX = -\ln(U)/\lambda. This is the standard method used in all statistical software.


Relationship to Other Distributions

  • The order statistics of nn i.i.d. Unif(0,1)\text{Unif}(0,1) variables follow a Beta distribution: the kk-th order statistic is Beta(k,nk+1)\text{Beta}(k, n-k+1).
  • The sum of nn i.i.d. Unif(0,1)\text{Unif}(0,1) variables follows the Irwin-Hall distribution, which approaches N(n/2,n/12)N(n/2, n/12) by the CLT.
  • Unif(0,1)=Beta(1,1)\text{Unif}(0,1) = \text{Beta}(1,1).

Specific Applications

  1. Random number generation — The Unif(0,1)\text{Unif}(0,1) is the source distribution for all Monte Carlo simulations and pseudo-random generators.
  2. Order statistics and ranking — The distribution of sorted uniform samples gives Beta distributions, used in nonparametric statistics.
  3. Bayesian noninformative priorsUnif(0,1)\text{Unif}(0,1) serves as a prior for probabilities in Bayesian inference (equivalent to Beta(1,1)\text{Beta}(1,1)).
  4. Quantization and rounding errors — Modeling the distribution of continuous variables after discrete rounding.

Key Takeaways

Summary: Uniform Distribution

  • Equal density across [a,b][a, b]: f(x)=1/(ba)f(x) = 1/(b-a)
  • Mean: midpoint (a+b)/2(a+b)/2, Variance: (ba)2/12(b-a)^2/12
  • CDF is linear: F(x)=(xa)/(ba)F(x) = (x-a)/(b-a)
  • Maximum entropy distribution on a bounded interval
  • Foundation for random number generation via inverse transform method
  • MGF: MX(t)=(etbeta)/(t(ba))M_X(t) = (e^{tb} - e^{ta})/(t(b-a))
  • Order statistics of uniforms yield Beta distributions

Premium Content

Uniform Distribution — Equal Probability Across a Range

Unlock this lesson and 900+ advanced tutorials with a Premium plan.

🎯End-to-end Projects
💼Interview Prep
📜Certificates
🤝Community Access

Already a member? Log in

Need Expert Statistics Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement