# Prove variance in Uniform distribution (continuous)

I read in wikipedia article, variance is $\frac{1}{12}(b-a)^2$ , can anyone prove or show how can I derive this?

• Today's homework question for me... – Ron Jensen Oct 10 '17 at 3:33

By the definition of the variance, $\operatorname{Var} X = \mathbb{E}[X^2] - (\mathbb{E} X)^2$.
Since here $\mathbb{E} X = \frac{1}{b-a}\int_{[a,b]}x dx = \frac{a+b}{2}$, and $\mathbb{E} X^2 = \frac{1}{b-a}\int_{[a,b]}x^2 dx = \frac{b^3-a^3}{3(b-a)}=\frac{a^2+ab+b^2}{3}$, it follows that $$\operatorname{Var} X = \frac{a^2+ab+b^2}{3} - \frac{a^2+2ab+b^2}{4} = \frac{a^2-2ab+b^2}{12} =\frac{(b-a)^2}{12}$$
Let $U$ uniform on $[-1,1]$. Then $X = \frac{a+b}2 + \frac{b-a}2 U$ (in law) and $$Var\ X = \frac{(b-a)^2}4 Var\ U\\ Var \ U = EU^2 =\frac 12 \int_{-1}^1x^2dx = \int_{0}^1x^2dx = \frac 13\\ Var\ X = \frac{(b-a)^2}{12}$$