A random variable has a uniform distribution when each value of the random variable is equally likely, and values are uniformly distributed throughout some interval.
If $X$ is uniformly distributed over the interval $[a,b]$, then the following formulas will apply.
\begin{align} f(x) &= \dfrac{1}{b-a} \\ F_X (x) &= \dfrac{x-a}{b-a} \\ M(t) &= \dfrac{e^{tb} - e^{ta}}{t(b-a)} \\ E(X) &= \dfrac{a+b}{2} \\ Var(X) &= \dfrac{(b-a)^2}{12} \end{align} |
Consider the function $f(x)=\dfrac19$ on the interval $[6,15]$. We note the following about this distribution.
The CDF makes it quite easy to find probabilities for this continuous uniform distribution.
Since the PDF of a continuous uniform distribution is a constant function, and probabilities of continuous distributions are areas under the PDF, these results could also have been found very easily with a geometric argument.
Suppose $f(x)$ is the PDF of a continuous uniform distribution on the interval $[a,b]$. Since a uniform distribution requires that each value of the random variable be equally likely, $f(x)$ will be a constant function. Therefore, suppose $f(x)=c$ on the interval $[a,b]$. Since the definite integral of the PDF over the interval must be equal to $1$, we can solve the equation $\int_a^b c \, \mathrm{d}x = 1$ for $c$. Working with the integral, we have
\begin{equation} \int_a^b c \, \mathrm{d}x = \left. cx \right|_a^b = c(b-a) = 1 \end{equation}which gives $c = \dfrac{1}{b-a}$. In other words, the PDF is $f(x) = \dfrac{1}{b-a}$.
The CDF is simply the integral of the PDF.
\begin{equation} \int_a^x \dfrac{1}{b-a} \mathrm{d}t = \left. \dfrac{1}{b-a} t \right|_a^x = \dfrac{x-a}{b-a} \end{equation}The moment generating function is the value of $E(e^{tX})$.
\begin{equation} M(t) = E(e^{tX}) = \int_a^b \dfrac{e^{tx}}{b-a} \, \mathrm{d}x = \left. \dfrac{1}{(b-a)} \dfrac{e^{tx}}{t} \right|_{x=a}^b = \dfrac{e^{tb}-e^{ta}}{t(b-a)} \end{equation}When using the moment generating function to find the expected value and the variance, quantities having the indeterminate form $\dfrac00$ are produced, which would require L'Hopital's Rule. Therefore, we obtain these directly from the algebra, beginning with the expected value.
\begin{equation} \int_a^b \dfrac{1}{b-a} x \, \mathrm{d}x = \left. \dfrac{1}{2(b-a)} x^2 \right|_a^b = \dfrac{b^2-a^2}{2(b-a)} = \dfrac{(b-a)(b+a)}{2(b-a)} = \dfrac{a+b}{2} \end{equation}We next produce a value for $E(X^2)$.
\begin{equation} \int_a^b \dfrac{1}{b-a} x^2 \mathrm{d}x = \left. \dfrac{1}{3(b-a)} x^3 \right|_a^b = \dfrac{b^3-a^3}{3(b-a)} = \dfrac{(b-a)(b^2+ab+a^2)}{3(b-a)} = \dfrac{b^2+ab+a^2}{3} \end{equation}We can then find the variance.
\begin{align} Var(X) &= E(X^2) - (E(X))^2 \\ &= \dfrac{b^2+ab+a^2}{3} - \left( \dfrac{a+b}{2} \right)^2 \\ &= \dfrac{4(b^2+ab+a^2)}{12} - \dfrac{3(a^2+2ab+b^2)}{12} \\ &= \dfrac{b^2-2ab+a^2}{12} \\ &= \dfrac{(b-a)^2}{12} \end{align}Therefore, the standard deviation is $\sigma_X = \dfrac{b-a}{\sqrt{12}}$.