The distribution function of a random variable $X$ is given by
$P (X \leq x)$ = \begin{cases} 0 & \text{if $x<0$}, \\ x^{k} & \text{if $0 \leq x \leq 1, \,\,\,\,\,\, k\geq1$}, \\ 1 & \text{if $x > 1$}. \end{cases}
Determine the mean and variance of $X$.
Workings:
I am aware that I must start by calculating $\sum_{-\infty}^{\infty} x \,\cdot p_X(x)$, but because this is a continuous distribution, I will instead have to calculate $\int_{-\infty}^{\infty} x \, \cdot p_X(x) \,dx$. However, once I integrate it, I am confused as to what further steps as to which I am meant to take given that I get infinity as the expected value. Could someone please tell me if it is possible for the expected value to be infinite and if I have made a mistake in my workings? Thank you.
\begin{align} \text{E(X)} & = \int_{-\infty}^{\infty} x \, \cdot p_X(x) \,dx \\ & = \int_{-\infty}^{0} x \, \cdot 0 \,dx \: + \int_{0}^{1} x \, \cdot x^{k} \,dx \: + \int_{1}^{\infty} x \,dx \\ & = C + \bigg{[}\frac{x^{k+2}}{k+2}\bigg{]}_{0}^{1} + \bigg{[}\frac{x^{2}}{2}\bigg{]}_{1}^{\infty} \end{align}