Course contentsShow
← Data Science
Lesson 163 of 2,1455. Continuous Probability DistributionsFree lesson

Uniform Distribution: Mean and Variance

Calculating expected value and variance for uniform distributions using integration.

Uniform Distribution: Mean and Variance

You'll learn how to calculate the expected value and variance of a uniform distribution using integration.

What Are We Calculating?

For a continuous uniform distribution on the interval [a, b], we want to find two key measures: the mean (expected value) and variance. These tell us the center and spread of our uniformly distributed random variable.

The Mean Formula

Since the PDF of a uniform distribution is f(x) = 1/(b-a) for a ≤ x ≤ b, we use integration to find the expected value:

E[X] = ∫ₐᵇ x · f(x) dx = ∫ₐᵇ x · 1/(b-a) dx

Working through the integral:

  • Pull out the constant: 1/(b-a) · ∫ₐᵇ x dx
  • Integrate: 1/(b-a) · [x²/2] evaluated from a to b
  • Result: E[X] = (a + b)/2

This makes perfect sense! The mean is just the midpoint of the interval.

The Variance Formula

For variance, we use Var(X) = E[X²] - (E[X])².

First, find E[X²]: E[X²] = ∫ₐᵇ x² · 1/(b-a) dx = 1/(b-a) · [x³/3] from a to b

This gives us E[X²] = (b³ - a³)/(3(b-a)).

After algebraic simplification: Var(X) = (b - a)²/12

Think of it this way: the wider your uniform range, the larger the variance — specifically, it grows with the square of the interval width.

Example: [0, 10] Uniform Distribution

  • Mean: (0 + 10)/2 = 5
  • Variance: (10 - 0)²/12 = 100/12 ≈ 8.33
  • Standard deviation: √8.33 ≈ 2.89

Key Takeaway: For a uniform distribution on [a, b], the mean is simply (a+b)/2 and the variance is (b-a)²/12 — both derived through integration of the PDF.