Variance of Continuous Uniform Distribution

Theorem
Let $a, b \in \R$ such that $a < b$.

Let $X \sim \ContinuousUniform a b$ be the continuous uniform distribution over $\closedint a b$.

Then:


 * $\var X = \dfrac {\paren {b - a}^2} {12}$

Proof
From the definition of the continuous uniform distribution, $X$ has probability density function:


 * $\map {f_X} x = \begin{cases} \dfrac 1 {b - a} & a \le x \le b \\ 0 & \text{otherwise} \end{cases}$

From Variance as Expectation of Square minus Square of Expectation:


 * $\ds \var X = \int_{-\infty}^\infty x^2 \map {f_X} x \rd x - \paren {\expect X}^2$

So:

Also see

 * Variance of Discrete Uniform Distribution