Calculate the variance of random variable $X$ A random variable has the cumulative distribution function $$F(x)=\begin{cases} 0 & x<1\\\frac{x^2-2x+2}{2}&x\in[1,2)\\1&x\geq2\end{cases}.$$ Calculate the variance of $X$.
First I differentiated the distribution function to get the density function, $f_X(x)=x-1$, for $x\in[1,2)$, and then I calculated $$E(X^2)-[E(X)]^2=\int_1^2x^2(x-1)dx-\bigg(\int_1^2x(x-1)dx\bigg)^2=\frac{13}{18}.$$
However, the correct answer is $\frac{5}{36}$. Why is that answer correct? I thought $var(X)=E(X^2)-[E(X)]^2$? 
Also, Merry Christmas!

Note that $X$ does not have continuous distribution. For $F(x)$ approaches $0$ as $x$ approaches $1$ from the left, while $F(1)=1/2$.
So there is a point mass of $1/2$ at $x=1$. This has to be taken into consideration both for the calculation of $E(X)$ and of $E(X^2)$.  (Your expression for the variance in terms of $E(X)$ and $E(X^2)$ is correct.)
