The uniform distribution
A uniform distribution is one where every outcome in a range is equally likely. The discrete uniform distribution covers a fixed set of values, like the score on a fair dice. The continuous uniform distribution, X ~ U(a, b), covers every value between a and b, with probability density f(x) = 1/(b − a). Its graph is a flat rectangle, so it is also called the rectangular distribution. Its mean is (a + b)/2 and its variance is (b − a)²/12.
Discrete uniform distribution
If a random variable X can take n different values, each equally likely, then each has probability 1/n. Pearson Edexcel's A-level Maths specification expects students to know and be able to identify the discrete uniform distribution. A fair six-sided dice is the classic example: P(X = x) = 1/6 for x = 1, 2, 3, 4, 5, 6.
For the values 1, 2, ..., n, the mean and variance are:
Where the formulas come from
The mean is the sum of the values times 1/n. The sum 1 + 2 + ... + n is n(n + 1)/2, so E(X) = (n + 1)/2. For the variance, use E(X²) − [E(X)]². The sum of the squares 1² + ... + n² is n(n + 1)(2n + 1)/6, so:
Example 1: a fair eight-sided spinner
A fair spinner is numbered 1 to 8. X is the score.
- Each score has P(X = x) = 1/8.
- P(X > 5) = P(6, 7 or 8) = 3/8 = 0.375.
- E(X) = (8 + 1)/2 = 4.5. It's the middle of the range, even though 4.5 isn't a possible score.
- Var(X) = (8² − 1)/12 = 63/12 = 5.25.
Continuous uniform distribution
OpenStax describes the continuous uniform distribution as a continuous distribution for outcomes that are equally likely, written X ~ U(a, b), where a is the lowest value and b the highest. The probability density function is constant across the range and zero outside it:
The graph shows the pdf of X ~ U(2, 10): f(x) (up) against x (across). The height is 1/8 = 0.125, so the rectangle has width 8 and height 1/8, and its area is 1, as every pdf's area must be.
Finding probabilities
A probability is the area under the pdf, and here every area is a rectangle: width × height. OpenStax puts it the same way: base times height, with height 1/(b − a). So:
For X ~ U(2, 10): P(3 < X < 6.5) = (6.5 − 3)/(10 − 2) = 3.5/8 = 0.4375. For a continuous distribution, the probability of any single exact value is 0, so it doesn't matter whether you write < or ≤. OpenStax warns to check whether a question includes the endpoints for discrete data, where it does matter.
Mean, variance and the cumulative distribution function
Edexcel's Further Maths specification includes deriving all three. The mean comes from integrating x f(x):
For the variance, E(X²) = (b³ − a³)/(3(b − a)) = (a² + ab + b²)/3. Subtracting the square of the mean:
For X ~ U(2, 10): E(X) = 6, Var(X) = 8²/12 = 5.33 and the standard deviation is √5.33 = 2.31. The cumulative distribution function F(x) = P(X ≤ x) rises in a straight line from 0 at x = a to 1 at x = b.
Worked examples
Example 2: waiting for a train
Trains on a line leave every 20 minutes, and a passenger arrives at a random time. Model the waiting time W minutes as W ~ U(0, 20).
- P(W > 12) = (20 − 12)/20 = 0.4.
- E(W) = (0 + 20)/2 = 10 minutes, and Var(W) = 20²/12 = 33.3, so the standard deviation is 5.77 minutes.
- Given the passenger has already waited 5 minutes, what is the chance of waiting more than 12 in total? The remaining range is 5 to 20, so P(W > 12 | W > 5) = (20 − 12)/(20 − 5) = 8/15 = 0.533.
The last part uses the trick OpenStax describes for conditional probability: shrink the range to what you know, and the distribution is still uniform on the new range.
Example 3: rounding errors
A length is measured and rounded to the nearest centimetre. The rounding error, E cm, could be anything from −0.5 to 0.5, so model it as E ~ U(−0.5, 0.5).
- E(E) = (−0.5 + 0.5)/2 = 0: on average, rounding doesn't bias the answer.
- Var(E) = (0.5 − (−0.5))²/12 = 1/12 = 0.0833, so the standard deviation is 0.289 cm.
- P(the error is more than 0.3 cm either way) = P(E < −0.3) + P(E > 0.3) = 0.2 + 0.2 = 0.4.
When to use a uniform model
- Discrete uniform: a fair dice, a fair spinner, choosing one item at random from a numbered list.
- Continuous uniform: arriving at a random moment for something that happens at regular intervals, rounding errors, the position of a random cut along a length.
- Not uniform: heights, exam marks or reaction times, which bunch up around a middle value. A normal distribution usually fits those better. Counting successes in repeated trials needs the binomial distribution.
Common mistakes
- Using n/12 for the discrete variance. It is (n² − 1)/12 for the values 1 to n.
- Thinking f(x) is a probability. In the continuous case, probabilities are areas; f(x) is the height, and can be bigger than 1 if the range is narrow.
- Forgetting zero outside the range. For X ~ U(2, 10), P(X < 1) = 0.
- Applying the continuous formula to dice. A dice isn't U(1, 6): it can't score 2.7. Use the discrete formulas.
- Conditional probability with the wrong denominator. Divide by the width of the range you know the value is in.
Practise probability distributions on today's A-level Maths: Statistics or A-level Further Maths short timed paper, and check probabilities with the probability calculator.
Common questions
What is a uniform distribution?
What is the formula for the continuous uniform distribution?
What is the mean of a uniform distribution?
What is the variance of a uniform distribution?
Why is it called a rectangular distribution?
How do you find a probability for a continuous uniform distribution?
Revision cards
Say the answer first, then flip the card to check it.
Where to go next
- Solve it
Probability Calculator
Visualise probability distributions and events
Open the tool - Learn it
Probability
Distributions, expected values and the maths behind uncertainty
Start the course - Test it
A-level Maths: Statistics
A new exam-style paper every day, with instant marking and a mark scheme
Start today's paper