Exam PDiscreteFree to read

Discrete uniform distribution

A finite set of equally likely integer outcomes, such as one fair die.

Parameters and support

aa
smallest value in the support - a∈Za \in \mathbb{Z}
bb
largest value in the support - b≥ab \ge a
Support
x∈{a, a+1, …, b}x \in \{a,\, a+1,\, \dots,\, b\}

The formulas

p(x)
p(x)=1b−a+1p(x) = \dfrac{1}{b-a+1}
F(x)
F(x)=⌊x⌋−a+1b−a+1,a≤x≤bF(x) = \dfrac{\lfloor x \rfloor - a + 1}{b-a+1}, \quad a \le x \le b
Mean
E[X]=a+b2E[X] = \dfrac{a+b}{2}
Variance
Var⁡(X)=(b−a+1)2−112\operatorname{Var}(X) = \dfrac{(b-a+1)^2 - 1}{12}
MGF
M(t)=eat(ent−1)n(et−1),n=b−a+1M(t) = \dfrac{e^{at}\left(e^{n t} - 1\right)}{n\left(e^{t} - 1\right)}, \quad n = b-a+1
Memory hook. The mean is the midpoint, and the variance is (n² − 1)/12 where n is the COUNT of values, not the range. A fair die has n = 6, so Var = 35/12 - not 25/12.

Where the moments come from

  1. Shift the support to {1,2,…,n}\{1, 2, \dots, n\} with n=b−a+1n = b-a+1; shifting changes the mean by a constant and leaves the variance alone.
  2. E[X]=1n∑k=1nk=n+12E[X] = \frac{1}{n}\sum_{k=1}^{n} k = \frac{n+1}{2} using the arithmetic-series sum.
  3. E[X2]=1n∑k=1nk2=(n+1)(2n+1)6E[X^2] = \frac{1}{n}\sum_{k=1}^{n} k^2 = \frac{(n+1)(2n+1)}{6} using the sum of squares.
  4. Var⁡(X)=(n+1)(2n+1)6−(n+12)2=n2−112\operatorname{Var}(X) = \frac{(n+1)(2n+1)}{6} - \left(\frac{n+1}{2}\right)^2 = \frac{n^2-1}{12}.
  5. Shifting back adds a−1a-1 to the mean and leaves the variance unchanged.

Worked example

A fair six-sided die is rolled once. Find the variance of the number showing.

  1. The support is {1,2,3,4,5,6}\{1,2,3,4,5,6\}, so n=6−1+1=6n = 6 - 1 + 1 = 6 values.
  2. Var⁡(X)=n2−112=36−112=3512\operatorname{Var}(X) = \dfrac{n^2 - 1}{12} = \dfrac{36 - 1}{12} = \dfrac{35}{12}.
  3. As a decimal that is 2.91672.9167.

Answer: 35/12 ≈ 2.9167

The mean, variance, CDF and moment generating function above are re-derived numerically from this distribution’s own density on every test run - summed over the support for a discrete distribution, integrated by quadrature for a continuous one - and compared with the closed forms printed here. A typo on this page fails that test run.

Traps

  • Using the range b − a instead of the count b − a + 1 in the variance.
  • Assuming the variance formula (n² − 1)/12 applies to a CONTINUOUS uniform - there it is (b − a)²/12.

1 solved sample question

From the free samples in the question bank, solved in full. They never rotate and they are never gated.

  1. Exam PRandom variables and distribution functionsExam level
    A random variable is uniform on the integers 1 through 20. Find P(X>14)P(X > 14).
    1. A0.05000.0500
    2. B0.25000.2500
    3. C0.30000.3000
    4. D0.35000.3500
    5. E0.70000.7000

    Solution

    1. Each of the 20 integers has probability 1/201/20.
    2. 'Greater than 14' means the values 15 through 20 - six of them.
    3. P(X>14)=6/20P(X>14) = 6/20.
    4. =0.30= 0.30. Counting carefully matters: 'at least 14' would give seven values and 0.35.

    Trap. Including 14 itself and answering 0.35.

Drill this topic: Discrete distributions has 32 questions, 2 of them solved free on that page, and the full question bank has 400. The drills are part of Premium. Every free sample and today’s mixed round stay free.

Related

The recall trainer builds its prompts from exactly the formulas above.