# Statistics/Distributions/Uniform

### Continuous Uniform Distribution

Notation Probability density functionUsing maximum convention Cumulative distribution function ${\displaystyle {\mathcal {U}}(a,b)}$ ${\displaystyle -\infty ${\displaystyle x\in [a,b]}$ ${\displaystyle {\begin{cases}{\frac {1}{b-a}}&{\text{for }}x\in [a,b]\\0&{\text{otherwise}}\end{cases}}}$ ${\displaystyle {\begin{cases}0&{\text{for }}x ${\displaystyle {\tfrac {1}{2}}(a+b)}$ ${\displaystyle {\tfrac {1}{2}}(a+b)}$ any value in ${\displaystyle [a,b]}$ ${\displaystyle {\tfrac {1}{12}}(b-a)^{2}}$ 0 ${\displaystyle -{\tfrac {6}{5}}}$ ${\displaystyle \ln(b-a)\,}$ ${\displaystyle {\frac {\mathrm {e} ^{tb}-\mathrm {e} ^{ta}}{t(b-a)}}}$ ${\displaystyle {\frac {\mathrm {e} ^{itb}-\mathrm {e} ^{ita}}{it(b-a)}}}$

The (continuous) uniform distribution, as its name suggests, is a distribution with probability densities that are the same at each point in an interval. In casual terms, the uniform distribution shapes like a rectangle.

Mathematically speaking, the probability density function of the uniform distribution is defined as

${\displaystyle f\colon [a,b]\to \mathbb {R} }$

${\displaystyle f\left(x\right)={1 \over {b-a}}}$

And the cumulative distribution function is:

${\displaystyle F\left(x\right)={\begin{cases}0,&{\mbox{if }}x\leq a\\{{x-a} \over {b-a}},&{\mbox{if }}a

#### Mean

We derive the mean as follows.

${\displaystyle \operatorname {E} [X]=\int _{-\infty }^{\infty }xf(x)dx}$

As the uniform distribution is 0 everywhere but [a, b] we can restrict ourselves that interval

${\displaystyle \operatorname {E} [X]=\int _{a}^{b}{1 \over {b-a}}xdx}$
${\displaystyle \operatorname {E} [X]=\left.{1 \over (b-a)}{1 \over 2}x^{2}\right|_{a}^{b}}$
${\displaystyle \operatorname {E} [X]={1 \over 2(b-a)}\left[b^{2}-a^{2}\right]}$
${\displaystyle \operatorname {E} [X]={b+a \over 2}}$

#### Variance

We use the following formula for the variance.

${\displaystyle \operatorname {Var} (X)=\operatorname {E} [X^{2}]-(\operatorname {E} [X])^{2}}$
${\displaystyle \operatorname {Var} (X)=\left[\int _{-\infty }^{\infty }f(x)\cdot x^{2}dx\right]-\left({b+a \over 2}\right)^{2}}$
${\displaystyle \operatorname {Var} (X)=\left[\int _{a}^{b}{1 \over {b-a}}x^{2}dx\right]-{(b+a)^{2} \over 4}}$
${\displaystyle \operatorname {Var} (X)=\left.{1 \over {b-a}}{1 \over 3}x^{3}\right|_{a}^{b}-{(b+a)^{2} \over 4}}$
${\displaystyle \operatorname {Var} (X)={1 \over 3(b-a)}[b^{3}-a^{3}]-{(b+a)^{2} \over 4}}$
${\displaystyle \operatorname {Var} (X)={4(b^{3}-a^{3})-3(b+a)^{2}(b-a) \over 12(b-a)}}$
${\displaystyle \operatorname {Var} (X)={(b-a)^{3} \over 12(b-a)}}$
${\displaystyle \operatorname {Var} (X)={(b-a)^{2} \over 12}}$