DISCRETE UNIFORM DISTRIBUTION
DEFINITION
The Discrete uniform distribution, as the name says is a simple discrete probability distribution that assigns equal or uniform probabilities to all values that the random variable can take.
If we consider $$X$$ to be a random variable that takes the values $$X=1,\ 2,\ 3,\ 4,\dots \dots \dots k$$ then the uniform distribution would assign each value a probability of $${1}/{k}$$.

CALCULATOR

#### Enter the following details:

Number of observations:

Probability of occurance of each observation:

Mean of the specified uniform distribution:

Variance of the specified uniform distribution:

Probability distribution
 x p(X=x) P(X ≤ x)
FORMULA AND DERIVATION
Probability distribution:-

As stated above, the uniform distribution assigns equal probabilities to all values that the random variable can take. If $$X$$ is a random variable that can take the values $$X=1,\ 2,\ 3,\ 4,\dots \dots \dots k$$ , then the probability of getting each value would be $${1}/{k}$$ . The probabilities would be:

$P\left(X=1\right)=\frac{1}{k}$ $P\left(X=2\right)=\frac{1}{k}$ $\dots$ $\dots$ $P\left(X=k\right)=\frac{1}{k}$
Therefore, the probability distribution function is defined as follows:-

$$P\left(X=x\right)=\frac{1}{k}$$ for $$X=1,\ 2,\ 3,\ \dots \dots \dots k$$

Mean:-

The mean or expected value for the uniform distribution can be calculated from first principles, as follows:-
$E\left(X\right)=\mu =\sum{xP\left(X=x\right)}$ $\mu =1\times \frac{1}{k}+2\times \frac{1}{k} \dots +k\times \frac{1}{k}$ $\ \ \ =\frac{1}{k}\left(1+2+3\dots +k\right)$ $\ \ \ =\frac{1}{k}\times \frac{k}{2}\left(k+1\right)$ $\ \ \ =\frac{k+1}{2}$
The mean of a uniform distribution is simply the middle value of the distribution. This is because, the uniform distribution is a symmetric distribution.

Variance:-

Variance of the Discrete Uniform distribution can be derived from first principles using the formula:
$$Var\left(X\right)=E\left[{\left(x-\mu \right)}^2\right]=\sum{{\left(x-\mu \right)}^2P\left(X=x\right)}$$
or, using a simpler formula:
$$Var\left(X\right)=E\left(X^2\right)-E^2\left(X\right)$$

$$E\left(X^2\right)$$ can be calculated as follows:-
$E\left(X^2\right)=\sum{x^2P\left(X=x\right)}$ $\ \ \ \ \ \ \ \ \ \ \ \ =1^2\times \frac{1}{k}+2^2\times \frac{1}{k} \dots +k^2\times \frac{1}{k}$ $\ \ \ \ \ \ \ \ \ \ \ \ =\frac{1}{k}\left(1^2+2^2+3^2\dots +k^2\right)$ [Now, we use sum of squares of n numbers = $$\frac{n}{6}\left(n+1\right)\left(2n+1\right)$$ ] $\ \ \ \ \ \ \ \ \ \ \ \ =\frac{1}{k}\times \frac{k}{6}\left(k+1\right)\left(2k+1\right)$ $\ \ \ \ \ \ \ \ \ \ \ \ =\frac{\left(k+1\right)\left(2k+1\right)}{6}$
Substituting this into the formula for variance, we get:-
$Var\left(X\right)={\sigma }^2=E\left(X^2\right)-E^2\left(X\right)$ ${\sigma }^2=\frac{\left(k+1\right)\left(2k+1\right)}{6}-{\left(\frac{k+1}{2}\right)}^2$ $\ \ \ \ =\frac{1}{6}\left(k+1\right)\left(2k+1\right)-\frac{1}{4}{\left(k+1\right)}^2$ $\ \ \ \ =\frac{1}{6}\left({2k}^2+3k+1\right)-\frac{1}{4}\left(k^2+2k+1\right)$ $\ \ \ \ =\frac{k^2}{3}+\frac{k}{2}+\frac{1}{6}-\frac{k^2}{4}-\frac{k}{2}-\frac{1}{4}$ $\ \ \ \ =\frac{k^2}{12}-\frac{1}{12}$ $\ \ \ \ =\frac{k^2-1}{12}$
Probability Generating Function(PGF):-

The PGF for a uniform distribution is
$G_X\left(t\right)=\frac{t\left(1-t^k\right)}{k\left(1-t\right)} \ for \ t≠1$
Moment Generating Function(MGF):-

The MGF for a uniform distribution is
$M_X\left(t\right)=\frac{e^t\left(1-e^{tk}\right)}{k\left(1-e^t\right)} \ for \ t≠1$
Cumulant Generating Function(CGF):-

The CGF for a uniform distribution is
$C_X\left(t\right)={\mathrm{ln} \frac{\left(1-e^{tk}\right)}{\left(1-e^t\right)}\ }+t-{\mathrm{ln} k\ } \ for \ t≠1$
EXAMPLES
Example 1

A random variable X models the number appearing on top when a fair die is rolled. The values that the random variable X can take are $$X=1,\ 2,\ 3,\ 4,\ 5,\ 6.$$. Therefore, $$k=6$$. The probability of getting each number on the top when the die is rolled will be the same, i.e. $${1}/{6}$$ . The probability distribution can be written as follows:-

$$x$$ $$P(X=x)$$
$$1$$ $${1}/{6}$$
$$2$$ $${1}/{6}$$
$$3$$ $${1}/{6}$$
$$4$$ $${1}/{6}$$
$$5$$ $${1}/{6}$$
$$6$$ $${1}/{6}$$

Mean:-
$\mu =\frac{k+1}{2}$ $\mu =\frac{7}{2}=3.5$
Variance:-
${\sigma }^2=\frac{k^2-1}{12}$ $\ \ \ \ =\frac{35}{12}=2.9167$