# mean for cumulative distribution function

I'm trying to find the mean (expected value) and variance for the following distribution function:

$$F(x)=\begin{cases} 0 & \text{for } x \lt 1\\ \frac{x^2-2x+2}{2} & \text{for } 1 \le x \lt 2\\ 1 & \text{for } x \ge 2\\ \end{cases}$$

First I got the probability density function by differentiating

$$f(x)=\begin{cases} 0 & \text{for } x \lt 1\\ {x-1} & \text{for } 1 \le x \lt 2\\ 0 & \text{for } x \ge 2\\ \end{cases}$$

$$\mathbb{E}(X) = \int x f(x) dx = \int_1^2 x(x-1) dx = \frac{5}{6}$$

but i see in some book, that this is a mix distribution function because it has mass at X=1

$$P(X=1)= F(1)-F(1^-)=\frac{1}{2}$$

$$f(x)=\begin{cases} 0.5 & \text{for } x = 1\\ {x-1} & \text{for } 1 \lt x \le 2\\ \end{cases}$$

$$\mathbb{E}(X) = \int x f(x) dx = 1.P(X=1) + \int_1^2 x(x-1) dx = \frac{4}{3}$$

am i right and which one is right?

The second one is the right one since $$\int_1^2 x-1 \, dx=0.5$$. If we add $$F\left(1^+ \right)=0.5$$ we get $$1$$. It fulfills one property of a valid pdf: $$\int\limits_{-\infty}^{\infty} f(x) \, dx=1$$
• thankyou so much, but how can i differentiate both distribution? i have to check whether its sum is 1 for $f(x)$? – devss May 6 at 0:27
• @devss Yes but you have to check if there is a gap somewhere as well. It is a mixed distribution. And every cdf has to be right-continuous. That means $F(1^+)=F(1)\Rightarrow F(1^+)=\frac{1-2+2}{2}$ $\Rightarrow F(1^+)=\frac12$. There is a gap of $0.5$ since $P(X<1)=0$ Therefore $F(1)=0.5$ – callculus May 6 at 15:40