<s>[INST] Find variance of $X$ given its cumulative distribution function A rv $X$ has the cumulative distribution function
$$ F(x) = \begin{cases} 0 \; \; \; \; x<1 \\ \frac{x^2-2x+2}{2} \; \; \; \; 1 \leq x < 2 \\ 1 \; \; \; \; x \geq 2 \end{cases} $$
Calculate the variance of $X$
attempt
First since $F'(x) = f(x)$, then 
$$ f(x) = x-1 $$
on $[1,2)$ and $0$ otherwise. Now,
$$ Var(X) = E(X^2) - E(X)^2 = \int\limits_1^2 (x^3 - x^2) dx - \left( \int\limits_1^2 (x^2-x )\right)^2 $$
After solving this easy integral I get $0.73$ whereas my answer key says the answer is $\boxed{0.139}$. What is my mistake here? Am I applying the formulas wrong?
 [/INST] The cdf 'jumps' at $x=1$, so $P(X=1)=0.5$.
$$\begin{align} Var(X) &= E(X^2) - E(X)^2 = \int\limits_1^2 (x^3 - x^2) dx + 0.5 - \left( \int\limits_1^2 (x^2-x )dx+0.5\right)^2 \\
& \approx 1.4167+0.5-(0.83333+0.5)^2 \\
& \approx 0,1389 \end{align}$$
</s>