A random variable X has the cumulative distribution function:
$F(x)= \left\{ \begin{array}{l} 0 \text{ for x < 1}\\ \cfrac{x^2-2x+2}{2} \text{ for } 1 \le x <2\\ 1 \text{ for } x \ge 2 \end{array} \right. $
Calculate the variance of x.
I know the definition of variance is: $Var[X]=E[X^2]-E[X]^2$ so we proceed by calculating each term.
$E[X]=\int\limits_{-\infty}^{\infty}xf(x)dx\tag{1}$
$E[X^2]=\int\limits_{-\infty}^{\infty}x^2f(x)dx\tag{2}$
So to evaluate equations (1) and (2), we need to calculate the PDF. This is where I am confused. I know the PDF is the derivative of the CDF. Also, we note that $F(2)-F(1) = 1/2$ and by definition $F(\infty)=1$.
This forces the probability for $x<1$ to be 1/2. Is this correct? How would we write the system of equations for the PDF below? I don't really see how this is a combination of discrete and continuous if the limits are $(x<1), 1 \le x < 2, x \ge 2$. Can someone please explain this and breakdown $E[X],E[X^2]$?
$f(x)= \left\{ \begin{array}{l} 0 \text{ for x < 1}\\ (x-1) \text{ for } 1 \le x <2\\ 0 \text{ for } x \ge 2 \end{array} \right. $
Any help is appreciated. Thank you!