Solved – Variance of uniform distribution

uniform distributionvariance

I can see how one can compute the variance of a uniform distribution on $[a,b]$ using

$$ Var[X] = E[X^2] – E[X]^2 = \frac{(b-a)^2}{12}$$

as explained e.g. here: http://www.statlect.com/probability-distributions/uniform-distribution

However, how does one compute it using

$$ Var[X] = E[(X – E[X])^2] $$ ?

My approach would be transform $(X-E[X])^2$ to a new random variable $Y$ which follows a cdf $$G(y) = P(Y < y) = P((X-E[X])^2 < y) = P(X < \sqrt{y} + E[X]) = \frac{\sqrt{y} + E[X]-a}{b-a} $$

whenever $\sqrt{y} + E[X] \in [a,b]$, i.e., $y \in [a_Y, b_Y]$ where $a_Y = (\frac{3a-b}{2})^2$ and $b_Y = (\frac{b+a}{2})^2 $, and 0 otherwise.

Thus $g(y) = \frac{1}{2(b-a)\sqrt{y}}$ for $y \in [a_Y, b_Y]$ and 0 otherwise.

And then I would compute $$Var[X] = E[(X – E[X])^2] = E[Y] = \int_{a_Y}^{b_Y} y g(y) dy = \frac{1}{2(b-a)} \int_{a_Y}^{b_Y} \sqrt{y} dy$$

which does not yield the desired result.

What goes wrong with my transformation?

Best Answer

However, how does one compute it using $Var[X] = E[(X - E[X])^2]$?

You could just use the law of the unconscious statistician
$\operatorname{E}[g(X)] = \int_{-\infty}^\infty g(x) f_X(x) \, dx $ where $g$ is $(X-\mu)^2$

What goes wrong with my transformation?

Well, this is wrong, for one thing:

$P((X-E[X])^2 < y) = P(X < \sqrt{y} + E[X]) $

Related Question