# 42 Uniform Distribution

## 42.1 Probability Density Function

A random variable $$X$$ is said to have a Uniform Distribution with parameters $$a$$ and $$b$$ if its pdf is

$f(x)=\left\{ \begin{array}{ll} \frac{1}{b-a}, & a\leq x \leq b\\ 0 & elsewhere \end{array} \right.$

## 42.2 Cumulative Density Function

\begin{aligned} F(x) &= \int\limits_{a}^{x}\frac{1}{b-a}dt \\ &= \frac{t}{b-a}|_{a}^{x} \\ &= \frac{x}{b-a}-\frac{a}{b-a} \\ &= \frac{x-a}{b-a} \end{aligned}

$F(x)=\left\{ \begin{array}{lll} 0 & x<a\\ \frac{x-a}{b-a},& a\leq x\leq b\\ 1 & elsewhere \end{array}\right.$

## 42.3 Expected Values

\begin{aligned} E(X) &= \int\limits_{a}^{b}x\frac{1}{b-a}dx \\ &= \frac{1}{b-a}\int\limits_{a}^{b}x\ dx \\ &= \frac{1}{b-a}\cdot \Big[\frac{x^2}{2}\Big]_a^b \\ &= \frac{1}{b-a}\cdot\Big[\frac{b^2}{2}-\frac{a^2}{2}\Big] \\ &= \frac{1}{b-a}\cdot \frac{b^2-a^2}{2} \\ &= \frac{b^2-a^2}{2(b-a)} \\ &= \frac{(b-a)(b+a)}{2(b-a)} \\ &= \frac{b+a}{2} \\ \\ \\ E(X^2) &= \int\limits_{a}^{b}x^2\frac{1}{b-a}dx \\ &= \frac{1}{b-a}\int\limits_{a}^{b}x^2\ \frac{1}{b-a}dx \\ &= \frac{1}{b-a}\Big[\frac{x^3}{3}\Big]_a^b \\ &= \frac{1}{b-a}\Big[\frac{b^3-a^3}{3}\Big] \\ &= \frac{1}{b-a}\Big[\frac{(b-a)(b^2+ab+a^2)}{3}\Big] \\ &= \frac{(b-a)(b^2+ab+a^2)}{3(b-a)} \\ &= \frac{(b^2+ab+a^2)}{3} \\ \\ \\ \mu &= E(X) \\ &= \frac{b+a}{1} \\ \\ \\ \sigma^2 &= E(X^2) - E(X)^2 \\ &= \frac{b^2+ab+a^2}{3} - \frac{(b-a)^2}{4} \\ &= \frac{4(b^2+ab+a^2)-3(b+a)^2}{12} \\ &= \frac{4(b^2+ab+a^2-3(b^2+2ab+a^2)}{12} \\ &= \frac{4b^2+4ab+4a^2-3b^2-6ab-3a^2)}{12} \\ &= \frac{4b^2-3b^2+4ab-6ab+4a^2-3a^2}{12} \\ &= \frac{b^2-2a+a^2}{12}=\frac{(b-a)^2}{12} \end{aligned}

## 42.4 Moment Generating Function

\begin{aligned} M_X(t) &= E(e^{tX})=\int\limits_{a}^{b}e^{tx}\frac{1}{b-a}dx \\ &= \frac{1}{b-a}\int\limits_{a}^{b}e^{tx}dx \\ &= \frac{1}{b-a}\Big[\frac{e^{tb}-e^{ta}}{t}\Big] \\ &= \frac{e^{t(b-a)}}{t(b-a)} \end{aligned}

$$M_X^{(k)}(0)$$ will lead to an undefined operation (division by 0). Thus, in the case of the Uniform distribution, we are unable to use the method of moments to identify parameter values.

## 42.6 Validity of the Distribution

$\int\limits_{a}^{b}\frac{1}{b-a} = 1$

Proof:

\begin{aligned} \int\limits_{a}^{b}\frac{1}{b-a} &= \frac{x}{b-a}\Big|_a^b \\ &= \frac{b}{b-a}-\frac{a}{b-a} \\ &= \frac{b-a}{b-a} \\ &= 1 \end{aligned}