# Variance Formula

for the variance formula $\text{var}(X) = E[X^2]-(E[X])^2$
how are you suppose to work out $E[X^2]$ given the interval $[0,1]$ and $E[x]= 1/2$

-
You need to know more about the distribution than just the interval and the expected value. Is $X$, for example, uniform on the interval $[0,1]$? – Robert Israel Dec 10 '12 at 20:55

You cannot determine $E[X^{2}]$ without more information. For $f_{1}(x) = 1$, we have that $$E[X] = \int_{0}^{1} x f_{1}(x) \, dx = \int_{0}^{1} x \, dx = \left. \frac{1}{2} x^{2} \right|_{x = 0}^{x = 1} = \frac{1}{2},$$ and $$E[X^{2}] = \int_{0}^{1} x^{2} f_{1}(x) \, dx = \int_{0}^{1} x^{2} \, dx = \left. \frac{1}{3} x^{3} \right|_{x = 0}^{x = 1} = \frac{1}{3}.$$ For $f_{2}(x) = 12 (x - \frac{1}{2})^{2}$, we have that $$E[X] = \int_{0}^{1} x f_{2}(x) \, dx = \int_{0}^{1} 12 x (x - \tfrac{1}{2})^{2} \, dx = \left. \frac{x^{2} (6 x^{2} - 8 x + 3)}{2} x^{2} \right|_{x = 0}^{x = 1} = \frac{1}{2},$$ and $$E[X^{2}] = \int_{0}^{1} x^{2} f_{2}(x) \, dx = \int_{0}^{1} 12 x^{2} (x - \tfrac{1}{2})^{2} \, dx = \left. \frac{x^{3} (12 x^{2} - 15 x + 5)}{5} \right|_{x = 0}^{x = 1} = \frac{2}{5}.$$
$f(x) = \begin{cases} 0 &\textrm{ when } x<0,\\ x^2(3-2x) &\textrm{ when } 0\leq x \leq 1,\\ 1 &\textrm{ when } x>1. \end{cases}$ – jill Dec 10 '12 at 21:07
thats the $f(x)$ value in the question – jill Dec 10 '12 at 21:08
You give a cumulative distribution function (CDF), not a probability density function (PDF). Let $F(x)$ be the function you gave and $f(x)$ be its derivative. You can compute – Stirling Dec 10 '12 at 21:10
so $F(x) =$ the above CDF ... whilst $f(x) = 6x(1-x)$ ?? – jill Dec 10 '12 at 21:13
Correct. Then evaluate the integral $$E[X^{2}] = \int_{0}^{1} x^{2} f(x) dx$$. You can tell that $F(x)$ is a CDF because it does not integrate to 1, while $f(x) = F'(x)$ does. – Stirling Dec 10 '12 at 21:15