# Discrete Uniform Distribution

## Discrete Uniform Distribution

If a random variable $X$ can take $N$ different values with equal probability, then we say that it has a discrete uniform distribution. It is also known as discrete rectangular distribution.

## Definition

A discrete random variable $X$ is said to have a discrete uniform distribution over the range $[1,N]$, if its probability mass function is

 $$\begin{equation*} P(X=x)=\left\{ \begin{array}{ll} \frac{1}{N}, & \hbox{x=1,2,\cdots, N;} \\ 0, & \hbox{Otherwise.} \end{array} \right. \end{equation*}$$

## Graph of discrete uniform distribution

The graph of discrete uniform distribution with $a=1$ and $b=6$ is as follows:

## Mean and Variance

The mean of uniform distribution is

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

Let us calculate $E(X^2)$ to find the variance of discrete uniform distribution.

 $$\begin{eqnarray*} E(X^2) &=& \frac{1}{N}\sum_{x=1}^N x^2 \\ &=& \frac{1}{N}\frac{N(N+1)(2N+1)}{6} = \frac{(N+1)(2N+1)}{6}. \end{eqnarray*}$$
Hence, the variance of uniform distribution is

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

## M.G.F. of Uniform Distribution

The m.g.f. of discrete uniform distribution is

 $$\begin{eqnarray*} M_X(t)&=& E(e^{tX})\\ &=& \frac{1}{N} \sum_{x=1}^N e^{tx} \\ &=& \frac{e^t(1-e^{Nt})}{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 random 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$.

## Conclusion

In this tutorial, you learned about theory of discrete uniform distribution like the probability mass function, mean, variance, moment generating function of discrete uniform distribution. You also learned about general discrete uniform distribution.

To read more about the step by step examples and calculator for discrete uniform distribution refer the link Discrete Uniform Distribution Calculator with Examples. This tutorial will help you to understand how to calculate mean, variance of discrete uniform distribution and you will learn how to calculate probabilities and cumulative probabilities for discrete uniform distribution with the help of step by step examples.