## The Discrete Uniform Distribution

There are a number of important types of discrete random variables. The simplest is the uniform distribution.

A random variable with p.d.f. (probability density function) given by:
P(X = x) = 1/(k+1) for all values of x = 0, ... k
P(X = x) = 0 for other values of x

where k is a constant, is said to be follow a uniform distribution.

Example

Suppose we throw a die. Let X be the random variable denoting what number is thrown.

P(X = 1) = 1/6
P(X = 2) = 1/6 etc

In fact, P(X = x) = 1/6 for all x between 1 and 6. Hence we have a uniform distribution.

Expectation and Variance

We can find the expectation and variance of the discrete uniform distribution:

Suppose P(X = x) = 1/(k+1) for all values of x = 0, ... k.

Then E(X) = 1.P(X = 1) + 2.P(X = 2) + ... + k.P(X = k)
= 1/(k+1) + 2/(k+1) + 3/(k+1) + ... k/(k+1)
= (1/(k+1))(1 + 2 + ... + k)
= (1/(k+1)) x ½k [2 + (k - 1)]     (summing the arithmetic progression)
= ½k

It turns out that the variance is:
k(k+2)
12