## Discrete Uniform Distribution

A discrete random variable has a discrete uniform distribution if each value of the random variable is equally likely and the values of the random variable are uniformly distributed throughout some specified interval.

In this tutorial we will discuss about discrete uniform distribution and theories related to uniform distribution.

## Definition of Discrete Uniform Distribution

A discrete random variable $X$ is said to have a uniform distribution if its probability mass function (pmf) is given by

\begin{aligned} P(X=x)&=\frac{1}{N},;; x=1,2, \cdots, N. \end{aligned}

## Graph of Discrete Uniform Distribution

Following graph shows the probability mass function of discrete uniform distribution $U(1,6)$.

## Mean of Discrete Uniform Distribution

The expected value of discrete uniform random variable is $E(X) =\dfrac{N+1}{2}$.

### Proof

The expected value of discrete uniform random variable is

\begin{aligned} E(X) &= \sum_{x=1}^N x\cdot P(X=x)\\ &= \frac{1}{N}\sum_{x=1}^N x\\ &= \frac{1}{N}(1+2+\cdots + N)\\ &= \frac{1}{N}\times \frac{N(N+1)}{2}\\ &= \frac{N+1}{2}. \end{aligned}

Hence, the mean of discrete uniform distribution is $E(X) =\dfrac{N+1}{2}$.

## Variance of Discrete Uniform Distribution

The variance of discrete uniform random variable is $V(X) = \dfrac{N^2-1}{12}$.

### Proof

The variance of discrete uniform random variable $X$ is given by

$$\begin{equation*} V(X) = E(X^2) - [E(X)]^2. \end{equation*}$$

Let us find the expected value of $X^2$.

$$\begin{eqnarray*} E(X^2) &=& \sum_{x=1}^N x^2\cdot P(X=x)\\ &=& \frac{1}{N}\sum_{x=1}^N x^2\\ &=& \frac{1}{N}(1^2+2^2+\cdots + N^2)\\ &=& \frac{1}{N}\times \frac{N(N+1)(2N+1)}{6}\\ &=& \frac{(N+1)(2N+1)}{6}. \end{eqnarray*}$$

Now, the variance of $X$ is

$$\begin{eqnarray*} V(X) & = & E(X^2) - [E(X)]^2\\ &=& \frac{(N+1)(2N+1)}{6}- \bigg(\frac{N+1}{2}\bigg)^2\\ &=& \frac{N+1}{2}\bigg[\frac{2N+1}{3}-\frac{N+1}{2} \bigg]\\ &=& \frac{N+1}{2}\bigg[\frac{4N+2-3N-3}{6}\bigg]\\ &=& \frac{N+1}{2}\bigg[\frac{N-1}{6}\bigg]\\ &=& \frac{N^2-1}{12}. \end{eqnarray*}$$

Thus the variance of discrete uniform distribution is $\sigma^2 =\dfrac{N^2-1}{12}$.

The standard deviation of discrete uniform distribution is $\sigma =\sqrt{\dfrac{N^2-1}{12}}$.

## Moment generation function of discrete uniform distribution

The MGF of $X$ is $M_X(t) = \dfrac{e^t (1 - e^{tN})}{N (1 - e^t)}$.

### Proof

The moment generating function of random variable $X$ is

$$\begin{eqnarray*} M(t) &=& E(e^{tx})\\ &=& \sum_{x=1}^N e^{tx} \dfrac{1}{N} \\ &=& \dfrac{1}{N} \sum_{x=1}^N (e^t)^x \\ &=& \dfrac{1}{N} e^t \dfrac{1-e^{tN}}{1-e^t} \\ &=& \dfrac{e^t (1 - e^{tN})}{N (1 - e^t)}. \end{eqnarray*}$$

## General discrete uniform distribution

A general discrete uniform distribution has a probability mass function

\begin{aligned} P(X=x)&=\frac{1}{b-a+1},;; x=a,a+1,a+2, \cdots, b. \end{aligned}

## Mean of General discrete uniform distribution

The expected value of above discrete uniform randome variable is $E(X) =\dfrac{a+b}{2}$.

## Variance of General discrete uniform distribution

The variance of above discrete uniform random variable is $V(X) = \dfrac{(b-a+1)^2-1}{12}$.

## Distribution Function of General discrete uniform distribution

The distribution function of general discrete uniform distribution is

$F(x) = P(X\leq x)=\frac{x-a+1}{b-a+1}; a\leq x\leq b$.