## Discrete uniform distribution

In this tutorial we will discuss some examples on discrete uniform distribution and learn how to compute mean of uniform distribution, variance of uniform distribution and probabilities 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}

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

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

## 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}

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

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

The distribution function of general discrete uniform distribution is

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

## Example 1

Roll a six faced fair die. Suppose $X$ denote the number appear on the top of a die.

a. Find the probability that an even number appear on the top,

b. Find the probability that the number appear on the top is less than 3. c. Compute mean and variance of $X$.

### Solution

Let $X$ denote the number appear on the top of a die. Then the random variable $X$ take the values $X=1,2,3,4,5,6$ and $X$ follows $U(1,6)$ distribution.

The probability mass function of random variable $X$ is

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

a. The probability that an even number appear on the top of the die is

\begin{aligned} P(X=\text{ even number }) &=P(X=2)+P(X=4)+P(X=4)\\ &=\frac{1}{6}+\frac{1}{6}+\frac{1}{6}\\ &=\frac{3}{6}\\ &= 0.5 \end{aligned} b. The probability that the number appear on the top of the die is less than 3 is

\begin{aligned} P(X<3) &=P(X=1)+P(X=2)\\ &=\frac{1}{6}+\frac{1}{6}\\ &=\frac{2}{6}\\ &= 0.3333 \end{aligned} c. The mean of $X$ is

\begin{aligned} E(X) &=\frac{1+6}{2}\\ &=\frac{7}{2}\\ &= 3.5 \end{aligned} The variance of $X$ is

\begin{aligned} V(X) &=\frac{(6-1+1)^2-1}{12}\\ &=\frac{35}{12}\\ &= 2.9167 \end{aligned}

## Example 2

A telephone number is selected at random from a directory. Suppose $X$ denote the last digit of selected telephone number. Find the probability that the last digit of the selected number is

a. 6

b. less than 3

c. greater than or equal to 8

### Solution

Let $X$ denote the last digit of randomly selected telephone number. The possible values of $X$ are $0,1,2,\cdots, 9$.

All the numbers $0,1,2,\cdots, 9$ are equally likely. Thus the random variable $X$ follows a discrete uniform distribution $U(0,9)$. The probability mass function of $X$ is

\begin{aligned} P(X=x) &=\frac{1}{9-0+1} \\ &= \frac{1}{10}; x=0,1,2\cdots, 9 \end{aligned}

a. The probability that the last digit of the selected number is 6

\begin{aligned} P(X=6) &=\frac{1}{10}\\ &= 0.1 \end{aligned}

b. The probability that the last digit of the selected telecphone number is less than 3

\begin{aligned} P(X<3) &=P(X\leq 2)\\ &=P(X=0) + P(X=1) + P(X=2)\\ &=\frac{1}{10}+\frac{1}{10}+\frac{1}{10}\\ &= 0.1+0.1+0.1\\ &= 0.3 \end{aligned}

c. The probability that the last digit of the selected telecphone number is greater than or equal to 8

\begin{aligned} P(X\geq 8) &=P(X=8) + P(X=9)\\ &=\frac{1}{10}+\frac{1}{10}\\ &= 0.1+0.1\\ &= 0.2 \end{aligned}